aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/mangle-ms-return-qualifiers.cpp
blob: 37bbf099fab0af48a52a40f4c6e081ec9d4d6940 (plain) (blame)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s

void a1() {}
// CHECK: "\01?a1@@YAXXZ"

int a2() { return 0; }
// CHECK: "\01?a2@@YAHXZ"

const int a3() { return 0; }
// CHECK: "\01?a3@@YA?BHXZ"

volatile int a4() { return 0; }
// CHECK: "\01?a4@@YA?CHXZ"

const volatile int a5() { return 0; }
// CHECK: "\01?a5@@YA?DHXZ"

float a6() { return 0.0f; }
// CHECK: "\01?a6@@YAMXZ"

int *b1() { return 0; }
// CHECK: "\01?b1@@YAPAHXZ"

const char *b2() { return 0; }
// CHECK: "\01?b2@@YAPBDXZ"

float *b3() { return 0; }
// CHECK: "\01?b3@@YAPAMXZ"

const float *b4() { return 0; }
// CHECK: "\01?b4@@YAPBMXZ"

volatile float *b5() { return 0; }
// CHECK: "\01?b5@@YAPCMXZ"

const volatile float *b6() { return 0; }
// CHECK: "\01?b6@@YAPDMXZ"

float &b7() { return *(float*)0; }
// CHECK: "\01?b7@@YAAAMXZ"

const float &b8() { return *(float*)0; }
// CHECK: "\01?b8@@YAABMXZ"

volatile float &b9() { return *(float*)0; }
// CHECK: "\01?b9@@YAACMXZ"

const volatile float &b10() { return *(float*)0; }
// CHECK: "\01?b10@@YAADMXZ"

const char** b11() { return 0; }
// CHECK: "\01?b11@@YAPAPBDXZ"

class A {};

A c1() { return A(); }
// CHECK: "\01?c1@@YA?AVA@@XZ"

const A c2() { return A(); }
// CHECK: "\01?c2@@YA?BVA@@XZ"

volatile A c3() { return A(); }
// CHECK: "\01?c3@@YA?CVA@@XZ"

const volatile A c4() { return A(); }
// CHECK: "\01?c4@@YA?DVA@@XZ"

const A* c5() { return 0; }
// CHECK: "\01?c5@@YAPBVA@@XZ"

volatile A* c6() { return 0; }
// CHECK: "\01?c6@@YAPCVA@@XZ"

const volatile A* c7() { return 0; }
// CHECK: "\01?c7@@YAPDVA@@XZ"

A &c8() { return *(A*)0; }
// CHECK: "\01?c8@@YAAAVA@@XZ"

const A &c9() { return *(A*)0; }
// CHECK: "\01?c9@@YAABVA@@XZ"

volatile A &c10() { return *(A*)0; }
// CHECK: "\01?c10@@YAACVA@@XZ"

const volatile A &c11() { return *(A*)0; }
// CHECK: "\01?c11@@YAADVA@@XZ"

template<typename T> class B {};

B<int> d1() { return B<int>(); }
// CHECK: "\01?d1@@YA?AV?$B@H@@XZ"

B<const char*> d2() {return B<const char*>(); }
// CHECK: "\01?d2@@YA?AV?$B@PBD@@XZ"

B<A> d3() {return B<A>(); }
// CHECK: "\01?d3@@YA?AV?$B@VA@@@@XZ"

B<A>* d4() { return 0; }
// CHECK: "\01?d4@@YAPAV?$B@VA@@@@XZ"

const B<A>* d5() { return 0; }
// CHECK: "\01?d5@@YAPBV?$B@VA@@@@XZ"

volatile B<A>* d6() { return 0; }
// CHECK: "\01?d6@@YAPCV?$B@VA@@@@XZ"

const volatile B<A>* d7() { return 0; }
// CHECK: "\01?d7@@YAPDV?$B@VA@@@@XZ"

B<A>& d8() { return *(B<A>*)0; }
// CHECK: "\01?d8@@YAAAV?$B@VA@@@@XZ"

const B<A>& d9() { return *(B<A>*)0; }
// CHECK: "\01?d9@@YAABV?$B@VA@@@@XZ"

volatile B<A>& d10() { return *(B<A>*)0; }
// CHECK: "\01?d10@@YAACV?$B@VA@@@@XZ"

const volatile B<A>& d11() { return *(B<A>*)0; }
// CHECK: "\01?d11@@YAADV?$B@VA@@@@XZ"

enum Enum { DEFAULT };

Enum e1() { return DEFAULT; }
// CHECK: "\01?e1@@YA?AW4Enum@@XZ"

const Enum e2() { return DEFAULT; }
// CHECK: "\01?e2@@YA?BW4Enum@@XZ"

Enum* e3() { return 0; }
// CHECK: "\01?e3@@YAPAW4Enum@@XZ"

Enum& e4() { return *(Enum*)0; }
// CHECK: "\01?e4@@YAAAW4Enum@@XZ"

struct S {};

struct S f1() { struct S s; return s; }
// CHECK: "\01?f1@@YA?AUS@@XZ"

const struct S f2() { struct S s; return s; }
// CHECK: "\01?f2@@YA?BUS@@XZ"

struct S* f3() { return 0; }
// CHECK: "\01?f3@@YAPAUS@@XZ"

const struct S* f4() { return 0; }
// CHECK: "\01?f4@@YAPBUS@@XZ"

const volatile struct S* f5() { return 0; }
// CHECK: "\01?f5@@YAPDUS@@XZ"

struct S& f6() { return *(struct S*)0; }
// CHECK: "\01?f6@@YAAAUS@@XZ"

struct S* const f7() { return 0; }
// CHECK: "\01?f7@@YAQAUS@@XZ"

int S::* f8() { return 0; }
// CHECK: "\01?f8@@YAPQS@@HXZ"

int S::* const f9() { return 0; }
// CHECK: "\01?f9@@YAQQS@@HXZ"

int S::* __restrict f10() { return 0; }
// CHECK: "\01?f10@@YAPIQS@@HXZ"

int S::* const __restrict f11() { return 0; }
// CHECK: "\01?f11@@YAQIQS@@HXZ"

typedef int (*function_pointer)(int);

function_pointer g1() { return 0; }
// CHECK: "\01?g1@@YAP6AHH@ZXZ"

const function_pointer g2() { return 0; }
// CHECK: "\01?g2@@YAQ6AHH@ZXZ"

function_pointer* g3() { return 0; }
// CHECK: "\01?g3@@YAPAP6AHH@ZXZ"

const function_pointer* g4() { return 0; }
// CHECK: "\01?g4@@YAPBQ6AHH@ZXZ"