Chris Lattner | 4d150c8 | 2009-04-30 06:18:40 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 && |
Douglas Gregor | 5f2bfd4 | 2009-02-13 00:10:09 +0000 | [diff] [blame] | 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 { }; |
Anders Carlsson | b1d947b | 2009-03-07 23:57:03 +0000 | [diff] [blame] | 7 | |
| 8 | // RUN: grep _ZplRK1YRA100_P1X %t | count 1 && |
Douglas Gregor | 5f2bfd4 | 2009-02-13 00:10:09 +0000 | [diff] [blame] | 9 | bool operator+(const Y&, X* (&xs)[100]) { return false; } |
| 10 | |
Anders Carlsson | b1d947b | 2009-03-07 23:57:03 +0000 | [diff] [blame] | 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 | |
Anders Carlsson | 4843e58 | 2009-03-10 17:07:44 +0000 | [diff] [blame] | 19 | // RUN: grep _Z1f1u %t | count 1 && |
Anders Carlsson | b1d947b | 2009-03-07 23:57:03 +0000 | [diff] [blame] | 20 | typedef union { int a; } u; |
| 21 | void f(u) { } |
Anders Carlsson | 4843e58 | 2009-03-10 17:07:44 +0000 | [diff] [blame] | 22 | |
Anders Carlsson | 91e20dd | 2009-04-02 05:55:18 +0000 | [diff] [blame] | 23 | // RUN: grep _Z1f1x %t | count 1 && |
Anders Carlsson | 4843e58 | 2009-03-10 17:07:44 +0000 | [diff] [blame] | 24 | typedef struct { int a; } x,y; |
| 25 | void f(y) { } |
| 26 | |
Anders Carlsson | 91e20dd | 2009-04-02 05:55:18 +0000 | [diff] [blame] | 27 | // RUN: grep _Z1fv %t | count 1 && |
Anders Carlsson | c6c91bc | 2009-04-01 00:15:23 +0000 | [diff] [blame] | 28 | void f() { } |
Anders Carlsson | 984e068 | 2009-04-01 00:58:25 +0000 | [diff] [blame] | 29 | |
Anders Carlsson | 91e20dd | 2009-04-02 05:55:18 +0000 | [diff] [blame] | 30 | // RUN: grep _ZN1N1fEv %t | count 1 && |
Anders Carlsson | 984e068 | 2009-04-01 00:58:25 +0000 | [diff] [blame] | 31 | namespace N { void f() { } } |
| 32 | |
Anders Carlsson | 91e20dd | 2009-04-02 05:55:18 +0000 | [diff] [blame] | 33 | // RUN: grep _ZN1N1N1fEv %t | count 1 && |
Anders Carlsson | 984e068 | 2009-04-01 00:58:25 +0000 | [diff] [blame] | 34 | namespace N { namespace N { void f() { } } } |
Anders Carlsson | 91e20dd | 2009-04-02 05:55:18 +0000 | [diff] [blame] | 35 | |
| 36 | // RUN: grep unmangled_function %t | count 1 && |
| 37 | extern "C" { namespace N { void unmangled_function() { } } } |
| 38 | |
Anders Carlsson | 329749c | 2009-04-02 16:05:20 +0000 | [diff] [blame] | 39 | // RUN: grep unmangled_variable %t | count 1 && |
Anders Carlsson | 91e20dd | 2009-04-02 05:55:18 +0000 | [diff] [blame] | 40 | extern "C" { namespace N { int unmangled_variable; } } |
| 41 | |
Anders Carlsson | 1b42c79 | 2009-04-02 16:24:45 +0000 | [diff] [blame] | 42 | // RUN: grep _ZN1N1iE %t | count 1 && |
Anders Carlsson | 329749c | 2009-04-02 16:05:20 +0000 | [diff] [blame] | 43 | namespace N { int i; } |
Anders Carlsson | 1b42c79 | 2009-04-02 16:24:45 +0000 | [diff] [blame] | 44 | |
Anders Carlsson | 283a062 | 2009-04-13 18:03:33 +0000 | [diff] [blame] | 45 | // RUN: grep _ZZN1N1fEiiE1b %t | count 2 && |
Anders Carlsson | 1b42c79 | 2009-04-02 16:24:45 +0000 | [diff] [blame] | 46 | namespace N { int f(int, int) { static int b; return b; } } |
Anders Carlsson | 283a062 | 2009-04-13 18:03:33 +0000 | [diff] [blame] | 47 | |
| 48 | // RUN: grep "_ZZN1N1gEvE1a =" %t | count 1 && |
Chris Lattner | 2df9ced | 2009-04-30 02:43:43 +0000 | [diff] [blame] | 49 | // RUN: grep "_ZGVZN1N1gEvE1a =" %t | count 1 && |
Anders Carlsson | 283a062 | 2009-04-13 18:03:33 +0000 | [diff] [blame] | 50 | namespace N { int h(); void g() { static int a = h(); } } |
Chris Lattner | 2df9ced | 2009-04-30 02:43:43 +0000 | [diff] [blame] | 51 | |
Anders Carlsson | 7a0ba87 | 2009-05-15 16:09:15 +0000 | [diff] [blame^] | 52 | // RUN: grep "_Z1fno" %t | count 1 && |
Chris Lattner | 2df9ced | 2009-04-30 02:43:43 +0000 | [diff] [blame] | 53 | void f(__int128_t, __uint128_t) { } |
Anders Carlsson | 7a0ba87 | 2009-05-15 16:09:15 +0000 | [diff] [blame^] | 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>) {} |