]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenCXX/mangle-ms.cpp
Vendor import of clang trunk r126079:
[FreeBSD/FreeBSD.git] / test / CodeGenCXX / mangle-ms.cpp
1 // RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
2
3 // CHECK: @"\01?a@@3HA"
4 // CHECK: @"\01?b@N@@3HA"
5 // CHECK: @c
6 // CHECK: @"\01?d@foo@@0FB"
7 // CHECK: @"\01?e@foo@@1JC"
8 // CHECK: @"\01?f@foo@@2DD"
9 // CHECK: @"\01?g@bar@@2HA"
10 // CHECK: @"\01?h@@3QAHA"
11 // CHECK: @"\01?i@@3PAY0BE@HA"
12 // CHECK: @"\01?j@@3P6GHCE@ZA"
13 // CHECK: @"\01?k@@3PTfoo@@DA"
14 // CHECK: @"\01?l@@3P8foo@@AEHH@ZA"
15
16 int a;
17
18 namespace N { int b; }
19
20 static int c;
21 int _c(void) {return c;}
22 // CHECK: @"\01?_c@@YAHXZ"
23
24 class foo {
25   static const short d;
26 protected:
27   static volatile long e;
28 public:
29   static const volatile char f;
30   int operator+(int a);
31 };
32
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
49 int foo::operator+(int a) {return a;}
50 // CHECK: @"\01??Hfoo@@QAEHH@Z"
51
52 const short foo::d = 0;
53 volatile long foo::e;
54 const volatile char foo::f = 'C';
55
56 int bar::g;
57
58 extern int * const h = &a;
59
60 int i[10][20];
61
62 int (__stdcall *j)(signed char, unsigned char);
63
64 const volatile char foo::*k;
65
66 int (foo::*l)(int);
67
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) {
72 // CHECK: @"\01?beta@@YI_N_J_W@Z"
73   alpha(0.f, 0.0);
74   return false;
75 }
76
77 // CHECK: @"\01?alpha@@YGXMN@Z"
78
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
83 // Make sure pointer/reference-type mangling works.
84 void delta(int * const a, const long &) {}
85 // CHECK: @"\01?delta@@YAXQAHABJ@Z"
86
87 // Array mangling.
88 void epsilon(int a[][10][20]) {}
89 // CHECK: @"\01?epsilon@@YAXQAY19BE@H@Z"
90
91 // Blocks mangling (Clang extension).
92 void zeta(int (^)(int, int)) {}
93 // CHECK: @"\01?zeta@@YAXP_EAHHH@Z@Z"
94