Charles Davis | ee743f9 | 2010-11-09 18:04:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s |
Charles Davis | e60cea8 | 2010-06-11 03:07:32 +0000 | [diff] [blame] | 2 | |
Charles Davis | b021f8b | 2010-06-14 05:29:01 +0000 | [diff] [blame] | 3 | // CHECK: @"\01?a@@3HA" |
| 4 | // CHECK: @"\01?b@N@@3HA" |
Charles Davis | 570d276 | 2010-06-12 08:11:16 +0000 | [diff] [blame] | 5 | // CHECK: @c |
Charles Davis | b021f8b | 2010-06-14 05:29:01 +0000 | [diff] [blame] | 6 | // CHECK: @"\01?d@foo@@0FB" |
| 7 | // CHECK: @"\01?e@foo@@1JC" |
| 8 | // CHECK: @"\01?f@foo@@2DD" |
Charles Davis | c62458f | 2010-06-18 07:51:00 +0000 | [diff] [blame] | 9 | // CHECK: @"\01?g@bar@@2HA" |
Charles Davis | 3a0d41d | 2010-06-26 03:50:05 +0000 | [diff] [blame] | 10 | // CHECK: @"\01?h@@3QAHA" |
Charles Davis | 0877826 | 2010-07-03 08:15:16 +0000 | [diff] [blame] | 11 | // CHECK: @"\01?i@@3PAY0BE@HA" |
Charles Davis | 1139da1 | 2010-07-03 05:53:41 +0000 | [diff] [blame] | 12 | // CHECK: @"\01?j@@3P6GHCE@ZA" |
Charles Davis | cd712cb | 2010-07-03 08:01:32 +0000 | [diff] [blame] | 13 | // CHECK: @"\01?k@@3PTfoo@@DA" |
Charles Davis | ee743f9 | 2010-11-09 18:04:24 +0000 | [diff] [blame] | 14 | // CHECK: @"\01?l@@3P8foo@@AEHH@ZA" |
Charles Davis | 570d276 | 2010-06-12 08:11:16 +0000 | [diff] [blame] | 15 | |
| 16 | int a; |
Charles Davis | e60cea8 | 2010-06-11 03:07:32 +0000 | [diff] [blame] | 17 | |
| 18 | namespace N { int b; } |
Charles Davis | 570d276 | 2010-06-12 08:11:16 +0000 | [diff] [blame] | 19 | |
| 20 | static int c; |
| 21 | int _c(void) {return c;} |
Charles Davis | 65161d1 | 2010-06-16 05:33:16 +0000 | [diff] [blame] | 22 | // CHECK: @"\01?_c@@YAHXZ" |
Charles Davis | 570d276 | 2010-06-12 08:11:16 +0000 | [diff] [blame] | 23 | |
Charles Davis | b021f8b | 2010-06-14 05:29:01 +0000 | [diff] [blame] | 24 | class foo { |
| 25 | static const short d; |
| 26 | protected: |
| 27 | static volatile long e; |
| 28 | public: |
| 29 | static const volatile char f; |
Charles Davis | 21e2a7e | 2010-06-17 06:47:31 +0000 | [diff] [blame] | 30 | int operator+(int a); |
Charles Davis | b021f8b | 2010-06-14 05:29:01 +0000 | [diff] [blame] | 31 | }; |
| 32 | |
Charles Davis | c62458f | 2010-06-18 07:51:00 +0000 | [diff] [blame] | 33 | struct bar { |
| 34 | static int g; |
| 35 | }; |
| 36 | |
| 37 | union baz { |
| 38 | int a; |
| 39 | char b; |
| 40 | double c; |
| 41 | }; |
| 42 | |
| 43 | enum quux { |
| 44 | qone, |
| 45 | qtwo, |
| 46 | qthree |
| 47 | }; |
| 48 | |
Charles Davis | 21e2a7e | 2010-06-17 06:47:31 +0000 | [diff] [blame] | 49 | int foo::operator+(int a) {return a;} |
Charles Davis | ee743f9 | 2010-11-09 18:04:24 +0000 | [diff] [blame] | 50 | // CHECK: @"\01??Hfoo@@QAEHH@Z" |
Charles Davis | 21e2a7e | 2010-06-17 06:47:31 +0000 | [diff] [blame] | 51 | |
Charles Davis | b021f8b | 2010-06-14 05:29:01 +0000 | [diff] [blame] | 52 | const short foo::d = 0; |
| 53 | volatile long foo::e; |
| 54 | const volatile char foo::f = 'C'; |
| 55 | |
Charles Davis | c62458f | 2010-06-18 07:51:00 +0000 | [diff] [blame] | 56 | int bar::g; |
| 57 | |
Charles Davis | 3a0d41d | 2010-06-26 03:50:05 +0000 | [diff] [blame] | 58 | extern int * const h = &a; |
| 59 | |
Charles Davis | 0b8fe8c | 2010-06-30 08:09:57 +0000 | [diff] [blame] | 60 | int i[10][20]; |
| 61 | |
Charles Davis | 1139da1 | 2010-07-03 05:53:41 +0000 | [diff] [blame] | 62 | int (__stdcall *j)(signed char, unsigned char); |
| 63 | |
Charles Davis | cd712cb | 2010-07-03 08:01:32 +0000 | [diff] [blame] | 64 | const volatile char foo::*k; |
| 65 | |
| 66 | int (foo::*l)(int); |
| 67 | |
Charles Davis | 65161d1 | 2010-06-16 05:33:16 +0000 | [diff] [blame] | 68 | // Static functions are mangled, too. |
| 69 | // Also make sure calling conventions, arglists, and throw specs work. |
| 70 | static void __stdcall alpha(float a, double b) throw() {} |
| 71 | bool __fastcall beta(long long a, wchar_t b) throw(signed char, unsigned char) { |
Charles Davis | 3a0d41d | 2010-06-26 03:50:05 +0000 | [diff] [blame] | 72 | // CHECK: @"\01?beta@@YI_N_J_W@Z" |
Charles Davis | 65161d1 | 2010-06-16 05:33:16 +0000 | [diff] [blame] | 73 | alpha(0.f, 0.0); |
| 74 | return false; |
| 75 | } |
| 76 | |
Charles Davis | 3a0d41d | 2010-06-26 03:50:05 +0000 | [diff] [blame] | 77 | // CHECK: @"\01?alpha@@YGXMN@Z" |
Charles Davis | 65161d1 | 2010-06-16 05:33:16 +0000 | [diff] [blame] | 78 | |
Charles Davis | c62458f | 2010-06-18 07:51:00 +0000 | [diff] [blame] | 79 | // Make sure tag-type mangling works. |
| 80 | void gamma(class foo, struct bar, union baz, enum quux) {} |
| 81 | // CHECK: @"\01?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z" |
| 82 | |
Charles Davis | 3a0d41d | 2010-06-26 03:50:05 +0000 | [diff] [blame] | 83 | // Make sure pointer/reference-type mangling works. |
| 84 | void delta(int * const a, const long &) {} |
| 85 | // CHECK: @"\01?delta@@YAXQAHABJ@Z" |
Charles Davis | 0b8fe8c | 2010-06-30 08:09:57 +0000 | [diff] [blame] | 86 | |
Charles Davis | 4d25483 | 2010-07-03 16:56:59 +0000 | [diff] [blame] | 87 | // Array mangling. |
Charles Davis | 0b8fe8c | 2010-06-30 08:09:57 +0000 | [diff] [blame] | 88 | void epsilon(int a[][10][20]) {} |
Charles Davis | 0877826 | 2010-07-03 08:15:16 +0000 | [diff] [blame] | 89 | // CHECK: @"\01?epsilon@@YAXQAY19BE@H@Z" |
Charles Davis | 4d25483 | 2010-07-03 16:56:59 +0000 | [diff] [blame] | 90 | |
| 91 | // Blocks mangling (Clang extension). |
| 92 | void zeta(int (^)(int, int)) {} |
| 93 | // CHECK: @"\01?zeta@@YAXP_EAHHH@Z@Z" |
| 94 | |