Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
      2 
      3 struct X {};
      4 
      5 // CHECK-LABEL: define void @_Z1f1XS_(
      6 void f(X, X) { }
      7 
      8 // CHECK-LABEL: define void @_Z1fR1XS0_(
      9 void f(X&, X&) { }
     10 
     11 // CHECK-LABEL: define void @_Z1fRK1XS1_(
     12 void f(const X&, const X&) { }
     13 
     14 typedef void T();
     15 struct S {};
     16 
     17 // CHECK-LABEL: define void @_Z1fPFvvEM1SFvvE(
     18 void f(T*, T (S::*)) {}
     19 
     20 namespace A {
     21   struct A { };
     22   struct B { };
     23 };
     24 
     25 // CHECK-LABEL: define void @_Z1fN1A1AENS_1BE(
     26 void f(A::A a, A::B b) { }
     27 
     28 struct C {
     29   struct D { };
     30 };
     31 
     32 // CHECK-LABEL: define void @_Z1fN1C1DERS_PS_S1_(
     33 void f(C::D, C&, C*, C&) { }
     34 
     35 template<typename T>
     36 struct V {
     37   typedef int U;
     38 };
     39 
     40 template <typename T> void f1(typename V<T>::U, V<T>) { }
     41 
     42 // CHECK: @_Z2f1IiEvN1VIT_E1UES2_
     43 template void f1<int>(int, V<int>);
     44 
     45 template <typename T> void f2(V<T>, typename V<T>::U) { }
     46 
     47 // CHECK: @_Z2f2IiEv1VIT_ENS2_1UE
     48 template void f2<int>(V<int>, int);
     49 
     50 namespace NS {
     51 template <typename T> struct S1 {};
     52 template<typename T> void ft3(S1<T>, S1<char>) {  }
     53 
     54 // CHECK: @_ZN2NS3ft3IiEEvNS_2S1IT_EENS1_IcEE
     55 template void ft3<int>(S1<int>, S1<char>);
     56 }
     57 
     58 // PR5196
     59 // CHECK: @_Z1fPKcS0_
     60 void f(const char*, const char*) {}
     61 
     62 namespace NS {
     63   class C;
     64 }
     65 
     66 namespace NS {
     67   // CHECK: @_ZN2NS1fERNS_1CE
     68   void f(C&) { }
     69 }
     70 
     71 namespace Test1 {
     72 
     73 struct A { };
     74 struct B { };
     75 
     76 // CHECK: @_ZN5Test11fEMNS_1BEFvvENS_1AES3_
     77 void f(void (B::*)(), A, A) { }
     78 
     79 // CHECK: @_ZN5Test11fEMNS_1BEFvvENS_1AES3_MS0_FvS3_EMS3_FvvE
     80 void f(void (B::*)(), A, A, void (B::*)(A), void (A::*)()) { }
     81 
     82 }
     83 
     84 namespace ManglePrefix {
     85 template <typename>
     86 struct X {
     87   template <typename>
     88   struct Y {
     89     typedef int type;
     90     typedef int type2;
     91   };
     92 };
     93 template <typename T>
     94 typename X<T>::template Y<T>::type f(typename X<T>::template Y<T>::type2) { return 0; }
     95 
     96 // CHECK: @_ZN12ManglePrefix1fIiEENS_1XIT_E1YIS2_E4typeENS5_5type2E
     97 template int f<int>(int);
     98 }
     99