1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -std=c++11 -debug-info-kind=limited | FileCheck %s
2
crash()3 void crash() {
4 volatile char *ptr = 0;
5 char x = *ptr;
6 }
7
test()8 int test() {
9 crash();
10 return 1;
11 }
12
13 static int i = test();
14 __attribute__((nodebug)) static int j = test();
15 static int k = test();
16
main(void)17 int main(void) {}
18
19 // CHECK-LABEL: define internal void @__cxx_global_var_init()
20 // CHECK-NOT: __cxx_global_var_init
21 // CHECK: %[[C0:.+]] = call i32 @_Z4testv(), !dbg ![[LINE:.*]]
22 // CHECK-NOT: __cxx_global_var_init
23 // CHECK: store i32 %[[C0]], i32* @_ZL1i, align 4, !dbg
24 //
25 // CHECK-LABEL: define internal void @__cxx_global_var_init.1()
26 // CHECK-NOT: dbg
27 // CHECK: %[[C1:.+]] = call i32 @_Z4testv()
28 // CHECK-NOT: dbg
29 // CHECK: store i32 %[[C1]], i32* @_ZL1j, align 4
30 //
31 // CHECK-LABEL: define internal void @__cxx_global_var_init.2()
32 // CHECK-NOT: __cxx_global_var_init
33 // CHECK: %[[C2:.+]] = call i32 @_Z4testv(), !dbg ![[LINE2:.*]]
34 // CHECK-NOT: __cxx_global_var_init
35 // CHECK: store i32 %[[C2]], i32* @_ZL1k, align 4, !dbg
36 //
37 // CHECK: ![[LINE]] = !DILocation(line: 13,
38 // CHECK: ![[LINE2]] = !DILocation(line: 15,
39