blob: d8d75b7d0f0e7ee71bb5bcdff984e8c0b3f209f4 [file] [log] [blame]
Charles Davisee743f92010-11-09 18:04:24 +00001// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
Charles Davise60cea82010-06-11 03:07:32 +00002
Charles Davisb021f8b2010-06-14 05:29:01 +00003// CHECK: @"\01?a@@3HA"
4// CHECK: @"\01?b@N@@3HA"
Charles Davis570d2762010-06-12 08:11:16 +00005// CHECK: @c
Charles Davisb021f8b2010-06-14 05:29:01 +00006// CHECK: @"\01?d@foo@@0FB"
7// CHECK: @"\01?e@foo@@1JC"
8// CHECK: @"\01?f@foo@@2DD"
Charles Davisc62458f2010-06-18 07:51:00 +00009// CHECK: @"\01?g@bar@@2HA"
Charles Davis3a0d41d2010-06-26 03:50:05 +000010// CHECK: @"\01?h@@3QAHA"
Charles Davis08778262010-07-03 08:15:16 +000011// CHECK: @"\01?i@@3PAY0BE@HA"
Charles Davis1139da12010-07-03 05:53:41 +000012// CHECK: @"\01?j@@3P6GHCE@ZA"
Charles Daviscd712cb2010-07-03 08:01:32 +000013// CHECK: @"\01?k@@3PTfoo@@DA"
Charles Davisee743f92010-11-09 18:04:24 +000014// CHECK: @"\01?l@@3P8foo@@AEHH@ZA"
Charles Davis570d2762010-06-12 08:11:16 +000015
16int a;
Charles Davise60cea82010-06-11 03:07:32 +000017
18namespace N { int b; }
Charles Davis570d2762010-06-12 08:11:16 +000019
20static int c;
21int _c(void) {return c;}
Charles Davis65161d12010-06-16 05:33:16 +000022// CHECK: @"\01?_c@@YAHXZ"
Charles Davis570d2762010-06-12 08:11:16 +000023
Charles Davisb021f8b2010-06-14 05:29:01 +000024class foo {
25 static const short d;
26protected:
27 static volatile long e;
28public:
29 static const volatile char f;
Charles Davis21e2a7e2010-06-17 06:47:31 +000030 int operator+(int a);
Charles Davisb021f8b2010-06-14 05:29:01 +000031};
32
Charles Davisc62458f2010-06-18 07:51:00 +000033struct bar {
34 static int g;
35};
36
37union baz {
38 int a;
39 char b;
40 double c;
41};
42
43enum quux {
44 qone,
45 qtwo,
46 qthree
47};
48
Charles Davis21e2a7e2010-06-17 06:47:31 +000049int foo::operator+(int a) {return a;}
Charles Davisee743f92010-11-09 18:04:24 +000050// CHECK: @"\01??Hfoo@@QAEHH@Z"
Charles Davis21e2a7e2010-06-17 06:47:31 +000051
Charles Davisb021f8b2010-06-14 05:29:01 +000052const short foo::d = 0;
53volatile long foo::e;
54const volatile char foo::f = 'C';
55
Charles Davisc62458f2010-06-18 07:51:00 +000056int bar::g;
57
Charles Davis3a0d41d2010-06-26 03:50:05 +000058extern int * const h = &a;
59
Charles Davis0b8fe8c2010-06-30 08:09:57 +000060int i[10][20];
61
Charles Davis1139da12010-07-03 05:53:41 +000062int (__stdcall *j)(signed char, unsigned char);
63
Charles Daviscd712cb2010-07-03 08:01:32 +000064const volatile char foo::*k;
65
66int (foo::*l)(int);
67
Charles Davis65161d12010-06-16 05:33:16 +000068// Static functions are mangled, too.
69// Also make sure calling conventions, arglists, and throw specs work.
70static void __stdcall alpha(float a, double b) throw() {}
71bool __fastcall beta(long long a, wchar_t b) throw(signed char, unsigned char) {
Charles Davis3a0d41d2010-06-26 03:50:05 +000072// CHECK: @"\01?beta@@YI_N_J_W@Z"
Charles Davis65161d12010-06-16 05:33:16 +000073 alpha(0.f, 0.0);
74 return false;
75}
76
Charles Davis3a0d41d2010-06-26 03:50:05 +000077// CHECK: @"\01?alpha@@YGXMN@Z"
Charles Davis65161d12010-06-16 05:33:16 +000078
Charles Davisc62458f2010-06-18 07:51:00 +000079// Make sure tag-type mangling works.
80void gamma(class foo, struct bar, union baz, enum quux) {}
81// CHECK: @"\01?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z"
82
Charles Davis3a0d41d2010-06-26 03:50:05 +000083// Make sure pointer/reference-type mangling works.
84void delta(int * const a, const long &) {}
85// CHECK: @"\01?delta@@YAXQAHABJ@Z"
Charles Davis0b8fe8c2010-06-30 08:09:57 +000086
Charles Davis4d254832010-07-03 16:56:59 +000087// Array mangling.
Charles Davis0b8fe8c2010-06-30 08:09:57 +000088void epsilon(int a[][10][20]) {}
Charles Davis08778262010-07-03 08:15:16 +000089// CHECK: @"\01?epsilon@@YAXQAY19BE@H@Z"
Charles Davis4d254832010-07-03 16:56:59 +000090
91// Blocks mangling (Clang extension).
92void zeta(int (^)(int, int)) {}
93// CHECK: @"\01?zeta@@YAXP_EAHHH@Z@Z"
94