1// clang-format off
2// REQUIRES: lld, x86
3
4// Global ctor and dtor should be globals decls.
5// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -GS- -fno-addrsig -c /Fo%t.obj -- %s
6// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb -force
7// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols --dump-ast %t.exe | FileCheck %s
8
9struct A {
10 ~A() {};
11};
12struct B {
13 static A glob;
14};
15
16A B::glob = A();
17int main() {
18 return 0;
19}
20
21// CHECK: static void B::`dynamic initializer for 'glob'();
22// CHECK-NEXT: static void B::`dynamic atexit destructor for 'glob'();
23// CHECK-NEXT: int main();
24// CHECK-NEXT: static void _GLOBAL__sub_I_global_ctor_dtor.cpp();
25// CHECK-NEXT: struct A {
26// CHECK-NEXT: ~A();
27// CHECK-NEXT: };
28// CHECK-NEXT: struct B {
29// CHECK-NEXT: static A glob;
30// CHECK-NEXT: };
31

source code of lldb/test/Shell/SymbolFile/NativePDB/global-ctor-dtor.cpp