1 // RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 &&
2 
3 // FIXME: This test is intentionally trivial, because we can't yet
4 // CodeGen anything real in C++.
5 struct X { };
6 struct Y { };
7 
8 // RUN: grep _ZplRK1YRA100_P1X %t | count 1 &&
9 bool operator+(const Y&, X* (&xs)[100]) { return false; }
10 
11 // RUN: grep _Z1f1s %t | count 1 &&
12 typedef struct { int a; } s;
13 void f(s) { }
14 
15 // RUN: grep _Z1f1e %t| count 1 &&
16 typedef enum { foo } e;
17 void f(e) { }
18 
19 // RUN: grep _Z1f1u %t | count 1 &&
20 typedef union { int a; } u;
21 void f(u) { }
22 
23 // RUN: grep _Z1f1x %t | count 1 &&
24 typedef struct { int a; } x,y;
25 void f(y) { }
26 
27 // RUN: grep _Z1fv %t | count 1 &&
28 void f() { }
29 
30 // RUN: grep _ZN1N1fEv %t | count 1 &&
31 namespace N { void f() { } }
32 
33 // RUN: grep _ZN1N1N1fEv %t | count 1 &&
34 namespace N { namespace N { void f() { } } }
35 
36 // RUN: grep unmangled_function %t | count 1 &&
37 extern "C" { namespace N { void unmangled_function() { } } }
38 
39 // RUN: grep unmangled_variable %t | count 1 &&
40 extern "C" { namespace N { int unmangled_variable = 10; } }
41 
42 // RUN: grep _ZN1N1iE %t | count 1 &&
43 namespace N { int i; }
44 
45 // RUN: grep _ZZN1N1fEiiE1b %t | count 2 &&
46 namespace N { int f(int, int) { static int b; return b; } }
47 
48 // RUN: grep "_ZZN1N1gEvE1a =" %t | count 1 &&
49 // RUN: grep "_ZGVZN1N1gEvE1a =" %t | count 1 &&
50 namespace N { int h(); void g() { static int a = h(); } }
51 
52 // RUN: grep "_Z1fno" %t | count 1 &&
53 void f(__int128_t, __uint128_t) { }
54 
55 template <typename T> struct S1 {};
56 
57 // RUN: grep "_Z1f2S1IiE" %t | count 1 &&
58 void f(S1<int>) {}
59 
60 // RUN: grep "_Z1f2S1IdE" %t | count 1 &&
61 void f(S1<double>) {}
62 
63 template <int N> struct S2 {};
64 // RUN: grep "_Z1f2S2ILi100EE" %t | count 1 &&
65 void f(S2<100>) {}
66 
67 // RUN: grep "_Z1f2S2ILin100EE" %t | count 1 &&
68 void f(S2<-100>) {}
69 
70 template <bool B> struct S3 {};
71 
72 // RUN: grep "_Z1f2S3ILb1EE" %t | count 1 &&
73 void f(S3<true>) {}
74 
75 // RUN: grep "_Z1f2S3ILb0EE" %t | count 1 &&
76 void f(S3<false>) {}
77 
78 // RUN: grep "_Z2f22S3ILb1EE" %t | count 1 &&
79 void f2(S3<100>) {}
80 
81 struct S;
82 
83 // RUN: grep "_Z1fM1SKFvvE" %t | count 1 &&
84 void f(void (S::*)() const) {}
85 
86 // RUN: grep "_Z1fM1SFvvE" %t | count 1
87 void f(void (S::*)()) {}
88