Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -g %s -o - | FileCheck %s
      2 template<typename T> struct Identity {
      3   typedef T Type;
      4 };
      5 
      6 void f(Identity<int>::Type a) {}
      7 void f(Identity<int> a) {}
      8 void f(int& a) { }
      9 
     10 template<typename T> struct A {
     11   A<T> *next;
     12 };
     13 void f(A<int>) { }
     14 
     15 struct B { };
     16 
     17 void f() {
     18   int B::*a = 0;
     19   void (B::*b)() = 0;
     20 }
     21 
     22 namespace EmptyNameCrash {
     23   struct A { A(); };
     24   typedef struct { A x; } B;
     25   B x;
     26 }
     27 
     28 // PR4890
     29 namespace PR4890 {
     30   struct X {
     31     ~X();
     32   };
     33 
     34   X::~X() { }
     35 }
     36 
     37 namespace VirtualDtor {
     38   struct Y {
     39     virtual ~Y();
     40   };
     41 
     42   Y::~Y() { }
     43 }
     44 
     45 namespace VirtualBase {
     46   struct A { };
     47   struct B : virtual A { };
     48 
     49   void f() {
     50     B b;
     51   }
     52 }
     53 
     54 namespace b5249287 {
     55 template <typename T> class A {
     56   struct B;
     57 };
     58 
     59 class Cls {
     60   template <typename T> friend class A<T>::B;
     61 };
     62 
     63 Cls obj;
     64 }
     65 
     66 namespace pr14763 {
     67 struct foo {
     68   foo(const foo&);
     69 };
     70 
     71 foo func(foo f) {
     72   return f; // reference 'f' for now because otherwise we hit another bug
     73 }
     74 
     75 // CHECK: metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata [[PR14763:![0-9]*]], {{.*}}, metadata !"[[FOO:.*]]"} ; [ DW_TAG_structure_type ] [foo]
     76 // CHECK: [[PR14763]] = {{.*}} ; [ DW_TAG_namespace ] [pr14763]
     77 // CHECK: [[INCTYPE:![0-9]*]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [decl]
     78 // CHECK: metadata [[A_MEM:![0-9]*]], i32 0, null, null, metadata !"_ZTSN7pr162141aE"} ; [ DW_TAG_structure_type ] [a]
     79 // CHECK: [[A_MEM]] = metadata !{metadata [[A_I:![0-9]*]]}
     80 // CHECK: [[A_I]] = {{.*}} ; [ DW_TAG_member ] [i] {{.*}} [from int]
     81 // CHECK: ; [ DW_TAG_structure_type ] [b] {{.*}}[decl]
     82 
     83 // CHECK: [[FUNC:![0-9]*]] = {{.*}} metadata !"_ZN7pr147634funcENS_3fooE", i32 {{[0-9]*}}, metadata [[FUNC_TYPE:![0-9]*]], {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func]
     84 }
     85 
     86 void foo() {
     87   const wchar_t c = L'x';
     88   wchar_t d = c;
     89 }
     90 
     91 // CHECK-NOT: ; [ DW_TAG_variable ] [c]
     92 
     93 namespace pr9608 { // also pr9600
     94 struct incomplete;
     95 incomplete (*x)[3];
     96 // CHECK: metadata [[INCARRAYPTR:![0-9]*]], i32 0, i32 1, [3 x i8]** @_ZN6pr96081xE, null} ; [ DW_TAG_variable ] [x]
     97 // CHECK: [[INCARRAYPTR]] = {{.*}}metadata [[INCARRAY:![0-9]*]]} ; [ DW_TAG_pointer_type ]
     98 // CHECK: [[INCARRAY]] = {{.*}}metadata !"_ZTSN6pr960810incompleteE", metadata {{![0-9]*}}, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 0, align 0, offset 0] [from _ZTSN6pr960810incompleteE]
     99 }
    100 
    101 // For some reason function arguments ended up down here
    102 // CHECK: = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], {{.*}}, metadata !"[[FOO]]", i32 8192, i32 0} ; [ DW_TAG_arg_variable ] [f]
    103 
    104 // CHECK: ; [ DW_TAG_auto_variable ] [c]
    105 
    106 namespace pr16214 {
    107 struct a {
    108   int i;
    109 };
    110 
    111 typedef a at;
    112 
    113 struct b {
    114 };
    115 
    116 typedef b bt;
    117 
    118 void func() {
    119   at a_inst;
    120   bt *b_ptr_inst;
    121   const bt *b_cnst_ptr_inst;
    122 }
    123 
    124 }
    125