xref: /llvm-project/clang/test/CodeGenCXX/globalinit-loc.cpp (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
2 //
3 // Verify that the global init helper function does not get associated
4 // with any source location.
5 //
6 // CHECK: define internal {{.*}}void @_GLOBAL__sub_I_globalinit_loc.cpp({{.*}} {
7 // CHECK: !dbg ![[DBG:.*]]
8 // CHECK: !DISubprogram(linkageName: "_GLOBAL__sub_I_globalinit_loc.cpp"
9 // CHECK-NOT:           line:
10 // CHECK-SAME:          DISPFlagLocalToUnit
11 // CHECK-SAME:          DISPFlagDefinition
12 // CHECK: ![[DBG]] = !DILocation(line: 0,
13 # 99 "someheader.h"
14 class A {
15 public:
16   A();
foo()17   int foo() { return 0; }
18 };
19 # 5 "main.cpp"
20 A a;
21 
f()22 int f() {
23   return a.foo();
24 }
25 
26