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 | 085970736f7e7c12bf592da908db5d31c09aa8c9 (patch) | |
tree | 6c7d28ce696870c7198652627d6e69d11ced7df4 /clang/test/CodeGenCXX/debug-info-globalinit.cpp | |
parent | cfb4517cc0df43b61d3dff5f2286d568f25804a5 (diff) | |
download | bcm5719-llvm-085970736f7e7c12bf592da908db5d31c09aa8c9.tar.gz bcm5719-llvm-085970736f7e7c12bf592da908db5d31c09aa8c9.zip |
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.
llvm-svn: 160659
Diffstat (limited to 'clang/test/CodeGenCXX/debug-info-globalinit.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/debug-info-globalinit.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/debug-info-globalinit.cpp b/clang/test/CodeGenCXX/debug-info-globalinit.cpp new file mode 100644 index 00000000000..b8a23baba91 --- /dev/null +++ b/clang/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 |