1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
| // Build with "cl.exe /Zi /GR- /GS- -EHs-c- every-function.cpp /link /debug /nodefaultlib /incremental:no /entry:main"
// Getting functions with the correct calling conventions requires building in x86.
// clang-format off
void *__purecall = 0;
void __cdecl operator delete(void *,unsigned int) {}
void __cdecl operator delete(void *,unsigned __int64) {}
// All calling conventions that appear in normal code.
int __cdecl cc_cdecl() { return 42; }
int __stdcall cc_stdcall() { return 42; }
int __fastcall cc_fastcall() { return 42; }
int __vectorcall cc_vectorcall() { return 42; }
struct Struct {
Struct() {} // constructor
int __thiscall cc_thiscall() { return 42; }
void M() { }
void CM() const { }
void VM() volatile { }
void CVM() const volatile { }
};
int builtin_one_param(int x) { return 42; }
int builtin_two_params(int x, char y) { return 42; }
void struct_one_param(Struct S) { }
void modified_builtin_param(const int X) { }
void modified_struct_param(const Struct S) { }
void pointer_builtin_param(int *X) { }
void pointer_struct_param(Struct *S) { }
void modified_pointer_builtin_param(const int *X) { }
void modified_pointer_struct_param(const Struct *S) { }
Struct rvo() { return Struct(); }
struct Base1 {
virtual ~Base1() {}
};
struct Base2 : public virtual Base1 { };
struct Derived : public virtual Base1, public Base2 {
};
int main() {
cc_cdecl();
cc_stdcall();
cc_fastcall();
Struct().cc_thiscall();
cc_vectorcall();
builtin_one_param(42);
builtin_two_params(42, 'x');
struct_one_param(Struct{});
modified_builtin_param(42);
modified_struct_param(Struct());
pointer_builtin_param(nullptr);
pointer_struct_param(nullptr);
modified_pointer_builtin_param(nullptr);
modified_pointer_struct_param(nullptr);
Struct S = rvo();
Derived D;
return 42;
}
|