// RUN: %clang_cc1 -no-opaque-pointers -fblocks -emit-llvm %s -o - -triple=i386-pc-win32 -std=c++98 | FileCheck %s
// RUN: %clang_cc1 -no-opaque-pointers -fblocks -emit-llvm %s -o - -triple=x86_64-pc-win32 -std=c++98| FileCheck -check-prefix X64 %s
// RUN: %clang_cc1 -no-opaque-pointers -fblocks -emit-llvm %s -o - -triple=aarch64-pc-win32 -std=c++98 -DARM | FileCheck -check-prefixes=X64,ARM %s
int a;
// CHECK-DAG: @"?a@@3HA"
extern "C++"
static int c;
// CHECK-DAG: @c
int
// CHECK-DAG: @"?_c@@YAHXZ"
// X64-DAG: @"?_c@@YAHXZ"
const int &NeedsReferenceTemporary = 2;
// CHECK-DAG: @"?NeedsReferenceTemporary@@3ABHB" = dso_local constant i32* @"?$RT1@NeedsReferenceTemporary@@3ABHB"
// X64-DAG: @"?NeedsReferenceTemporary@@3AEBHEB" = dso_local constant i32* @"?$RT1@NeedsReferenceTemporary@@3AEBHEB"
f,,;
typedef ;
;
;
;
foo
// CHECK-DAG: @"?bar@@YA?AVfoo@@XZ"
// X64-DAG: @"?bar@@YA?AVfoo@@XZ"
int
const short foo::d = 0;
volatile long foo::e;
const volatile char foo::f = 'C';
int bar::g;
// CHECK-DAG: @"?g@bar@@2HA"
extern int * const h1 = &a;
// CHECK-DAG: @"?h1@@3QAHA"
extern const int * const h2 = &a;
// CHECK-DAG: @"?h2@@3QBHB"
extern int * const __restrict h3 = &a;
// CHECK-DAG: @"?h3@@3QIAHIA"
// X64-DAG: @"?h3@@3QEIAHEIA"
int i;
// CHECK-DAG: @"?i@@3PAY0BE@HA"
typedef int ;
FunT FunArr;
// CHECK-DAG: @"?FunArr@@3PAY0BE@P6AHHH@ZA"
// X64-DAG: @"?FunArr@@3PAY0BE@P6AHHH@ZA"
int ;
// CHECK-DAG: @"?j@@3P6GHCE@ZA"
const char foo2::*m;
// CHECK-DAG: @"?m@@3PRfoo@@DR1@"
// X64-DAG: @"?m@@3PERfoo@@DER1@"
const volatile char foo2::*k;
// CHECK-DAG: @"?k@@3PTfoo@@DT1@"
// X64-DAG: @"?k@@3PETfoo@@DET1@"
int ;
// CHECK-DAG: @"?l@@3P8foo@@AEHH@ZQ1@"
// 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: @"?g_cInt@@3HB"
// CHECK-DAG: @"?g_vInt@@3HC"
// CHECK-DAG: @"?g_cvInt@@3HD"
// Static functions are mangled, too.
// Also make sure calling conventions, arglists, and throw specs work.
static void __stdcall throw
bool __fastcall throw
// CHECK-DAG: @"?alpha@@YGXMN@Z"
// X64-DAG: @"?alpha@@YAXMN@Z"
// Make sure tag-type mangling works.
void
// CHECK-DAG: @"?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z"
// X64-DAG: @"?gamma@@YAXVfoo@@Ubar@@Tbaz@@W4quux@@@Z"
// Make sure pointer/reference-type mangling works.
void
// CHECK-DAG: @"?delta@@YAXQAHABJ@Z"
// X64-DAG: @"?delta@@YAXQEAHAEBJ@Z"
// Array mangling.
void
// CHECK-DAG: @"?epsilon@@YAXQAY19BE@H@Z"
// X64-DAG: @"?epsilon@@YAXQEAY19BE@H@Z"
void
// CHECK-DAG: @"?zeta@@YAXP6AHHH@Z@Z"
// X64-DAG: @"?zeta@@YAXP6AHHH@Z@Z"
// Blocks mangling (Clang extension). A block should be mangled slightly
// differently from a similar function pointer.
void
// CHECK-DAG: @"?eta@@YAXP_EAHHH@Z@Z"
typedef int ;
void
// CHECK-DAG: @"?theta@@YAXP_EAHHH@Z@Z"
void
// PR13022
void ;
void
// CHECK-DAG: @"?redundant_parens@@YAXXZ"
// X64-DAG: @"?redundant_parens@@YAXXZ"
// PR13047
typedef double RGB;
RGB color1;
// CHECK-DAG: @"?color1@@3PANA"
extern const RGB color2 = ;
// CHECK-DAG: @"?color2@@3QBNB"
extern RGB const color3 = ;
// CHECK-DAG: @"?color3@@3QAY02$$CBNA"
extern RGB const = ;
// CHECK-DAG: @"?color4@@3QAY02$$CBNA"
;
volatile int B::* volatile memptr1;
// X64-DAG: @"?memptr1@@3RESB@@HES1@"
volatile int B::* memptr2;
// X64-DAG: @"?memptr2@@3PESB@@HES1@"
int B::* volatile memptr3;
// X64-DAG: @"?memptr3@@3REQB@@HEQ1@"
typedef int ;
volatile fun B::* volatile funmemptr1;
// X64-DAG: @"?funmemptr1@@3RESB@@R6AHXZES1@"
volatile fun B::* funmemptr2;
// X64-DAG: @"?funmemptr2@@3PESB@@R6AHXZES1@"
fun B::* volatile funmemptr3;
// X64-DAG: @"?funmemptr3@@3REQB@@P6AHXZEQ1@"
void ;
// X64-DAG: @"?memptrtofun1@@3R8B@@EAAXXZEQ1@"
const void ;
// X64-DAG: @"?memptrtofun2@@3P8B@@EAAXXZEQ1@"
volatile void ;
// X64-DAG: @"?memptrtofun3@@3P8B@@EAAXXZEQ1@"
int ;
// X64-DAG: @"?memptrtofun4@@3R8B@@EAAHXZEQ1@"
volatile int ;
// X64-DAG: @"?memptrtofun5@@3P8B@@EAA?CHXZEQ1@"
const int ;
// X64-DAG: @"?memptrtofun6@@3P8B@@EAA?BHXZEQ1@"
;
// X64-DAG: @"?memptrtofun7@@3R8B@@EAAP6AHXZXZEQ1@"
volatile ;
// X64-DAG: @"?memptrtofun8@@3P8B@@EAAR6AHXZXZEQ1@"
const ;
// X64-DAG: @"?memptrtofun9@@3P8B@@EAAQ6AHXZXZEQ1@"
// PR12603
;
// CHECK-DAG: "?fooE@@YA?AW4E@@XZ"
// X64-DAG: "?fooE@@YA?AW4E@@XZ"
E
;
// CHECK-DAG: "?fooX@@YA?AVX@@XZ"
// X64-DAG: "?fooX@@YA?AVX@@XZ"
X
extern "C" inline void
void
int
// CHECK-DAG: @main
// X64-DAG: @main
int
// CHECK-DAG: @wmain
// X64-DAG: @wmain
int
// CHECK-DAG: @WinMain
// X64-DAG: @WinMain
int
// CHECK-DAG: @wWinMain
// X64-DAG: @wWinMain
int
// CHECK-DAG: @DllMain
// X64-DAG: @DllMain
inline int
int
inline int
int
// PR17371
;
void *OverloadedNewDelete::operator new
void *OverloadedNewDelete::operator new
void OverloadedNewDelete::operator delete
void OverloadedNewDelete::operator delete[]
int ;
// 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 ;
typedef void __thiscall ;
;
void *TypedefNewDelete::operator new
void *TypedefNewDelete::operator new
void TypedefNewDelete::operator delete
void TypedefNewDelete::operator delete[]
// CHECK-DAG: ??2TypedefNewDelete@@SAPAXI@Z
// CHECK-DAG: ??_UTypedefNewDelete@@SAPAXI@Z
// CHECK-DAG: ??3TypedefNewDelete@@SAXPAX@Z
// CHECK-DAG: ??_VTypedefNewDelete@@SAXPAX@Z
void __vectorcall
// CHECK-DAG: @"?vector_func@@YQXXZ"
void
;
// CHECK-DAG: @"??$fn_tmpl@$1?extern_c_func@@YAXXZ@@YAXXZ"
extern "C" void
// CHECK-DAG: @"?overloaded_fn@@$$J0YAXXZ"
extern "C" void
// CHECK-DAG: @overloaded_fn2
//
extern "C" void ;
extern "C" void
// CHECK-DAG: @overloaded_fn3
// ARM