blob: 7f2fc0a89d7a480a81de8496b006926598676be3 [file] [log] [blame]
John McCallfb609142012-08-25 02:00:03 +00001// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck -check-prefix GCABI %s
2// RUN: %clang_cc1 -emit-llvm %s -o - -DMS_ABI -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck -check-prefix MSABI %s
3
4#ifdef MS_ABI
5# define METHOD_CC __thiscall
6#else
7# define METHOD_CC __attribute__ ((cdecl))
8#endif
9
10// Test that it's OK to have multiple function declarations with the default CC
11// both mentioned explicitly and implied.
12void foo();
13void __cdecl foo();
14void __cdecl foo() {}
15// GCABI: define void @_Z3foov()
16// MSABI: define void @"\01?foo@@YAXXZ"
17
18void __cdecl bar();
19void bar();
20void bar() {}
21// GCABI: define void @_Z3barv()
22// MSABI: define void @"\01?bar@@YAXXZ"
23
24// Test that it's OK to mark either the method declaration or method definition
25// with a default CC explicitly.
26class A {
27public:
28 void baz();
29 void METHOD_CC qux();
30
Timur Iskhodzhanovaad3fa62013-02-19 10:50:44 +000031 static void static_baz();
32 static void __cdecl static_qux();
John McCallfb609142012-08-25 02:00:03 +000033};
34
35void METHOD_CC A::baz() {}
36// GCABI: define void @_ZN1A3bazEv
37// MSABI: define x86_thiscallcc void @"\01?baz@A@@QAEXXZ"
38void A::qux() {}
39// GCABI: define void @_ZN1A3quxEv
40// MSABI: define x86_thiscallcc void @"\01?qux@A@@QAEXXZ"
41
42void __cdecl static_baz() {}
43// GCABI: define void @_Z10static_bazv
44// MSABI: define void @"\01?static_baz@@YAXXZ"
45void static_qux() {}
46// GCABI: define void @_Z10static_quxv
47// MSABI: define void @"\01?static_qux@@YAXXZ"