xref: /aosp_15_r20/external/clang/test/CodeGenObjC/debug-info-lifetime-crash.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -triple arm-apple-ios -emit-llvm -debug-info-kind=limited -fblocks -fobjc-runtime=ios-7.0.0 -fobjc-arc %s -o - | FileCheck %s
2*67e74705SXin Li// rdar://problem/14990656
3*67e74705SXin Li@protocol NSObject
4*67e74705SXin Li- (id)copy;
5*67e74705SXin Li@end
6*67e74705SXin Li@class W;
7*67e74705SXin Li@interface View1
8*67e74705SXin Li@end
9*67e74705SXin Li@implementation Controller {
10*67e74705SXin Li    void (^Block)(void);
11*67e74705SXin Li}
12*67e74705SXin Li- (void)View:(View1 *)View foo:(W *)W
13*67e74705SXin Li{
14*67e74705SXin Li  // The debug type for these two will be identical, because we do not
15*67e74705SXin Li  // actually emit the ownership qualifier.
16*67e74705SXin Li  // CHECK: !DILocalVariable(name: "weakSelf",
17*67e74705SXin Li  // CHECK-SAME:             line: [[@LINE+2]]
18*67e74705SXin Li  // CHECK-SAME:             type: ![[SELFTY:[0-9]+]]
19*67e74705SXin Li  __attribute__((objc_ownership(weak))) __typeof(self) weakSelf = self;
20*67e74705SXin Li  Block = [^{
21*67e74705SXin Li  // CHECK: !DILocalVariable(name: "strongSelf",
22*67e74705SXin Li  // CHECK-SAME:             line: [[@LINE+2]]
23*67e74705SXin Li  // CHECK-SAME:             type: ![[SELFTY]]
24*67e74705SXin Li      __attribute__((objc_ownership(strong))) __typeof(self) strongSelf = weakSelf;
25*67e74705SXin Li    } copy];
26*67e74705SXin Li}
27*67e74705SXin Li@end
28