1 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=BOTH
2 // RUN: %clang_cc1 -triple i686-pc-windows-msvc -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=MSVC --check-prefix=BOTH
4 // CHECK: @_ZN6pr96081xE ={{.*}} global ptr null, align 8, !dbg [[X:![0-9]+]]
6 // CHECK: define{{.*}} void @_ZN7pr147634funcENS_3fooE
7 // CHECK-SAME: ptr noundef [[param:%.*]])
9 // CHECK-NEXT: alloca ptr, align 8
10 // CHECK-NEXT: [[param_addr_storage:%.*]] = alloca ptr, align 8
12 // CHECK-NEXT: store ptr [[param]], ptr [[param_addr_storage]], align 8
13 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[param_addr_storage]], metadata ![[F:[0-9]+]], metadata !DIExpression(DW_OP_deref))
15 // !llvm.dbg.cu pulls in globals and their types first.
16 // CHECK-NOT: !DIGlobalVariable(name: "c"
17 // CHECK: [[X]] = !DIGlobalVariableExpression(var: [[XV:!.*]], expr: !DIExpression())
18 // CHECK: [[XV]] = distinct !DIGlobalVariable(name: "x", linkageName: "_ZN6pr96081xE"
19 // CHECK-SAME: type: [[INCARRAYPTR:![0-9]*]]
20 // CHECK: [[INCARRAYPTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[INCARRAY:![0-9]+]]
21 // CHECK: [[INCARRAY]] = !DICompositeType(tag: DW_TAG_array_type
26 // CHECK-SAME: baseType: ![[INCTYPE:[0-9]+]]
28 // CHECK: ![[INCTYPE]] = !DICompositeType(tag: DW_TAG_structure_type, name: "incomplete"
29 // CHECK-SAME: DIFlagFwdDecl
31 template<typename T
> struct Identity
{
35 void f(Identity
<int>::Type a
) {}
36 void f(Identity
<int> a
) {}
39 template<typename T
> struct A
{
51 namespace EmptyNameCrash
{
53 typedef struct { A x
; } B
;
66 namespace VirtualDtor
{
74 namespace VirtualBase
{
76 struct B
: virtual A
{ int b
; };
77 // BOTH: ![[VBASE_B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B",{{.*}} line: [[@LINE-1]],
78 // MSVC-SAME: size: 96
79 // CHECK-SAME: size: 128,
81 // BOTH-NOT: DIFlagFwdDecl
82 // BOTH-SAME: elements: [[VBASE_B_DEF:![0-9]+]]
83 // BOTH: [[VBASE_B_DEF]] = !{[[VBASE_A_IN_B:![0-9]+]],
85 // Look for the vbtable offset of A, which should be 4 for MSVC, 24 otherwise.
86 // BOTH: [[VBASE_A_IN_B]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[VBASE_B]],
87 // BOTH-SAME: baseType: ![[VBASE_A:[0-9]+]],
88 // MSVC-SAME: offset: 4,
89 // CHECK-SAME: offset: 24,
91 // BOTH: ![[VBASE_A]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "A",
99 template <typename T
> class A
{
104 template <typename T
> friend class A
<T
>::B
;
110 // CHECK: [[FUNC:[0-9]+]] = distinct !DISubprogram(name: "func", linkageName: "_ZN7pr147634funcENS_3fooE"
111 // CHECK-SAME: type: {{![0-9]+}}
112 // CHECK-SAME: DISPFlagDefinition
114 // CHECK: [[PR14763:![0-9]+]] = !DINamespace(name: "pr14763"
117 // CHECK: ![[FOO:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "foo"
118 // CHECK-SAME: scope: [[PR14763]]
119 // CHECK-SAME: identifier:
123 // For some reason function arguments ended up down here
124 // CHECK: ![[F]] = !DILocalVariable(name: "f", arg: 1, scope: ![[FUNC]]
125 // CHECK-SAME: type: ![[FOO]]
127 return f
; // reference 'f' for now because otherwise we hit another bug
133 // CHECK: !DILocalVariable(name: "c"
136 const wchar_t c
= L
'x';
140 namespace pr9608
{ // also pr9600
146 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "a"
147 // CHECK-SAME: elements: [[A_MEM:![0-9]+]]
148 // CHECK-SAME: identifier: "_ZTSN7pr162141aE"
149 // CHECK: [[A_MEM]] = !{[[A_I:![0-9]*]]}
151 // CHECK: [[A_I]] = !DIDerivedType(tag: DW_TAG_member, name: "i"
157 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "b"
158 // CHECK-SAME: DIFlagFwdDecl
167 const bt
*b_cnst_ptr_inst
;