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 // CHECK: @"\01?color1@@3PANA" 16 // CHECK: @"\01?color2@@3PBNA" 17 // CHECK: @"\01?color3@@3PBY02NA" 18 19 int a; 20 21 namespace N { int b; } 22 23 static int c; 24 int _c(void) {return c;} 25 // CHECK: @"\01?_c@@YAHXZ" 26 27 class foo { 28 static const short d; 29 protected: 30 static volatile long e; 31 public: 32 static const volatile char f; 33 int operator+(int a); 34 foo(){} 35 //CHECK: @"\01??0foo@@QAE@XZ" 36 37 ~foo(){} 38 //CHECK: @"\01??1foo@@QAE@XZ" 39 40 foo(int i){} 41 //CHECK: @"\01??0foo@@QAE@H@Z" 42 43 foo(char *q){} 44 //CHECK: @"\01??0foo@@QAE@PAD@Z" 45 }f,s1(1),s2((char*)0); 46 47 typedef foo (foo2); 48 49 struct bar { 50 static int g; 51 }; 52 53 union baz { 54 int a; 55 char b; 56 double c; 57 }; 58 59 enum quux { 60 qone, 61 qtwo, 62 qthree 63 }; 64 65 int foo::operator+(int a) {return a;} 66 // CHECK: @"\01??Hfoo@@QAEHH@Z" 67 68 const short foo::d = 0; 69 volatile long foo::e; 70 const volatile char foo::f = 'C'; 71 72 int bar::g; 73 74 extern int * const h = &a; 75 76 int i[10][20]; 77 78 int (__stdcall *j)(signed char, unsigned char); 79 80 const volatile char foo2::*k; 81 82 int (foo2::*l)(int); 83 84 // Static functions are mangled, too. 85 // Also make sure calling conventions, arglists, and throw specs work. 86 static void __stdcall alpha(float a, double b) throw() {} 87 bool __fastcall beta(long long a, wchar_t b) throw(signed char, unsigned char) { 88 // CHECK: @"\01?beta@@YI_N_J_W@Z" 89 alpha(0.f, 0.0); 90 return false; 91 } 92 93 // CHECK: @"\01?alpha@@YGXMN@Z" 94 95 // Make sure tag-type mangling works. 96 void gamma(class foo, struct bar, union baz, enum quux) {} 97 // CHECK: @"\01?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z" 98 99 // Make sure pointer/reference-type mangling works. 100 void delta(int * const a, const long &) {} 101 // CHECK: @"\01?delta@@YAXQAHABJ@Z" 102 103 // Array mangling. 104 void epsilon(int a[][10][20]) {} 105 // CHECK: @"\01?epsilon@@YAXQAY19BE@H@Z" 106 107 // Blocks mangling (Clang extension). 108 void zeta(int (^)(int, int)) {} 109 // CHECK: @"\01?zeta@@YAXP_EAHHH@Z@Z" 110 111 void operator_new_delete() { 112 char *ptr = new char; 113 // CHECK: @"\01??2@YAPAXI@Z" 114 115 delete ptr; 116 // CHECK: @"\01??3@YAXPAX@Z" 117 118 char *array = new char[42]; 119 // CHECK: @"\01??_U@YAPAXI@Z" 120 121 delete [] array; 122 // CHECK: @"\01??_V@YAXPAX@Z" 123 } 124 125 // PR13022 126 void (redundant_parens)(); 127 void redundant_parens_use() { redundant_parens(); } 128 // CHECK: @"\01?redundant_parens@@YAXXZ" 129 130 // PR13047 131 typedef double RGB[3]; 132 RGB color1; 133 extern const RGB color2 = {}; 134 extern RGB const ((color3)[5]) = {}; 135