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 3 4 // CHECK: @_ZN6pr96081xE = global [3 x i8]* null, align 8, !dbg [[X:![0-9]+]] 5 6 // CHECK: define void @_ZN7pr147634funcENS_3fooE 7 // CHECK: call void @llvm.dbg.declare({{.*}}, metadata ![[F:[0-9]+]], metadata ![[EXPR:[0-9]+]]) 8 9 // !llvm.dbg.cu pulls in globals and their types first. 10 // CHECK-NOT: !DIGlobalVariable(name: "c" 11 // CHECK: [[X]] = !DIGlobalVariableExpression(var: [[XV:!.*]]) 12 // CHECK: [[XV]] = distinct !DIGlobalVariable(name: "x", linkageName: "_ZN6pr96081xE" 13 // CHECK-SAME: type: [[INCARRAYPTR:![0-9]*]] 14 // CHECK: [[INCARRAYPTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[INCARRAY:![0-9]+]] 15 // CHECK: [[INCARRAY]] = !DICompositeType(tag: DW_TAG_array_type 16 // CHECK-NOT: line: 17 // CHECK-NOT: size: 18 // CHECK-NOT: align: 19 // CHECK-NOT: offset: 20 // CHECK-SAME: baseType: ![[INCTYPE:[0-9]+]] 21 22 // CHECK: ![[INCTYPE]] = !DICompositeType(tag: DW_TAG_structure_type, name: "incomplete" 23 // CHECK-SAME: DIFlagFwdDecl 24 // CHECK: ![[EXPR]] = !DIExpression() 25 26 template<typename T> struct Identity { 27 typedef T Type; 28 }; 29 30 void f(Identity<int>::Type a) {} 31 void f(Identity<int> a) {} 32 void f(int& a) { } 33 34 template<typename T> struct A { 35 A<T> *next; 36 }; 37 void f(A<int>) { } 38 39 struct B { }; 40 41 void f() { 42 int B::*a = 0; 43 void (B::*b)() = 0; 44 } 45 46 namespace EmptyNameCrash { 47 struct A { A(); }; 48 typedef struct { A x; } B; 49 B x; 50 } 51 52 // PR4890 53 namespace PR4890 { 54 struct X { 55 ~X(); 56 }; 57 58 X::~X() { } 59 } 60 61 namespace VirtualDtor { 62 struct Y { 63 virtual ~Y(); 64 }; 65 66 Y::~Y() { } 67 } 68 69 namespace VirtualBase { 70 struct A { int a; }; 71 struct B : virtual A { int b; }; 72 // BOTH: ![[VBASE_B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B",{{.*}} line: [[@LINE-1]], 73 // MSVC-SAME: size: 96 74 // CHECK-SAME: size: 128, 75 // BOTH-NOT: offset: 76 // BOTH-NOT: DIFlagFwdDecl 77 // BOTH-SAME: elements: [[VBASE_B_DEF:![0-9]+]] 78 // BOTH: [[VBASE_B_DEF]] = !{[[VBASE_A_IN_B:![0-9]+]], 79 // 80 // Look for the vbtable offset of A, which should be 4 for MSVC, 24 otherwise. 81 // BOTH: [[VBASE_A_IN_B]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[VBASE_B]], 82 // BOTH-SAME: baseType: ![[VBASE_A:[0-9]+]], 83 // MSVC-SAME: offset: 4, 84 // CHECK-SAME: offset: 24, 85 // 86 // BOTH: ![[VBASE_A]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "A", 87 88 void f() { 89 B b; 90 } 91 } 92 93 namespace b5249287 { 94 template <typename T> class A { 95 struct B; 96 }; 97 98 class Cls { 99 template <typename T> friend class A<T>::B; 100 }; 101 102 Cls obj; 103 } 104 105 // CHECK: [[FUNC:[0-9]+]] = distinct !DISubprogram(name: "func", linkageName: "_ZN7pr147634funcENS_3fooE" 106 // CHECK-SAME: type: {{![0-9]+}} 107 // CHECK-SAME: isDefinition: true 108 109 // CHECK: [[PR14763:![0-9]+]] = !DINamespace(name: "pr14763" 110 namespace pr14763 { 111 struct foo { 112 // CHECK: ![[FOO:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "foo" 113 // CHECK-SAME: scope: [[PR14763]] 114 // CHECK-SAME: identifier: 115 foo(const foo&); 116 }; 117 118 // For some reason function arguments ended up down here 119 // CHECK: ![[F]] = !DILocalVariable(name: "f", arg: 1, scope: ![[FUNC]] 120 // CHECK-SAME: type: ![[FOO]] 121 foo func(foo f) { 122 return f; // reference 'f' for now because otherwise we hit another bug 123 } 124 125 } 126 127 void foo() { 128 // CHECK: !DILocalVariable(name: "c" 129 // CHECK-NOT: arg: 130 // CHECK-SAME: ) 131 const wchar_t c = L'x'; 132 wchar_t d = c; 133 } 134 135 namespace pr9608 { // also pr9600 136 struct incomplete; 137 incomplete (*x)[3]; 138 } 139 140 namespace pr16214 { 141 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "a" 142 // CHECK-SAME: elements: [[A_MEM:![0-9]+]] 143 // CHECK-SAME: identifier: "_ZTSN7pr162141aE" 144 // CHECK: [[A_MEM]] = !{[[A_I:![0-9]*]]} 145 struct a { 146 // CHECK: [[A_I]] = !DIDerivedType(tag: DW_TAG_member, name: "i" 147 int i; 148 }; 149 150 typedef a at; 151 152 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "b" 153 // CHECK-SAME: DIFlagFwdDecl 154 struct b { 155 }; 156 157 typedef b bt; 158 159 void func() { 160 at a_inst; 161 bt *b_ptr_inst; 162 const bt *b_cnst_ptr_inst; 163 } 164 165 } 166