1 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -g %s -o - | FileCheck %s 2 // RUN: %clang_cc1 -triple i686-pc-windows-msvc -emit-llvm -g %s -o - | FileCheck %s --check-prefix=MSVC 3 4 template<typename T> struct Identity { 5 typedef T Type; 6 }; 7 8 void f(Identity<int>::Type a) {} 9 void f(Identity<int> a) {} 10 void f(int& a) { } 11 12 template<typename T> struct A { 13 A<T> *next; 14 }; 15 void f(A<int>) { } 16 17 struct B { }; 18 19 void f() { 20 int B::*a = 0; 21 void (B::*b)() = 0; 22 } 23 24 namespace EmptyNameCrash { 25 struct A { A(); }; 26 typedef struct { A x; } B; 27 B x; 28 } 29 30 // PR4890 31 namespace PR4890 { 32 struct X { 33 ~X(); 34 }; 35 36 X::~X() { } 37 } 38 39 namespace VirtualDtor { 40 struct Y { 41 virtual ~Y(); 42 }; 43 44 Y::~Y() { } 45 } 46 47 namespace VirtualBase { 48 struct A { int a; }; 49 struct B : virtual A { int b; }; 50 51 void f() { 52 B b; 53 } 54 } 55 56 // CHECK: define void @_ZN7pr147634funcENS_3fooE 57 // CHECK: call void @llvm.dbg.declare({{.*}}, metadata ![[F:.*]], metadata ![[EXPR:.*]]) 58 59 // MSVC: [[VBASE_B:![0-9]+]] = distinct !{!"0x13\00B\00{{[0-9]+}}\0096\0032\000\000\000", {{.*}}, null, [[VBASE_B_DEF:![0-9]+]], {{.*}}} ; [ DW_TAG_structure_type ] [B] [line 49, size 96, align 32, offset 0] [def] [from ] 60 // MSVC: [[VBASE_B_DEF]] = !{[[VBASE_A_IN_B:![0-9]+]], 61 // 62 // Look for the vbtable offset of A, which should be 4. 63 // MSVC: [[VBASE_A_IN_B]] = !{!"0x1c\00\000\000\000\004\0032", null, [[VBASE_B]], !{{[0-9]*}}} ; [ DW_TAG_inheritance ] [line 0, size 0, align 0, offset 4] [from A] 64 65 // CHECK: !"0x13\00B\00{{[0-9]+}}\00128\0064\000\000\000", {{.*}}, null, [[VBASE_B_DEF:![0-9]+]], {{.*}}} ; [ DW_TAG_structure_type ] [B] [line 49, size 128, align 64, offset 0] [def] [from ] 66 // CHECK: [[VBASE_B_DEF]] = !{[[VBASE_A_IN_B:![0-9]+]], 67 // 68 // Look for the vtable offset offset, which should be -24. 69 // CHECK: [[VBASE_A_IN_B]] = !{!"0x1c\00\000\000\000\0024\0032", null, !"_ZTSN11VirtualBase1BE", !"_ZTSN11VirtualBase1AE"} ; [ DW_TAG_inheritance ] [line 0, size 0, align 0, offset 24] [from _ZTSN11VirtualBase1AE] 70 namespace b5249287 { 71 template <typename T> class A { 72 struct B; 73 }; 74 75 class Cls { 76 template <typename T> friend class A<T>::B; 77 }; 78 79 Cls obj; 80 } 81 82 namespace pr14763 { 83 struct foo { 84 foo(const foo&); 85 }; 86 87 foo func(foo f) { 88 return f; // reference 'f' for now because otherwise we hit another bug 89 } 90 91 // CHECK: !"0x13\00{{.*}}", !{{[0-9]*}}, [[PR14763:![0-9]*]], {{.*}}, !"[[FOO:.*]]"} ; [ DW_TAG_structure_type ] [foo] 92 // CHECK: [[PR14763]] = {{.*}} ; [ DW_TAG_namespace ] [pr14763] 93 // CHECK: [[INCTYPE:![0-9]*]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [decl] 94 // CHECK: [[A_MEM:![0-9]*]], null, null, !"_ZTSN7pr162141aE"} ; [ DW_TAG_structure_type ] [a] 95 // CHECK: [[A_MEM]] = !{[[A_I:![0-9]*]]} 96 // CHECK: [[A_I]] = {{.*}} ; [ DW_TAG_member ] [i] {{.*}} [from int] 97 // CHECK: ; [ DW_TAG_structure_type ] [b] {{.*}}[decl] 98 99 // CHECK: [[FUNC:![0-9]*]] = !{!"0x2e\00func\00func\00_ZN7pr147634funcENS_3fooE\00{{.*}}"{{, [^,]+, [^,]+}}, [[FUNC_TYPE:![0-9]*]], {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func] 100 } 101 102 void foo() { 103 const wchar_t c = L'x'; 104 wchar_t d = c; 105 } 106 107 // CHECK-NOT: ; [ DW_TAG_variable ] [c] 108 109 namespace pr9608 { // also pr9600 110 struct incomplete; 111 incomplete (*x)[3]; 112 // CHECK: [[INCARRAYPTR:![0-9]*]], [3 x i8]** @_ZN6pr96081xE, null} ; [ DW_TAG_variable ] [x] 113 // CHECK: [[INCARRAYPTR]] = {{.*}}[[INCARRAY:![0-9]*]]} ; [ DW_TAG_pointer_type ] 114 // CHECK: [[INCARRAY]] = !{!"0x1\00\000\000\000\000\000\000", null, null, !"_ZTSN6pr960810incompleteE", {{![0-9]+}}, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 0, align 0, offset 0] [from _ZTSN6pr960810incompleteE] 115 } 116 117 // For some reason function arguments ended up down here 118 // CHECK: ![[F]] = !{!"0x101\00f\00{{.*}}\000", [[FUNC]], {{![0-9]+}}, !"[[FOO]]"} ; [ DW_TAG_arg_variable ] [f] 119 // CHECK: ![[EXPR]] = {{.*}} ; [ DW_TAG_expression ] [DW_OP_deref] 120 121 // CHECK: ; [ DW_TAG_auto_variable ] [c] 122 123 namespace pr16214 { 124 struct a { 125 int i; 126 }; 127 128 typedef a at; 129 130 struct b { 131 }; 132 133 typedef b bt; 134 135 void func() { 136 at a_inst; 137 bt *b_ptr_inst; 138 const bt *b_cnst_ptr_inst; 139 } 140 141 } 142