diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGenCXX/debug-info-nodebug.cpp | 5 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/debug-info-nodebug.m | 26 | ||||
-rw-r--r-- | clang/test/Sema/attr-nodebug.c | 4 |
3 files changed, 32 insertions, 3 deletions
diff --git a/clang/test/CodeGenCXX/debug-info-nodebug.cpp b/clang/test/CodeGenCXX/debug-info-nodebug.cpp index 7a10e6708cc..9f140efaed6 100644 --- a/clang/test/CodeGenCXX/debug-info-nodebug.cpp +++ b/clang/test/CodeGenCXX/debug-info-nodebug.cpp @@ -44,9 +44,12 @@ void func3() { // YESINFO-DAG: !DIDerivedType({{.*}} name: "static_const_member" // NOINFO-NOT: !DIDerivedType({{.*}} name: "static_const_member" -// Function-local static variable. +// Function-local static and auto variables. void func4() { NODEBUG static int static_local = 6; + NODEBUG int normal_local = 7; } // YESINFO-DAG: !DIGlobalVariable(name: "static_local" // NOINFO-NOT: !DIGlobalVariable(name: "static_local" +// YESINFO-DAG: !DILocalVariable(name: "normal_local" +// NOINFO-NOT: !DILocalVariable(name: "normal_local" diff --git a/clang/test/CodeGenObjC/debug-info-nodebug.m b/clang/test/CodeGenObjC/debug-info-nodebug.m new file mode 100644 index 00000000000..42d630b4ac1 --- /dev/null +++ b/clang/test/CodeGenObjC/debug-info-nodebug.m @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -triple arm-apple-ios -emit-llvm -debug-info-kind=limited -fblocks %s -o - | FileCheck %s +// Objective-C code cargo-culted from debug-info-lifetime-crash.m. +@protocol NSObject +- (id)copy; +@end +@class W; +@interface View1 +@end +@implementation Controller { + void (^Block)(void); +} +- (void)View:(View1 *)View foo:(W *)W +{ + // The reference from inside the block implicitly creates another + // local variable for the referenced member. That is what gets + // suppressed by the attribute. It still gets debug info as a + // member, though. + // CHECK-NOT: !DILocalVariable(name: "weakSelf" + // CHECK: !DIDerivedType({{.*}} name: "weakSelf" + // CHECK-NOT: !DILocalVariable(name: "weakSelf" + __attribute__((nodebug)) __typeof(self) weakSelf = self; + Block = [^{ + __typeof(self) strongSelf = weakSelf; + } copy]; +} +@end diff --git a/clang/test/Sema/attr-nodebug.c b/clang/test/Sema/attr-nodebug.c index 39643bfb70d..e7ca58d3ba1 100644 --- a/clang/test/Sema/attr-nodebug.c +++ b/clang/test/Sema/attr-nodebug.c @@ -2,8 +2,8 @@ int a __attribute__((nodebug)); -void b() { - int b __attribute__((nodebug)); // expected-warning {{'nodebug' attribute only applies to functions and global variables}} +void b(int p __attribute__((nodebug))) { // expected-warning {{'nodebug' attribute only applies to variables and functions}} + int b __attribute__((nodebug)); } void t1() __attribute__((nodebug)); |