mangle-ms.cpp revision 1139da148e44193a71585f418be96ef9c5f6defa
1// RUN: %clang_cc1 -fms-extensions -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-apple-darwin10 | 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@@3PAY0BD@HA" 12// CHECK: @"\01?j@@3P6GHCE@ZA" 13 14int a; 15 16namespace N { int b; } 17 18static int c; 19int _c(void) {return c;} 20// CHECK: @"\01?_c@@YAHXZ" 21 22class foo { 23 static const short d; 24protected: 25 static volatile long e; 26public: 27 static const volatile char f; 28 int operator+(int a); 29}; 30 31struct bar { 32 static int g; 33}; 34 35union baz { 36 int a; 37 char b; 38 double c; 39}; 40 41enum quux { 42 qone, 43 qtwo, 44 qthree 45}; 46 47// NOTE: The calling convention is supposed to be __thiscall by default, 48// but that needs to be fixed in Sema/AST. 49int foo::operator+(int a) {return a;} 50// CHECK: @"\01??Hfoo@@QAAHH@Z" 51 52const short foo::d = 0; 53volatile long foo::e; 54const volatile char foo::f = 'C'; 55 56int bar::g; 57 58extern int * const h = &a; 59 60int i[10][20]; 61 62int (__stdcall *j)(signed char, unsigned char); 63 64// Static functions are mangled, too. 65// Also make sure calling conventions, arglists, and throw specs work. 66static void __stdcall alpha(float a, double b) throw() {} 67bool __fastcall beta(long long a, wchar_t b) throw(signed char, unsigned char) { 68// CHECK: @"\01?beta@@YI_N_J_W@Z" 69 alpha(0.f, 0.0); 70 return false; 71} 72 73// CHECK: @"\01?alpha@@YGXMN@Z" 74 75// Make sure tag-type mangling works. 76void gamma(class foo, struct bar, union baz, enum quux) {} 77// CHECK: @"\01?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z" 78 79// Make sure pointer/reference-type mangling works. 80void delta(int * const a, const long &) {} 81// CHECK: @"\01?delta@@YAXQAHABJ@Z" 82 83// Array mangling. (It should be mangled as a const pointer, but that needs 84// to be fixed in Sema.) 85void epsilon(int a[][10][20]) {} 86// CHECK: @"\01?epsilon@@YAXQAY19BD@H@Z" 87