xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/mangle-subst.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct X {};
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z1f1XS_(
f(X,X)6*f4a2713aSLionel Sambuc void f(X, X) { }
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z1fR1XS0_(
f(X &,X &)9*f4a2713aSLionel Sambuc void f(X&, X&) { }
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z1fRK1XS1_(
f(const X &,const X &)12*f4a2713aSLionel Sambuc void f(const X&, const X&) { }
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc typedef void T();
15*f4a2713aSLionel Sambuc struct S {};
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z1fPFvvEM1SFvvE(
f(T *,T (S::*))18*f4a2713aSLionel Sambuc void f(T*, T (S::*)) {}
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc namespace A {
21*f4a2713aSLionel Sambuc   struct A { };
22*f4a2713aSLionel Sambuc   struct B { };
23*f4a2713aSLionel Sambuc };
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z1fN1A1AENS_1BE(
f(A::A a,A::B b)26*f4a2713aSLionel Sambuc void f(A::A a, A::B b) { }
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc struct C {
29*f4a2713aSLionel Sambuc   struct D { };
30*f4a2713aSLionel Sambuc };
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z1fN1C1DERS_PS_S1_(
f(C::D,C &,C *,C &)33*f4a2713aSLionel Sambuc void f(C::D, C&, C*, C&) { }
34*f4a2713aSLionel Sambuc 
35*f4a2713aSLionel Sambuc template<typename T>
36*f4a2713aSLionel Sambuc struct V {
37*f4a2713aSLionel Sambuc   typedef int U;
38*f4a2713aSLionel Sambuc };
39*f4a2713aSLionel Sambuc 
f1(typename V<T>::U,V<T>)40*f4a2713aSLionel Sambuc template <typename T> void f1(typename V<T>::U, V<T>) { }
41*f4a2713aSLionel Sambuc 
42*f4a2713aSLionel Sambuc // CHECK: @_Z2f1IiEvN1VIT_E1UES2_
43*f4a2713aSLionel Sambuc template void f1<int>(int, V<int>);
44*f4a2713aSLionel Sambuc 
f2(V<T>,typename V<T>::U)45*f4a2713aSLionel Sambuc template <typename T> void f2(V<T>, typename V<T>::U) { }
46*f4a2713aSLionel Sambuc 
47*f4a2713aSLionel Sambuc // CHECK: @_Z2f2IiEv1VIT_ENS2_1UE
48*f4a2713aSLionel Sambuc template void f2<int>(V<int>, int);
49*f4a2713aSLionel Sambuc 
50*f4a2713aSLionel Sambuc namespace NS {
51*f4a2713aSLionel Sambuc template <typename T> struct S1 {};
ft3(S1<T>,S1<char>)52*f4a2713aSLionel Sambuc template<typename T> void ft3(S1<T>, S1<char>) {  }
53*f4a2713aSLionel Sambuc 
54*f4a2713aSLionel Sambuc // CHECK: @_ZN2NS3ft3IiEEvNS_2S1IT_EENS1_IcEE
55*f4a2713aSLionel Sambuc template void ft3<int>(S1<int>, S1<char>);
56*f4a2713aSLionel Sambuc }
57*f4a2713aSLionel Sambuc 
58*f4a2713aSLionel Sambuc // PR5196
59*f4a2713aSLionel Sambuc // CHECK: @_Z1fPKcS0_
f(const char *,const char *)60*f4a2713aSLionel Sambuc void f(const char*, const char*) {}
61*f4a2713aSLionel Sambuc 
62*f4a2713aSLionel Sambuc namespace NS {
63*f4a2713aSLionel Sambuc   class C;
64*f4a2713aSLionel Sambuc }
65*f4a2713aSLionel Sambuc 
66*f4a2713aSLionel Sambuc namespace NS {
67*f4a2713aSLionel Sambuc   // CHECK: @_ZN2NS1fERNS_1CE
f(C &)68*f4a2713aSLionel Sambuc   void f(C&) { }
69*f4a2713aSLionel Sambuc }
70*f4a2713aSLionel Sambuc 
71*f4a2713aSLionel Sambuc namespace Test1 {
72*f4a2713aSLionel Sambuc 
73*f4a2713aSLionel Sambuc struct A { };
74*f4a2713aSLionel Sambuc struct B { };
75*f4a2713aSLionel Sambuc 
76*f4a2713aSLionel Sambuc // CHECK: @_ZN5Test11fEMNS_1BEFvvENS_1AES3_
f(void (B::*)(),A,A)77*f4a2713aSLionel Sambuc void f(void (B::*)(), A, A) { }
78*f4a2713aSLionel Sambuc 
79*f4a2713aSLionel Sambuc // CHECK: @_ZN5Test11fEMNS_1BEFvvENS_1AES3_MS0_FvS3_EMS3_FvvE
f(void (B::*)(),A,A,void (B::*)(A),void (A::*)())80*f4a2713aSLionel Sambuc void f(void (B::*)(), A, A, void (B::*)(A), void (A::*)()) { }
81*f4a2713aSLionel Sambuc 
82*f4a2713aSLionel Sambuc }
83