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 // 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 ] 57 // MSVC: [[VBASE_B_DEF]] = !{[[VBASE_A_IN_B:![0-9]+]], 58 // 59 // Look for the vbtable offset of A, which should be 4. 60 // 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] 61 62 // 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 ] 63 // CHECK: [[VBASE_B_DEF]] = !{[[VBASE_A_IN_B:![0-9]+]], 64 // 65 // Look for the vtable offset offset, which should be -24. 66 // 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] 67 namespace b5249287 { 68 template <typename T> class A { 69 struct B; 70 }; 71 72 class Cls { 73 template <typename T> friend class A<T>::B; 74 }; 75 76 Cls obj; 77 } 78 79 namespace pr14763 { 80 struct foo { 81 foo(const foo&); 82 }; 83 84 foo func(foo f) { 85 return f; // reference 'f' for now because otherwise we hit another bug 86 } 87 88 // CHECK: !"0x13\00{{.*}}", !{{[0-9]*}}, [[PR14763:![0-9]*]], {{.*}}, !"[[FOO:.*]]"} ; [ DW_TAG_structure_type ] [foo] 89 // CHECK: [[PR14763]] = {{.*}} ; [ DW_TAG_namespace ] [pr14763] 90 // CHECK: [[INCTYPE:![0-9]*]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [decl] 91 // CHECK: [[A_MEM:![0-9]*]], null, null, !"_ZTSN7pr162141aE"} ; [ DW_TAG_structure_type ] [a] 92 // CHECK: [[A_MEM]] = !{[[A_I:![0-9]*]]} 93 // CHECK: [[A_I]] = {{.*}} ; [ DW_TAG_member ] [i] {{.*}} [from int] 94 // CHECK: ; [ DW_TAG_structure_type ] [b] {{.*}}[decl] 95 96 // CHECK: [[FUNC:![0-9]*]] = !{!"0x2e\00func\00func\00_ZN7pr147634funcENS_3fooE\00{{.*}}"{{, [^,]+, [^,]+}}, [[FUNC_TYPE:![0-9]*]], {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func] 97 } 98 99 void foo() { 100 const wchar_t c = L'x'; 101 wchar_t d = c; 102 } 103 104 // CHECK-NOT: ; [ DW_TAG_variable ] [c] 105 106 namespace pr9608 { // also pr9600 107 struct incomplete; 108 incomplete (*x)[3]; 109 // CHECK: [[INCARRAYPTR:![0-9]*]], [3 x i8]** @_ZN6pr96081xE, null} ; [ DW_TAG_variable ] [x] 110 // CHECK: [[INCARRAYPTR]] = {{.*}}[[INCARRAY:![0-9]*]]} ; [ DW_TAG_pointer_type ] 111 // 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] 112 } 113 114 // For some reason function arguments ended up down here 115 // CHECK: = !{!"0x101\00f\00{{.*}}\008192", [[FUNC]], {{![0-9]+}}, !"[[FOO]]"} ; [ DW_TAG_arg_variable ] [f] 116 117 // CHECK: ; [ DW_TAG_auto_variable ] [c] 118 119 namespace pr16214 { 120 struct a { 121 int i; 122 }; 123 124 typedef a at; 125 126 struct b { 127 }; 128 129 typedef b bt; 130 131 void func() { 132 at a_inst; 133 bt *b_ptr_inst; 134 const bt *b_cnst_ptr_inst; 135 } 136 137 } 138