2013-05-15 04:30:42 +08:00
|
|
|
// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
|
2010-06-11 11:07:32 +08:00
|
|
|
|
2010-06-14 13:29:01 +08:00
|
|
|
// CHECK: @"\01?a@@3HA"
|
|
|
|
// CHECK: @"\01?b@N@@3HA"
|
2012-11-26 16:55:48 +08:00
|
|
|
// CHECK: @"\01?anonymous@?A@N@@3HA"
|
2010-06-12 16:11:16 +08:00
|
|
|
// CHECK: @c
|
2010-06-14 13:29:01 +08:00
|
|
|
// CHECK: @"\01?d@foo@@0FB"
|
|
|
|
// CHECK: @"\01?e@foo@@1JC"
|
|
|
|
// CHECK: @"\01?f@foo@@2DD"
|
2010-06-18 15:51:00 +08:00
|
|
|
// CHECK: @"\01?g@bar@@2HA"
|
2012-09-03 17:08:10 +08:00
|
|
|
// CHECK: @"\01?h1@@3QAHA"
|
|
|
|
// CHECK: @"\01?h2@@3QBHB"
|
2010-07-03 16:15:16 +08:00
|
|
|
// CHECK: @"\01?i@@3PAY0BE@HA"
|
2010-07-03 13:53:41 +08:00
|
|
|
// CHECK: @"\01?j@@3P6GHCE@ZA"
|
2013-08-06 06:43:06 +08:00
|
|
|
// CHECK: @"\01?k@@3PTfoo@@DQ1@"
|
|
|
|
// CHECK: @"\01?l@@3P8foo@@AEHH@ZQ1@"
|
2012-06-08 08:37:04 +08:00
|
|
|
// CHECK: @"\01?color1@@3PANA"
|
2012-09-03 17:08:10 +08:00
|
|
|
// CHECK: @"\01?color2@@3QBNB"
|
2013-04-25 12:25:40 +08:00
|
|
|
// CHECK: @"\01?color3@@3QAY02$$CBNA"
|
|
|
|
// CHECK: @"\01?color4@@3QAY02$$CBNA"
|
2010-06-12 16:11:16 +08:00
|
|
|
|
|
|
|
int a;
|
2010-06-11 11:07:32 +08:00
|
|
|
|
2012-11-26 16:55:48 +08:00
|
|
|
namespace N {
|
|
|
|
int b;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
int anonymous;
|
|
|
|
}
|
|
|
|
}
|
2010-06-12 16:11:16 +08:00
|
|
|
|
|
|
|
static int c;
|
2012-11-26 16:55:48 +08:00
|
|
|
int _c(void) {return N::anonymous + c;}
|
2010-06-16 13:33:16 +08:00
|
|
|
// CHECK: @"\01?_c@@YAHXZ"
|
2013-05-15 04:30:42 +08:00
|
|
|
// X64: @"\01?_c@@YAHXZ"
|
2010-06-12 16:11:16 +08:00
|
|
|
|
2010-06-14 13:29:01 +08:00
|
|
|
class foo {
|
|
|
|
static const short d;
|
|
|
|
protected:
|
|
|
|
static volatile long e;
|
|
|
|
public:
|
|
|
|
static const volatile char f;
|
2010-06-17 14:47:31 +08:00
|
|
|
int operator+(int a);
|
2011-12-01 17:55:00 +08:00
|
|
|
foo(){}
|
|
|
|
//CHECK: @"\01??0foo@@QAE@XZ"
|
2013-05-15 04:30:42 +08:00
|
|
|
//X64: @"\01??0foo@@QEAA@XZ"
|
2011-12-01 17:55:00 +08:00
|
|
|
|
|
|
|
~foo(){}
|
|
|
|
//CHECK: @"\01??1foo@@QAE@XZ"
|
2013-05-15 04:30:42 +08:00
|
|
|
//X64: @"\01??1foo@@QEAA@XZ
|
2011-12-01 17:55:00 +08:00
|
|
|
|
|
|
|
foo(int i){}
|
|
|
|
//CHECK: @"\01??0foo@@QAE@H@Z"
|
2013-05-15 04:30:42 +08:00
|
|
|
//X64: @"\01??0foo@@QEAA@H@Z"
|
2011-12-01 17:55:00 +08:00
|
|
|
|
|
|
|
foo(char *q){}
|
|
|
|
//CHECK: @"\01??0foo@@QAE@PAD@Z"
|
2013-05-15 04:30:42 +08:00
|
|
|
//X64: @"\01??0foo@@QEAA@PEAD@Z"
|
2012-06-27 09:38:25 +08:00
|
|
|
|
|
|
|
static foo* static_method() { return 0; }
|
|
|
|
|
2011-12-01 17:55:00 +08:00
|
|
|
}f,s1(1),s2((char*)0);
|
2010-06-14 13:29:01 +08:00
|
|
|
|
2012-06-08 08:37:04 +08:00
|
|
|
typedef foo (foo2);
|
|
|
|
|
2010-06-18 15:51:00 +08:00
|
|
|
struct bar {
|
|
|
|
static int g;
|
|
|
|
};
|
|
|
|
|
|
|
|
union baz {
|
|
|
|
int a;
|
|
|
|
char b;
|
|
|
|
double c;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum quux {
|
|
|
|
qone,
|
|
|
|
qtwo,
|
|
|
|
qthree
|
|
|
|
};
|
|
|
|
|
2012-06-27 09:38:25 +08:00
|
|
|
foo bar() { return foo(); }
|
|
|
|
//CHECK: @"\01?bar@@YA?AVfoo@@XZ"
|
2013-05-15 04:30:42 +08:00
|
|
|
//X64: @"\01?bar@@YA?AVfoo@@XZ"
|
2012-06-27 09:38:25 +08:00
|
|
|
|
|
|
|
int foo::operator+(int a) {
|
|
|
|
//CHECK: @"\01??Hfoo@@QAEHH@Z"
|
2013-05-15 04:30:42 +08:00
|
|
|
//X64: @"\01??Hfoo@@QEAAHH@Z"
|
2012-06-27 09:38:25 +08:00
|
|
|
|
|
|
|
foo::static_method();
|
|
|
|
//CHECK: @"\01?static_method@foo@@SAPAV1@XZ"
|
2013-05-15 04:30:42 +08:00
|
|
|
//X64: @"\01?static_method@foo@@SAPEAV1@XZ"
|
2012-06-27 09:38:25 +08:00
|
|
|
bar();
|
|
|
|
return a;
|
|
|
|
}
|
2010-06-17 14:47:31 +08:00
|
|
|
|
2010-06-14 13:29:01 +08:00
|
|
|
const short foo::d = 0;
|
|
|
|
volatile long foo::e;
|
|
|
|
const volatile char foo::f = 'C';
|
|
|
|
|
2010-06-18 15:51:00 +08:00
|
|
|
int bar::g;
|
|
|
|
|
2012-09-03 17:08:10 +08:00
|
|
|
extern int * const h1 = &a;
|
|
|
|
extern const int * const h2 = &a;
|
2010-06-26 11:50:05 +08:00
|
|
|
|
2010-06-30 16:09:57 +08:00
|
|
|
int i[10][20];
|
|
|
|
|
2010-07-03 13:53:41 +08:00
|
|
|
int (__stdcall *j)(signed char, unsigned char);
|
|
|
|
|
2012-06-08 08:37:04 +08:00
|
|
|
const volatile char foo2::*k;
|
2010-07-03 16:01:32 +08:00
|
|
|
|
2012-06-08 08:37:04 +08:00
|
|
|
int (foo2::*l)(int);
|
2010-07-03 16:01:32 +08:00
|
|
|
|
2010-06-16 13:33:16 +08:00
|
|
|
// Static functions are mangled, too.
|
|
|
|
// Also make sure calling conventions, arglists, and throw specs work.
|
|
|
|
static void __stdcall alpha(float a, double b) throw() {}
|
|
|
|
bool __fastcall beta(long long a, wchar_t b) throw(signed char, unsigned char) {
|
2010-06-26 11:50:05 +08:00
|
|
|
// CHECK: @"\01?beta@@YI_N_J_W@Z"
|
2013-05-15 04:30:42 +08:00
|
|
|
// X64: @"\01?beta@@YA_N_J_W@Z"
|
2010-06-16 13:33:16 +08:00
|
|
|
alpha(0.f, 0.0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-06-26 11:50:05 +08:00
|
|
|
// CHECK: @"\01?alpha@@YGXMN@Z"
|
2012-10-02 22:26:08 +08:00
|
|
|
// X64: @"\01?alpha@@YAXMN@Z"
|
2010-06-16 13:33:16 +08:00
|
|
|
|
2010-06-18 15:51:00 +08:00
|
|
|
// Make sure tag-type mangling works.
|
|
|
|
void gamma(class foo, struct bar, union baz, enum quux) {}
|
|
|
|
// CHECK: @"\01?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z"
|
2013-05-15 04:30:42 +08:00
|
|
|
// X64: @"\01?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z"
|
2010-06-18 15:51:00 +08:00
|
|
|
|
2010-06-26 11:50:05 +08:00
|
|
|
// Make sure pointer/reference-type mangling works.
|
|
|
|
void delta(int * const a, const long &) {}
|
|
|
|
// CHECK: @"\01?delta@@YAXQAHABJ@Z"
|
2013-05-15 04:30:42 +08:00
|
|
|
// X64: @"\01?delta@@YAXQEAHAEBJ@Z"
|
2010-06-30 16:09:57 +08:00
|
|
|
|
2010-07-04 00:56:59 +08:00
|
|
|
// Array mangling.
|
2010-06-30 16:09:57 +08:00
|
|
|
void epsilon(int a[][10][20]) {}
|
2010-07-03 16:15:16 +08:00
|
|
|
// CHECK: @"\01?epsilon@@YAXQAY19BE@H@Z"
|
2013-05-15 04:30:42 +08:00
|
|
|
// X64: @"\01?epsilon@@YAXQEAY19BE@H@Z"
|
2010-07-04 00:56:59 +08:00
|
|
|
|
2012-07-26 21:41:30 +08:00
|
|
|
void zeta(int (*)(int, int)) {}
|
|
|
|
// CHECK: @"\01?zeta@@YAXP6AHHH@Z@Z"
|
2013-05-15 04:30:42 +08:00
|
|
|
// X64: @"\01?zeta@@YAXP6AHHH@Z@Z"
|
2012-07-26 21:41:30 +08:00
|
|
|
|
|
|
|
// Blocks mangling (Clang extension). A block should be mangled slightly
|
|
|
|
// differently from a similar function pointer.
|
|
|
|
void eta(int (^)(int, int)) {}
|
|
|
|
// CHECK: @"\01?eta@@YAXP_EAHHH@Z@Z"
|
2010-07-04 00:56:59 +08:00
|
|
|
|
2012-08-25 09:12:56 +08:00
|
|
|
typedef int theta_arg(int,int);
|
|
|
|
void theta(theta_arg^ block) {}
|
|
|
|
// CHECK: @"\01?theta@@YAXP_EAHHH@Z@Z"
|
|
|
|
|
2012-05-01 10:33:44 +08:00
|
|
|
void operator_new_delete() {
|
|
|
|
char *ptr = new char;
|
|
|
|
// CHECK: @"\01??2@YAPAXI@Z"
|
|
|
|
|
|
|
|
delete ptr;
|
|
|
|
// CHECK: @"\01??3@YAXPAX@Z"
|
|
|
|
|
|
|
|
char *array = new char[42];
|
|
|
|
// CHECK: @"\01??_U@YAPAXI@Z"
|
|
|
|
|
2012-05-01 13:23:51 +08:00
|
|
|
delete [] array;
|
|
|
|
// CHECK: @"\01??_V@YAXPAX@Z"
|
2012-05-01 10:33:44 +08:00
|
|
|
}
|
2012-06-05 06:46:59 +08:00
|
|
|
|
|
|
|
// PR13022
|
|
|
|
void (redundant_parens)();
|
|
|
|
void redundant_parens_use() { redundant_parens(); }
|
|
|
|
// CHECK: @"\01?redundant_parens@@YAXXZ"
|
2013-05-15 04:30:42 +08:00
|
|
|
// X64: @"\01?redundant_parens@@YAXXZ"
|
2012-06-08 08:37:04 +08:00
|
|
|
|
2012-09-03 17:08:10 +08:00
|
|
|
// PR13047
|
2012-06-08 08:37:04 +08:00
|
|
|
typedef double RGB[3];
|
|
|
|
RGB color1;
|
|
|
|
extern const RGB color2 = {};
|
2012-07-23 17:32:54 +08:00
|
|
|
extern RGB const color3[5] = {};
|
|
|
|
extern RGB const ((color4)[5]) = {};
|
2012-06-21 10:52:27 +08:00
|
|
|
|
|
|
|
// PR12603
|
|
|
|
enum E {};
|
|
|
|
// CHECK: "\01?fooE@@YA?AW4E@@XZ"
|
2013-05-15 04:30:42 +08:00
|
|
|
// X64: "\01?fooE@@YA?AW4E@@XZ"
|
2012-06-21 10:52:27 +08:00
|
|
|
E fooE() { return E(); }
|
|
|
|
|
|
|
|
class X {};
|
|
|
|
// CHECK: "\01?fooX@@YA?AVX@@XZ"
|
2013-05-15 04:30:42 +08:00
|
|
|
// X64: "\01?fooX@@YA?AVX@@XZ"
|
2012-06-21 10:52:27 +08:00
|
|
|
X fooX() { return X(); }
|
2012-09-03 17:08:10 +08:00
|
|
|
|
|
|
|
namespace PR13182 {
|
|
|
|
extern char s0[];
|
|
|
|
// CHECK: @"\01?s0@PR13182@@3PADA"
|
|
|
|
extern char s1[42];
|
|
|
|
// CHECK: @"\01?s1@PR13182@@3PADA"
|
|
|
|
extern const char s2[];
|
|
|
|
// CHECK: @"\01?s2@PR13182@@3QBDB"
|
|
|
|
extern const char s3[42];
|
|
|
|
// CHECK: @"\01?s3@PR13182@@3QBDB"
|
|
|
|
extern volatile char s4[];
|
|
|
|
// CHECK: @"\01?s4@PR13182@@3RCDC"
|
|
|
|
extern const volatile char s5[];
|
|
|
|
// CHECK: @"\01?s5@PR13182@@3SDDD"
|
|
|
|
extern const char* const* s6;
|
|
|
|
// CHECK: @"\01?s6@PR13182@@3PBQBDB"
|
|
|
|
|
|
|
|
char foo() {
|
|
|
|
return s0[0] + s1[0] + s2[0] + s3[0] + s4[0] + s5[0] + s6[0][0];
|
|
|
|
}
|
|
|
|
}
|