xref: /llvm-project/clang/test/CodeGenObjC/debug-info-nodebug.m (revision afd2dde2fdf23658cd0cbe55175953e735fcb62a)
1*afd2dde2SPaul Robinson// RUN: %clang_cc1 -triple arm-apple-ios -emit-llvm -debug-info-kind=limited -fblocks  %s -o - | FileCheck %s
2*afd2dde2SPaul Robinson// Objective-C code cargo-culted from debug-info-lifetime-crash.m.
3*afd2dde2SPaul Robinson@protocol NSObject
4*afd2dde2SPaul Robinson- (id)copy;
5*afd2dde2SPaul Robinson@end
6*afd2dde2SPaul Robinson@class W;
7*afd2dde2SPaul Robinson@interface View1
8*afd2dde2SPaul Robinson@end
9*afd2dde2SPaul Robinson@implementation Controller {
10*afd2dde2SPaul Robinson    void (^Block)(void);
11*afd2dde2SPaul Robinson}
12*afd2dde2SPaul Robinson- (void)View:(View1 *)View foo:(W *)W
13*afd2dde2SPaul Robinson{
14*afd2dde2SPaul Robinson  // The reference from inside the block implicitly creates another
15*afd2dde2SPaul Robinson  // local variable for the referenced member. That is what gets
16*afd2dde2SPaul Robinson  // suppressed by the attribute.  It still gets debug info as a
17*afd2dde2SPaul Robinson  // member, though.
18*afd2dde2SPaul Robinson  // CHECK-NOT: !DILocalVariable(name: "weakSelf"
19*afd2dde2SPaul Robinson  // CHECK:     !DIDerivedType({{.*}} name: "weakSelf"
20*afd2dde2SPaul Robinson  // CHECK-NOT: !DILocalVariable(name: "weakSelf"
21*afd2dde2SPaul Robinson  __attribute__((nodebug)) __typeof(self) weakSelf = self;
22*afd2dde2SPaul Robinson  Block = [^{
23*afd2dde2SPaul Robinson    __typeof(self) strongSelf = weakSelf;
24*afd2dde2SPaul Robinson    } copy];
25*afd2dde2SPaul Robinson}
26*afd2dde2SPaul Robinson@end
27