1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc class C { 4*f4a2713aSLionel Sambuc public: 5*f4a2713aSLionel Sambuc void simple_method() {} 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc void __cdecl cdecl_method() {} 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc void vararg_method(const char *fmt, ...) {} 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc static void static_method() {} 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc int a; 14*f4a2713aSLionel Sambuc }; 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc void call_simple_method() { 17*f4a2713aSLionel Sambuc C instance; 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc instance.simple_method(); 20*f4a2713aSLionel Sambuc // Make sure that the call uses the right calling convention: 21*f4a2713aSLionel Sambuc // CHECK: call x86_thiscallcc void @"\01?simple_method@C@@QAEXXZ" 22*f4a2713aSLionel Sambuc // CHECK: ret 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc // Make sure that the definition uses the right calling convention: 25*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr x86_thiscallcc void @"\01?simple_method@C@@QAEXXZ" 26*f4a2713aSLionel Sambuc // CHECK: ret 27*f4a2713aSLionel Sambuc } 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambuc void call_cdecl_method() { 30*f4a2713aSLionel Sambuc C instance; 31*f4a2713aSLionel Sambuc instance.cdecl_method(); 32*f4a2713aSLionel Sambuc // Make sure that the call uses the right calling convention: 33*f4a2713aSLionel Sambuc // CHECK: call void @"\01?cdecl_method@C@@QAAXXZ" 34*f4a2713aSLionel Sambuc // CHECK: ret 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc // Make sure that the definition uses the right calling convention: 37*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr void @"\01?cdecl_method@C@@QAAXXZ" 38*f4a2713aSLionel Sambuc // CHECK: ret 39*f4a2713aSLionel Sambuc } 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc void call_vararg_method() { 42*f4a2713aSLionel Sambuc C instance; 43*f4a2713aSLionel Sambuc instance.vararg_method("Hello"); 44*f4a2713aSLionel Sambuc // Make sure that the call uses the right calling convention: 45*f4a2713aSLionel Sambuc // CHECK: call void (%class.C*, i8*, ...)* @"\01?vararg_method@C@@QAAXPBDZZ" 46*f4a2713aSLionel Sambuc // CHECK: ret 47*f4a2713aSLionel Sambuc 48*f4a2713aSLionel Sambuc // Make sure that the definition uses the right calling convention: 49*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr void @"\01?vararg_method@C@@QAAXPBDZZ" 50*f4a2713aSLionel Sambuc } 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambuc void call_static_method() { 53*f4a2713aSLionel Sambuc C::static_method(); 54*f4a2713aSLionel Sambuc // Make sure that the call uses the right calling convention: 55*f4a2713aSLionel Sambuc // CHECK: call void @"\01?static_method@C@@SAXXZ" 56*f4a2713aSLionel Sambuc // CHECK: ret 57*f4a2713aSLionel Sambuc 58*f4a2713aSLionel Sambuc // Make sure that the definition uses the right calling convention: 59*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr void @"\01?static_method@C@@SAXXZ" 60*f4a2713aSLionel Sambuc } 61*f4a2713aSLionel Sambuc 62*f4a2713aSLionel Sambuc class Base { 63*f4a2713aSLionel Sambuc public: 64*f4a2713aSLionel Sambuc Base() {} 65*f4a2713aSLionel Sambuc ~Base() {} 66*f4a2713aSLionel Sambuc }; 67*f4a2713aSLionel Sambuc 68*f4a2713aSLionel Sambuc class Child: public Base { }; 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc void constructors() { 71*f4a2713aSLionel Sambuc Child c; 72*f4a2713aSLionel Sambuc // Make sure that the Base constructor call in the Child constructor uses 73*f4a2713aSLionel Sambuc // the right calling convention: 74*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr x86_thiscallcc %class.Child* @"\01??0Child@@QAE@XZ" 75*f4a2713aSLionel Sambuc // CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc %class.Base* @"\01??0Base@@QAE@XZ" 76*f4a2713aSLionel Sambuc // CHECK: ret 77*f4a2713aSLionel Sambuc 78*f4a2713aSLionel Sambuc // Make sure that the Base destructor call in the Child denstructor uses 79*f4a2713aSLionel Sambuc // the right calling convention: 80*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr x86_thiscallcc void @"\01??1Child@@QAE@XZ" 81*f4a2713aSLionel Sambuc // CHECK: call x86_thiscallcc void @"\01??1Base@@QAE@XZ" 82*f4a2713aSLionel Sambuc // CHECK: ret 83*f4a2713aSLionel Sambuc 84*f4a2713aSLionel Sambuc // Make sure that the Base destructor definition uses the right CC: 85*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr x86_thiscallcc void @"\01??1Base@@QAE@XZ" 86*f4a2713aSLionel Sambuc 87*f4a2713aSLionel Sambuc // Make sure that the Base constructor definition uses the right CC: 88*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr x86_thiscallcc %class.Base* @"\01??0Base@@QAE@XZ" 89*f4a2713aSLionel Sambuc } 90