// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -triple i686-windows-gnu -o - | FileCheck %s
// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -triple i686-windows-itanium -o - | FileCheck %s
// GCC 5.1 began mangling these Windows calling conventions into function
// types, since they can be used for overloading. They've always been mangled
// in the MS ABI, but they are new to the Itanium mangler. Note that the main
// function definition does not use a calling convention. Only function types
// that appear later use it.
static int
void ;
void ;
void ;
void ;
int
int
int
// CHECK: define dso_local noundef i32 @_Z8as_cdeclv()
// CHECK: call noundef i32 @_ZL11func_as_ptrIPFviiEEiT_(void (i32, i32)* noundef @_Z7f_cdeclii)
// CHECK: define dso_local noundef i32 @_Z10as_stdcallv()
// CHECK: call noundef i32 @_ZL11func_as_ptrIPU7stdcallFviiEEiT_(void (i32, i32)* noundef @"\01__Z9f_stdcallii@8")
// CHECK: define dso_local noundef i32 @_Z11as_fastcallv()
// CHECK: call noundef i32 @_ZL11func_as_ptrIPU8fastcallFviiEEiT_(void (i32, i32)* noundef @"\01@_Z10f_fastcallii@8")
// PR40107: We should mangle thiscall here but we don't because we can't
// disambiguate it from the member pointer case below where it shouldn't be
// mangled.
//int as_thiscall() { return func_as_ptr(f_thiscall); }
// CHECKX: define dso_local i32 @_Z11as_thiscallv()
// CHECKX: call i32 @_ZL11func_as_ptrIPU8thiscallFviiEEiT_(void (i32, i32)* @_Z10f_thiscallii)
// CHECK: define dso_local void @_Z11funcRefTypeRU8fastcallFviiE(void (i32, i32)* noundef nonnull %fr)
void
;
// PR40107: In this case, the member function pointer uses the thiscall
// convention, but GCC doesn't mangle it, so we don't either.
// CHECK: define dso_local void @_Z15memptr_thiscallP3FooMS_FvvE(%struct.Foo* {{.*}})
void
// CHECK: define dso_local void @_Z12memptrCCTypeR3FooMS_U8fastcallFviiE(%struct.Foo* {{.*}}, { i32, i32 }* noundef byval{{.*}})
void
// CHECK: define dso_local noundef i32 @_Z17useTemplateFnTypev()
// CHECK: call noundef i32 @_ZL14templateFnTypeIU8fastcallFviiEElPT_(void (i32, i32)* noundef @"\01@_Z10f_fastcallii@8")
static long
long
// CHECK: define weak_odr dso_local x86_fastcallcc void @"\01@_Z10fnTemplateIsEvv@0"()
// CHECK: define dso_local x86_fastcallcc void @"\01@_Z10fnTemplateIiEvv@0"()
void
;
void
// CHECK: define weak_odr dso_local x86_fastcallcc noundef void (i32, i32)* @"\01@_Z12fnTempReturnIsEPU8fastcallFviiEv@0"()
// CHECK: define dso_local x86_fastcallcc noundef void (i32, i32)* @"\01@_Z12fnTempReturnIiEPU8fastcallFviiEv@0"()
typedef void ;
fp_cc_t
;
fp_cc_t