2014-03-04 13:47:41 +08:00
|
|
|
// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=i386-pc-win32 -std=c++98 | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=x86_64-pc-win32 -std=c++98| FileCheck -check-prefix X64 %s
|
2010-06-11 11:07:32 +08:00
|
|
|
|
2010-06-12 16:11:16 +08:00
|
|
|
int a;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?a@@3HA"
|
2010-06-11 11:07:32 +08:00
|
|
|
|
2016-05-20 02:15:53 +08:00
|
|
|
extern "C++" {
|
|
|
|
static int __attribute__((used)) ignore_transparent_context;
|
|
|
|
// CHECK-DAG: @ignore_transparent_context
|
|
|
|
}
|
|
|
|
|
2012-11-26 16:55:48 +08:00
|
|
|
namespace N {
|
|
|
|
int b;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?b@N@@3HA"
|
2012-11-26 16:55:48 +08:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
int anonymous;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?anonymous@?A@N@@3HA"
|
2012-11-26 16:55:48 +08:00
|
|
|
}
|
|
|
|
}
|
2010-06-12 16:11:16 +08:00
|
|
|
|
|
|
|
static int c;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @c
|
|
|
|
|
2012-11-26 16:55:48 +08:00
|
|
|
int _c(void) {return N::anonymous + c;}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?_c@@YAHXZ"
|
|
|
|
// X64-DAG: @"\01?_c@@YAHXZ"
|
2010-06-12 16:11:16 +08:00
|
|
|
|
2015-12-30 06:25:14 +08:00
|
|
|
const int &NeedsReferenceTemporary = 2;
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK-DAG: @"\01?NeedsReferenceTemporary@@3ABHB" = dso_local constant i32* @"\01?$RT1@NeedsReferenceTemporary@@3ABHB"
|
|
|
|
// X64-DAG: @"\01?NeedsReferenceTemporary@@3AEBHEB" = dso_local constant i32* @"\01?$RT1@NeedsReferenceTemporary@@3AEBHEB"
|
2015-12-30 06:25:14 +08:00
|
|
|
|
2010-06-14 13:29:01 +08:00
|
|
|
class foo {
|
|
|
|
static const short d;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?d@foo@@0FB"
|
2010-06-14 13:29:01 +08:00
|
|
|
protected:
|
|
|
|
static volatile long e;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?e@foo@@1JC"
|
2010-06-14 13:29:01 +08:00
|
|
|
public:
|
|
|
|
static const volatile char f;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?f@foo@@2DD"
|
2010-06-17 14:47:31 +08:00
|
|
|
int operator+(int a);
|
2011-12-01 17:55:00 +08:00
|
|
|
foo(){}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01??0foo@@QAE@XZ"
|
|
|
|
// X64-DAG: @"\01??0foo@@QEAA@XZ"
|
2011-12-01 17:55:00 +08:00
|
|
|
|
|
|
|
~foo(){}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01??1foo@@QAE@XZ"
|
|
|
|
// X64-DAG: @"\01??1foo@@QEAA@XZ
|
2011-12-01 17:55:00 +08:00
|
|
|
|
|
|
|
foo(int i){}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01??0foo@@QAE@H@Z"
|
|
|
|
// X64-DAG: @"\01??0foo@@QEAA@H@Z"
|
2011-12-01 17:55:00 +08:00
|
|
|
|
|
|
|
foo(char *q){}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01??0foo@@QAE@PAD@Z"
|
|
|
|
// X64-DAG: @"\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(); }
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?bar@@YA?AVfoo@@XZ"
|
|
|
|
// X64-DAG: @"\01?bar@@YA?AVfoo@@XZ"
|
2012-06-27 09:38:25 +08:00
|
|
|
|
|
|
|
int foo::operator+(int a) {
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01??Hfoo@@QAEHH@Z"
|
|
|
|
// X64-DAG: @"\01??Hfoo@@QEAAHH@Z"
|
2012-06-27 09:38:25 +08:00
|
|
|
|
|
|
|
foo::static_method();
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?static_method@foo@@SAPAV1@XZ"
|
|
|
|
// X64-DAG: @"\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;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?g@bar@@2HA"
|
2010-06-18 15:51:00 +08:00
|
|
|
|
2012-09-03 17:08:10 +08:00
|
|
|
extern int * const h1 = &a;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?h1@@3QAHA"
|
2012-09-03 17:08:10 +08:00
|
|
|
extern const int * const h2 = &a;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?h2@@3QBHB"
|
2014-02-18 22:20:10 +08:00
|
|
|
extern int * const __restrict h3 = &a;
|
|
|
|
// CHECK-DAG: @"\01?h3@@3QIAHIA"
|
|
|
|
// X64-DAG: @"\01?h3@@3QEIAHEIA"
|
2010-06-26 11:50:05 +08:00
|
|
|
|
2010-06-30 16:09:57 +08:00
|
|
|
int i[10][20];
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?i@@3PAY0BE@HA"
|
2010-06-30 16:09:57 +08:00
|
|
|
|
2014-02-18 20:58:35 +08:00
|
|
|
typedef int (*FunT)(int, int);
|
|
|
|
FunT FunArr[10][20];
|
|
|
|
// CHECK-DAG: @"\01?FunArr@@3PAY0BE@P6AHHH@ZA"
|
|
|
|
// X64-DAG: @"\01?FunArr@@3PAY0BE@P6AHHH@ZA"
|
|
|
|
|
2010-07-03 13:53:41 +08:00
|
|
|
int (__stdcall *j)(signed char, unsigned char);
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?j@@3P6GHCE@ZA"
|
2010-07-03 13:53:41 +08:00
|
|
|
|
2012-06-08 08:37:04 +08:00
|
|
|
const volatile char foo2::*k;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?k@@3PTfoo@@DT1@"
|
|
|
|
// X64-DAG: @"\01?k@@3PETfoo@@DET1@"
|
2010-07-03 16:01:32 +08:00
|
|
|
|
2012-06-08 08:37:04 +08:00
|
|
|
int (foo2::*l)(int);
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?l@@3P8foo@@AEHH@ZQ1@"
|
2010-07-03 16:01:32 +08:00
|
|
|
|
2014-11-05 21:54:21 +08:00
|
|
|
// Ensure typedef CV qualifiers are mangled correctly
|
|
|
|
typedef const int cInt;
|
|
|
|
typedef volatile int vInt;
|
|
|
|
typedef const volatile int cvInt;
|
|
|
|
|
|
|
|
extern cInt g_cInt = 1;
|
|
|
|
vInt g_vInt = 2;
|
|
|
|
cvInt g_cvInt = 3;
|
|
|
|
|
|
|
|
// CHECK-DAG: @"\01?g_cInt@@3HB"
|
|
|
|
// CHECK-DAG: @"\01?g_vInt@@3HC"
|
|
|
|
// CHECK-DAG: @"\01?g_cvInt@@3HD"
|
|
|
|
|
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) {
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?beta@@YI_N_J_W@Z"
|
|
|
|
// X64-DAG: @"\01?beta@@YA_N_J_W@Z"
|
2010-06-16 13:33:16 +08:00
|
|
|
alpha(0.f, 0.0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?alpha@@YGXMN@Z"
|
|
|
|
// X64-DAG: @"\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) {}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z"
|
|
|
|
// X64-DAG: @"\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 &) {}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?delta@@YAXQAHABJ@Z"
|
|
|
|
// X64-DAG: @"\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]) {}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?epsilon@@YAXQAY19BE@H@Z"
|
|
|
|
// X64-DAG: @"\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)) {}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?zeta@@YAXP6AHHH@Z@Z"
|
|
|
|
// X64-DAG: @"\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)) {}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\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) {}
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?theta@@YAXP_EAHHH@Z@Z"
|
2012-08-25 09:12:56 +08:00
|
|
|
|
2012-05-01 10:33:44 +08:00
|
|
|
void operator_new_delete() {
|
|
|
|
char *ptr = new char;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01??2@YAPAXI@Z"
|
2012-05-01 10:33:44 +08:00
|
|
|
|
|
|
|
delete ptr;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01??3@YAXPAX@Z"
|
2012-05-01 10:33:44 +08:00
|
|
|
|
|
|
|
char *array = new char[42];
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01??_U@YAPAXI@Z"
|
2012-05-01 10:33:44 +08:00
|
|
|
|
2012-05-01 13:23:51 +08:00
|
|
|
delete [] array;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\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(); }
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?redundant_parens@@YAXXZ"
|
|
|
|
// X64-DAG: @"\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;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?color1@@3PANA"
|
2012-06-08 08:37:04 +08:00
|
|
|
extern const RGB color2 = {};
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?color2@@3QBNB"
|
2012-07-23 17:32:54 +08:00
|
|
|
extern RGB const color3[5] = {};
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?color3@@3QAY02$$CBNA"
|
2012-07-23 17:32:54 +08:00
|
|
|
extern RGB const ((color4)[5]) = {};
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?color4@@3QAY02$$CBNA"
|
2012-06-21 10:52:27 +08:00
|
|
|
|
2013-08-15 16:13:23 +08:00
|
|
|
struct B;
|
|
|
|
volatile int B::* volatile memptr1;
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptr1@@3RESB@@HES1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
volatile int B::* memptr2;
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptr2@@3PESB@@HES1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
int B::* volatile memptr3;
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptr3@@3REQB@@HEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
typedef int (*fun)();
|
|
|
|
volatile fun B::* volatile funmemptr1;
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?funmemptr1@@3RESB@@R6AHXZES1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
volatile fun B::* funmemptr2;
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?funmemptr2@@3PESB@@R6AHXZES1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
fun B::* volatile funmemptr3;
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?funmemptr3@@3REQB@@P6AHXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
void (B::* volatile memptrtofun1)();
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptrtofun1@@3R8B@@EAAXXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
const void (B::* memptrtofun2)();
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptrtofun2@@3P8B@@EAAXXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
volatile void (B::* memptrtofun3)();
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptrtofun3@@3P8B@@EAAXXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
int (B::* volatile memptrtofun4)();
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptrtofun4@@3R8B@@EAAHXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
volatile int (B::* memptrtofun5)();
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptrtofun5@@3P8B@@EAA?CHXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
const int (B::* memptrtofun6)();
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptrtofun6@@3P8B@@EAA?BHXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
fun (B::* volatile memptrtofun7)();
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptrtofun7@@3R8B@@EAAP6AHXZXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
volatile fun (B::* memptrtofun8)();
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptrtofun8@@3P8B@@EAAR6AHXZXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
const fun (B::* memptrtofun9)();
|
2013-09-13 16:59:19 +08:00
|
|
|
// X64-DAG: @"\01?memptrtofun9@@3P8B@@EAAQ6AHXZXZEQ1@"
|
2013-08-15 16:13:23 +08:00
|
|
|
|
2012-06-21 10:52:27 +08:00
|
|
|
// PR12603
|
|
|
|
enum E {};
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: "\01?fooE@@YA?AW4E@@XZ"
|
|
|
|
// X64-DAG: "\01?fooE@@YA?AW4E@@XZ"
|
2012-06-21 10:52:27 +08:00
|
|
|
E fooE() { return E(); }
|
|
|
|
|
|
|
|
class X {};
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: "\01?fooX@@YA?AVX@@XZ"
|
|
|
|
// X64-DAG: "\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[];
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?s0@PR13182@@3PADA"
|
2012-09-03 17:08:10 +08:00
|
|
|
extern char s1[42];
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?s1@PR13182@@3PADA"
|
2012-09-03 17:08:10 +08:00
|
|
|
extern const char s2[];
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?s2@PR13182@@3QBDB"
|
2012-09-03 17:08:10 +08:00
|
|
|
extern const char s3[42];
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?s3@PR13182@@3QBDB"
|
2012-09-03 17:08:10 +08:00
|
|
|
extern volatile char s4[];
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?s4@PR13182@@3RCDC"
|
2012-09-03 17:08:10 +08:00
|
|
|
extern const volatile char s5[];
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?s5@PR13182@@3SDDD"
|
2012-09-03 17:08:10 +08:00
|
|
|
extern const char* const* s6;
|
2013-09-13 16:59:19 +08:00
|
|
|
// CHECK-DAG: @"\01?s6@PR13182@@3PBQBDB"
|
2012-09-03 17:08:10 +08:00
|
|
|
|
|
|
|
char foo() {
|
|
|
|
return s0[0] + s1[0] + s2[0] + s3[0] + s4[0] + s5[0] + s6[0][0];
|
|
|
|
}
|
|
|
|
}
|
2013-09-13 17:03:14 +08:00
|
|
|
|
|
|
|
extern "C" inline void extern_c_func() {
|
|
|
|
static int local;
|
|
|
|
// CHECK-DAG: @"\01?local@?1??extern_c_func@@9@4HA"
|
|
|
|
// X64-DAG: @"\01?local@?1??extern_c_func@@9@4HA"
|
|
|
|
}
|
|
|
|
|
|
|
|
void call_extern_c_func() {
|
|
|
|
extern_c_func();
|
|
|
|
}
|
2013-09-13 17:40:55 +08:00
|
|
|
|
|
|
|
int main() { return 0; }
|
|
|
|
// CHECK-DAG: @main
|
|
|
|
// X64-DAG: @main
|
|
|
|
|
|
|
|
int wmain() { return 0; }
|
|
|
|
// CHECK-DAG: @wmain
|
|
|
|
// X64-DAG: @wmain
|
|
|
|
|
|
|
|
int WinMain() { return 0; }
|
|
|
|
// CHECK-DAG: @WinMain
|
|
|
|
// X64-DAG: @WinMain
|
|
|
|
|
|
|
|
int wWinMain() { return 0; }
|
|
|
|
// CHECK-DAG: @wWinMain
|
|
|
|
// X64-DAG: @wWinMain
|
|
|
|
|
|
|
|
int DllMain() { return 0; }
|
|
|
|
// CHECK-DAG: @DllMain
|
|
|
|
// X64-DAG: @DllMain
|
2013-09-18 07:57:10 +08:00
|
|
|
|
|
|
|
inline int inline_function_with_local_type() {
|
|
|
|
static struct {
|
|
|
|
int a_field;
|
|
|
|
} static_variable_in_inline_function = { 20 }, second_static = { 40 };
|
|
|
|
// CHECK: @"\01?static_variable_in_inline_function@?1??inline_function_with_local_type@@YAHXZ@4U<unnamed-type-static_variable_in_inline_function>@?1??1@YAHXZ@A"
|
|
|
|
|
|
|
|
return static_variable_in_inline_function.a_field + second_static.a_field;
|
|
|
|
}
|
|
|
|
|
|
|
|
int call_inline_function_with_local_type() {
|
|
|
|
return inline_function_with_local_type();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
inline int templated_inline_function_with_local_type() {
|
|
|
|
static struct {
|
|
|
|
int a_field;
|
|
|
|
} static_variable_in_templated_inline_function = { 20 },
|
|
|
|
second_static = { 40 };
|
|
|
|
// CHECK: @"\01?static_variable_in_templated_inline_function@?1???$templated_inline_function_with_local_type@H@@YAHXZ@4U<unnamed-type-static_variable_in_templated_inline_function>@?1???$templated_inline_function_with_local_type@H@@YAHXZ@A"
|
|
|
|
|
|
|
|
return static_variable_in_templated_inline_function.a_field +
|
|
|
|
second_static.a_field;
|
|
|
|
}
|
|
|
|
|
|
|
|
int call_templated_inline_function_with_local_type() {
|
|
|
|
return templated_inline_function_with_local_type<int>();
|
|
|
|
}
|
2013-10-08 08:58:57 +08:00
|
|
|
|
|
|
|
// PR17371
|
|
|
|
struct OverloadedNewDelete {
|
|
|
|
// __cdecl
|
|
|
|
void *operator new(__SIZE_TYPE__);
|
|
|
|
void *operator new[](__SIZE_TYPE__);
|
|
|
|
void operator delete(void *);
|
|
|
|
void operator delete[](void *);
|
|
|
|
// __thiscall
|
|
|
|
int operator+(int);
|
|
|
|
};
|
|
|
|
|
|
|
|
void *OverloadedNewDelete::operator new(__SIZE_TYPE__ s) { return 0; }
|
|
|
|
void *OverloadedNewDelete::operator new[](__SIZE_TYPE__ s) { return 0; }
|
|
|
|
void OverloadedNewDelete::operator delete(void *) { }
|
|
|
|
void OverloadedNewDelete::operator delete[](void *) { }
|
|
|
|
int OverloadedNewDelete::operator+(int x) { return x; };
|
|
|
|
|
|
|
|
// CHECK-DAG: ??2OverloadedNewDelete@@SAPAXI@Z
|
|
|
|
// CHECK-DAG: ??_UOverloadedNewDelete@@SAPAXI@Z
|
|
|
|
// CHECK-DAG: ??3OverloadedNewDelete@@SAXPAX@Z
|
|
|
|
// CHECK-DAG: ??_VOverloadedNewDelete@@SAXPAX@Z
|
|
|
|
// CHECK-DAG: ??HOverloadedNewDelete@@QAEHH@Z
|
|
|
|
|
|
|
|
// X64-DAG: ??2OverloadedNewDelete@@SAPEAX_K@Z
|
|
|
|
// X64-DAG: ??_UOverloadedNewDelete@@SAPEAX_K@Z
|
|
|
|
// X64-DAG: ??3OverloadedNewDelete@@SAXPEAX@Z
|
|
|
|
// X64-DAG: ??_VOverloadedNewDelete@@SAXPEAX@Z
|
|
|
|
// X64-DAG: ??HOverloadedNewDelete@@QEAAHH@Z
|
|
|
|
|
|
|
|
// Indirecting the function type through a typedef will require a calling
|
|
|
|
// convention adjustment before building the method decl.
|
|
|
|
|
|
|
|
typedef void *__thiscall OperatorNewType(__SIZE_TYPE__);
|
|
|
|
typedef void __thiscall OperatorDeleteType(void *);
|
|
|
|
|
|
|
|
struct TypedefNewDelete {
|
|
|
|
OperatorNewType operator new;
|
|
|
|
OperatorNewType operator new[];
|
|
|
|
OperatorDeleteType operator delete;
|
|
|
|
OperatorDeleteType operator delete[];
|
|
|
|
};
|
|
|
|
|
|
|
|
void *TypedefNewDelete::operator new(__SIZE_TYPE__ s) { return 0; }
|
|
|
|
void *TypedefNewDelete::operator new[](__SIZE_TYPE__ s) { return 0; }
|
|
|
|
void TypedefNewDelete::operator delete(void *) { }
|
|
|
|
void TypedefNewDelete::operator delete[](void *) { }
|
|
|
|
|
|
|
|
// CHECK-DAG: ??2TypedefNewDelete@@SAPAXI@Z
|
|
|
|
// CHECK-DAG: ??_UTypedefNewDelete@@SAPAXI@Z
|
|
|
|
// CHECK-DAG: ??3TypedefNewDelete@@SAXPAX@Z
|
|
|
|
// CHECK-DAG: ??_VTypedefNewDelete@@SAXPAX@Z
|
2013-11-26 01:50:19 +08:00
|
|
|
|
2014-10-25 01:42:17 +08:00
|
|
|
void __vectorcall vector_func() { }
|
|
|
|
// CHECK-DAG: @"\01?vector_func@@YQXXZ"
|
2015-05-18 08:05:25 +08:00
|
|
|
|
|
|
|
template <void (*)(void)>
|
|
|
|
void fn_tmpl() {}
|
|
|
|
|
|
|
|
template void fn_tmpl<extern_c_func>();
|
|
|
|
// CHECK-DAG: @"\01??$fn_tmpl@$1?extern_c_func@@YAXXZ@@YAXXZ"
|
2015-05-18 08:05:29 +08:00
|
|
|
|
|
|
|
extern "C" void __attribute__((overloadable)) overloaded_fn() {}
|
|
|
|
// CHECK-DAG: @"\01?overloaded_fn@@$$J0YAXXZ"
|
2015-09-01 02:48:39 +08:00
|
|
|
|
2017-06-28 05:31:31 +08:00
|
|
|
extern "C" void overloaded_fn2() {}
|
|
|
|
// CHECK-DAG: @overloaded_fn2
|
|
|
|
//
|
|
|
|
extern "C" void __attribute__((overloadable)) overloaded_fn3();
|
|
|
|
extern "C" void overloaded_fn3() {}
|
|
|
|
// CHECK-DAG: @overloaded_fn3
|
|
|
|
|
2015-09-01 02:48:39 +08:00
|
|
|
namespace UnnamedType {
|
|
|
|
struct S {
|
|
|
|
typedef struct {} *T1[1];
|
|
|
|
typedef struct {} T2;
|
|
|
|
typedef struct {} *T3, T4;
|
|
|
|
using T5 = struct {};
|
|
|
|
using T6 = struct {} *;
|
|
|
|
};
|
|
|
|
void f(S::T1) {}
|
|
|
|
void f(S::T2) {}
|
|
|
|
void f(S::T3) {}
|
|
|
|
void f(S::T4) {}
|
|
|
|
void f(S::T5) {}
|
|
|
|
void f(S::T6) {}
|
|
|
|
// CHECK-DAG: @"\01?f@UnnamedType@@YAXQAPAU<unnamed-type-T1>@S@1@@Z"
|
|
|
|
// CHECK-DAG: @"\01?f@UnnamedType@@YAXUT2@S@1@@Z"
|
|
|
|
// CHECK-DAG: @"\01?f@UnnamedType@@YAXPAUT4@S@1@@Z"
|
|
|
|
// CHECK-DAG: @"\01?f@UnnamedType@@YAXUT4@S@1@@Z"
|
|
|
|
// CHECK-DAG: @"\01?f@UnnamedType@@YAXUT5@S@1@@Z"
|
|
|
|
// CHECK-DAG: @"\01?f@UnnamedType@@YAXPAU<unnamed-type-T6>@S@1@@Z"
|
|
|
|
|
|
|
|
// X64-DAG: @"\01?f@UnnamedType@@YAXQEAPEAU<unnamed-type-T1>@S@1@@Z"
|
|
|
|
// X64-DAG: @"\01?f@UnnamedType@@YAXUT2@S@1@@Z"
|
|
|
|
// X64-DAG: @"\01?f@UnnamedType@@YAXPEAUT4@S@1@@Z"(%"struct.UnnamedType::S::T4"
|
|
|
|
// X64-DAG: @"\01?f@UnnamedType@@YAXUT4@S@1@@Z"
|
|
|
|
// X64-DAG: @"\01?f@UnnamedType@@YAXUT5@S@1@@Z"
|
|
|
|
// X64-DAG: @"\01?f@UnnamedType@@YAXPEAU<unnamed-type-T6>@S@1@@Z"
|
|
|
|
}
|
2015-12-03 05:58:08 +08:00
|
|
|
|
|
|
|
namespace PassObjectSize {
|
|
|
|
// NOTE: This mangling is subject to change.
|
|
|
|
// Reiterating from the comment in MicrosoftMangle, the scheme is pretend a
|
|
|
|
// parameter of type __clang::__pass_object_sizeN exists after each pass object
|
|
|
|
// size param P, where N is the Type of the pass_object_size attribute on P.
|
|
|
|
//
|
|
|
|
// e.g. we want to mangle:
|
|
|
|
// void foo(void *const __attribute__((pass_object_size(0))));
|
|
|
|
// as if it were
|
|
|
|
// namespace __clang { enum __pass_object_size0 : size_t {}; }
|
|
|
|
// void foo(void *const, __clang::__pass_object_size0);
|
|
|
|
// where __clang is a top-level namespace.
|
|
|
|
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK-DAG: define dso_local i32 @"\01?foo@PassObjectSize@@YAHQAHW4__pass_object_size0@__clang@@@Z"
|
2015-12-03 05:58:08 +08:00
|
|
|
int foo(int *const i __attribute__((pass_object_size(0)))) { return 0; }
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK-DAG: define dso_local i32 @"\01?bar@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@@Z"
|
2015-12-03 05:58:08 +08:00
|
|
|
int bar(int *const i __attribute__((pass_object_size(1)))) { return 0; }
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK-DAG: define dso_local i32 @"\01?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size0@3@@Z"
|
2015-12-30 13:13:03 +08:00
|
|
|
int qux(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(0)))) { return 0; }
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK-DAG: define dso_local i32 @"\01?zot@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z"
|
2015-12-30 13:13:03 +08:00
|
|
|
int zot(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(1)))) { return 0; }
|
2015-12-03 05:58:08 +08:00
|
|
|
}
|
2015-12-29 19:46:00 +08:00
|
|
|
|
|
|
|
namespace Atomic {
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK-DAG: define dso_local void @"\01?f@Atomic@@YAXU?$_Atomic@H@__clang@@@Z"(
|
2015-12-29 19:46:00 +08:00
|
|
|
void f(_Atomic(int)) {}
|
|
|
|
}
|
2015-12-30 06:02:15 +08:00
|
|
|
namespace Complex {
|
2018-02-24 03:30:48 +08:00
|
|
|
// CHECK-DAG: define dso_local void @"\01?f@Complex@@YAXU?$_Complex@H@__clang@@@Z"(
|
2015-12-30 06:02:15 +08:00
|
|
|
void f(_Complex int) {}
|
|
|
|
}
|
2016-01-09 04:48:26 +08:00
|
|
|
|
|
|
|
namespace PR26029 {
|
|
|
|
template <class>
|
|
|
|
struct L {
|
|
|
|
L() {}
|
|
|
|
};
|
|
|
|
template <class>
|
|
|
|
class H;
|
|
|
|
struct M : L<H<int *> > {};
|
|
|
|
|
|
|
|
template <class>
|
|
|
|
struct H {};
|
|
|
|
|
|
|
|
template <class GT>
|
|
|
|
void m_fn3() {
|
|
|
|
(H<GT *>());
|
|
|
|
M();
|
|
|
|
}
|
|
|
|
|
|
|
|
void runOnFunction() {
|
|
|
|
L<H<int *> > b;
|
|
|
|
m_fn3<int>();
|
|
|
|
}
|
|
|
|
// CHECK-DAG: call {{.*}} @"\01??0?$L@V?$H@PAH@PR26029@@@PR26029@@QAE@XZ"
|
|
|
|
}
|