diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-07-24 01:40:49 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-07-24 01:40:49 +0000 |
commit | 78d1a10e13a1abfd4830bccf2a97b2993da1ed5c (patch) | |
tree | 1cdf9d8bfd0887ab21721de66e769ddba67fb233 /test/CodeGenCXX/debug-info-globalinit.cpp | |
parent | f50b6fe092091a700cee7a708d509ae7c49709f6 (diff) |
Emit debug info for dynamic initializers. Permit __attribute__((nodebug)) on
variables that have static storage duration, it removes debug info on the
emitted initializer function but not all debug info about this variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160659 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/debug-info-globalinit.cpp')
-rw-r--r-- | test/CodeGenCXX/debug-info-globalinit.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/CodeGenCXX/debug-info-globalinit.cpp b/test/CodeGenCXX/debug-info-globalinit.cpp new file mode 100644 index 0000000000..b8a23baba9 --- /dev/null +++ b/test/CodeGenCXX/debug-info-globalinit.cpp @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -std=c++11 -g | FileCheck %s + +void crash() { + volatile char *ptr = 0; + char x = *ptr; +} + +int test() { + crash(); + return 1; +} + +static int i = test(); +__attribute__((nodebug)) static int j = test(); + +int main(void) {} + +// CHECK: define internal void @__cxx_global_var_init() +// CHECK-NOT: __cxx_global_var_init +// CHECK: %call = call i32 @_Z4testv(), !dbg ![[LINE:.*]] +// CHECK-NOT: __cxx_global_var_init +// CHECK: store i32 %call, i32* @_ZL1i, align 4, !dbg +// +// CHECK: define internal void @__cxx_global_var_init1() +// CHECK-NOT: dbg +// CHECK: %call = call i32 @_Z4testv() +// CHECK-NOT: dbg +// CHECK: store i32 %call, i32* @_ZL1j, align 4 +// +// CHECK: ![[LINE]] = metadata !{i32 13, i32 16 |