annotate clang/test/CodeGenCXX/microsoft-abi-methods.cpp @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 class C {
anatofuz
parents:
diff changeset
4 public:
anatofuz
parents:
diff changeset
5 void simple_method() {}
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 void __cdecl cdecl_method() {}
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 void vararg_method(const char *fmt, ...) {}
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 static void static_method() {}
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 int a;
anatofuz
parents:
diff changeset
14 };
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 void call_simple_method() {
anatofuz
parents:
diff changeset
17 C instance;
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 instance.simple_method();
anatofuz
parents:
diff changeset
20 // Make sure that the call uses the right calling convention:
anatofuz
parents:
diff changeset
21 // CHECK: call x86_thiscallcc void @"?simple_method@C@@QAEXXZ"
anatofuz
parents:
diff changeset
22 // CHECK: ret
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 // Make sure that the definition uses the right calling convention:
anatofuz
parents:
diff changeset
25 // CHECK: define linkonce_odr dso_local x86_thiscallcc void @"?simple_method@C@@QAEXXZ"
anatofuz
parents:
diff changeset
26 // CHECK: ret
anatofuz
parents:
diff changeset
27 }
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 void call_cdecl_method() {
anatofuz
parents:
diff changeset
30 C instance;
anatofuz
parents:
diff changeset
31 instance.cdecl_method();
anatofuz
parents:
diff changeset
32 // Make sure that the call uses the right calling convention:
anatofuz
parents:
diff changeset
33 // CHECK: call void @"?cdecl_method@C@@QAAXXZ"
anatofuz
parents:
diff changeset
34 // CHECK: ret
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 // Make sure that the definition uses the right calling convention:
anatofuz
parents:
diff changeset
37 // CHECK: define linkonce_odr dso_local void @"?cdecl_method@C@@QAAXXZ"
anatofuz
parents:
diff changeset
38 // CHECK: ret
anatofuz
parents:
diff changeset
39 }
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 void call_vararg_method() {
anatofuz
parents:
diff changeset
42 C instance;
anatofuz
parents:
diff changeset
43 instance.vararg_method("Hello");
anatofuz
parents:
diff changeset
44 // Make sure that the call uses the right calling convention:
anatofuz
parents:
diff changeset
45 // CHECK: call void (%class.C*, i8*, ...) @"?vararg_method@C@@QAAXPBDZZ"
anatofuz
parents:
diff changeset
46 // CHECK: ret
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 // Make sure that the definition uses the right calling convention:
anatofuz
parents:
diff changeset
49 // CHECK: define linkonce_odr dso_local void @"?vararg_method@C@@QAAXPBDZZ"
anatofuz
parents:
diff changeset
50 }
anatofuz
parents:
diff changeset
51
anatofuz
parents:
diff changeset
52 void call_static_method() {
anatofuz
parents:
diff changeset
53 C::static_method();
anatofuz
parents:
diff changeset
54 // Make sure that the call uses the right calling convention:
anatofuz
parents:
diff changeset
55 // CHECK: call void @"?static_method@C@@SAXXZ"
anatofuz
parents:
diff changeset
56 // CHECK: ret
anatofuz
parents:
diff changeset
57
anatofuz
parents:
diff changeset
58 // Make sure that the definition uses the right calling convention:
anatofuz
parents:
diff changeset
59 // CHECK: define linkonce_odr dso_local void @"?static_method@C@@SAXXZ"
anatofuz
parents:
diff changeset
60 }
anatofuz
parents:
diff changeset
61
anatofuz
parents:
diff changeset
62 class Base {
anatofuz
parents:
diff changeset
63 public:
anatofuz
parents:
diff changeset
64 Base() {}
anatofuz
parents:
diff changeset
65 ~Base() {}
anatofuz
parents:
diff changeset
66 };
anatofuz
parents:
diff changeset
67
anatofuz
parents:
diff changeset
68 class Child: public Base { };
anatofuz
parents:
diff changeset
69
anatofuz
parents:
diff changeset
70 void constructors() {
anatofuz
parents:
diff changeset
71 Child c;
anatofuz
parents:
diff changeset
72 // Make sure that the Base constructor call in the Child constructor uses
anatofuz
parents:
diff changeset
73 // the right calling convention:
anatofuz
parents:
diff changeset
74 // CHECK: define linkonce_odr dso_local x86_thiscallcc %class.Child* @"??0Child@@QAE@XZ"
anatofuz
parents:
diff changeset
75 // CHECK: %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc %class.Base* @"??0Base@@QAE@XZ"
anatofuz
parents:
diff changeset
76 // CHECK: ret
anatofuz
parents:
diff changeset
77
anatofuz
parents:
diff changeset
78 // Make sure that the Base destructor call in the Child denstructor uses
anatofuz
parents:
diff changeset
79 // the right calling convention:
anatofuz
parents:
diff changeset
80 // CHECK: define linkonce_odr dso_local x86_thiscallcc void @"??1Child@@QAE@XZ"
anatofuz
parents:
diff changeset
81 // CHECK: call x86_thiscallcc void @"??1Base@@QAE@XZ"
anatofuz
parents:
diff changeset
82 // CHECK: ret
anatofuz
parents:
diff changeset
83
anatofuz
parents:
diff changeset
84 // Make sure that the Base constructor definition uses the right CC:
anatofuz
parents:
diff changeset
85 // CHECK: define linkonce_odr dso_local x86_thiscallcc %class.Base* @"??0Base@@QAE@XZ"
anatofuz
parents:
diff changeset
86
anatofuz
parents:
diff changeset
87 // Make sure that the Base destructor definition uses the right CC:
anatofuz
parents:
diff changeset
88 // CHECK: define linkonce_odr dso_local x86_thiscallcc void @"??1Base@@QAE@XZ"
anatofuz
parents:
diff changeset
89 }