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 foo(){} 32 //CHECK: @"\01??0foo@@QAE@XZ" 33 34 ~foo(){} 35 //CHECK: @"\01??1foo@@QAE@XZ" 36 37 foo(int i){} 38 //CHECK: @"\01??0foo@@QAE@H@Z" 39 40 foo(char *q){} 41 //CHECK: @"\01??0foo@@QAE@PAD@Z" 42 }f,s1(1),s2((char*)0); 43 44 struct bar { 45 static int g; 46 }; 47 48 union baz { 49 int a; 50 char b; 51 double c; 52 }; 53 54 enum quux { 55 qone, 56 qtwo, 57 qthree 58 }; 59 60 int foo::operator+(int a) {return a;} 61 // CHECK: @"\01??Hfoo@@QAEHH@Z" 62 63 const short foo::d = 0; 64 volatile long foo::e; 65 const volatile char foo::f = 'C'; 66 67 int bar::g; 68 69 extern int * const h = &a; 70 71 int i[10][20]; 72 73 int (__stdcall *j)(signed char, unsigned char); 74 75 const volatile char foo::*k; 76 77 int (foo::*l)(int); 78 79 // Static functions are mangled, too. 80 // Also make sure calling conventions, arglists, and throw specs work. 81 static void __stdcall alpha(float a, double b) throw() {} 82 bool __fastcall beta(long long a, wchar_t b) throw(signed char, unsigned char) { 83 // CHECK: @"\01?beta@@YI_N_J_W@Z" 84 alpha(0.f, 0.0); 85 return false; 86 } 87 88 // CHECK: @"\01?alpha@@YGXMN@Z" 89 90 // Make sure tag-type mangling works. 91 void gamma(class foo, struct bar, union baz, enum quux) {} 92 // CHECK: @"\01?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z" 93 94 // Make sure pointer/reference-type mangling works. 95 void delta(int * const a, const long &) {} 96 // CHECK: @"\01?delta@@YAXQAHABJ@Z" 97 98 // Array mangling. 99 void epsilon(int a[][10][20]) {} 100 // CHECK: @"\01?epsilon@@YAXQAY19BE@H@Z" 101 102 // Blocks mangling (Clang extension). 103 void zeta(int (^)(int, int)) {} 104 // CHECK: @"\01?zeta@@YAXP_EAHHH@Z@Z" 105 106