summaryrefslogtreecommitdiffstats
path: root/include/clang/AST/BuiltinTypes.def
blob: 74a45ee4ccc0faf5b2b8469c987d4870d88c23c1 (plain)
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
//===-- BuiltinTypes.def - Metadata about BuiltinTypes ----------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
//  This file defines the database about various builtin singleton types.
//
//  BuiltinType::Id is the enumerator defining the type.
//
//  Context.SingletonId is the global singleton of this type.  Some global
//  singletons are shared by multiple types.
//
//    BUILTIN_TYPE(Id, SingletonId) - A builtin type that has not been
//    covered by any other #define.  Defining this macro covers all
//    the builtins.
//
//    SIGNED_TYPE(Id, SingletonId) - A signed integral type.
//
//    UNSIGNED_TYPE(Id, SingletonId) - An unsigned integral type.
//
//    FLOATING_TYPE(Id, SingletonId) - A floating-point type.
//
//    PLACEHOLDER_TYPE(Id, SingletonId) - A placeholder type.  Placeholder
//    types are used to perform context-sensitive checking of specific
//    forms of expression.
//
//    SHARED_SINGLETON_TYPE(Expansion) - The given expansion corresponds
//    to a builtin which uses a shared singleton type.
//
//===----------------------------------------------------------------------===//

#ifndef SIGNED_TYPE
#define SIGNED_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
#endif

#ifndef UNSIGNED_TYPE
#define UNSIGNED_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
#endif

#ifndef FLOATING_TYPE
#define FLOATING_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
#endif

#ifndef PLACEHOLDER_TYPE
#define PLACEHOLDER_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
#endif

#ifndef SHARED_SINGLETON_TYPE
#define SHARED_SINGLETON_TYPE(Expansion) Expansion
#endif

//===- Builtin Types ------------------------------------------------------===//

// void
BUILTIN_TYPE(Void, VoidTy)

//===- Unsigned Types -----------------------------------------------------===//

// 'bool' in C++, '_Bool' in C99
UNSIGNED_TYPE(Bool, BoolTy)

// 'char' for targets where it's unsigned
SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(Char_U, CharTy))

// 'unsigned char', explicitly qualified
UNSIGNED_TYPE(UChar, UnsignedCharTy)

// 'wchar_t' for targets where it's unsigned
SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))

// 'char8_t' in C++20 (proposed)
UNSIGNED_TYPE(Char8, Char8Ty)

// 'char16_t' in C++
UNSIGNED_TYPE(Char16, Char16Ty)

// 'char32_t' in C++
UNSIGNED_TYPE(Char32, Char32Ty)

// 'unsigned short'
UNSIGNED_TYPE(UShort, UnsignedShortTy)

// 'unsigned int'
UNSIGNED_TYPE(UInt, UnsignedIntTy)

// 'unsigned long'
UNSIGNED_TYPE(ULong, UnsignedLongTy)

// 'unsigned long long'
UNSIGNED_TYPE(ULongLong, UnsignedLongLongTy)

// '__uint128_t'
UNSIGNED_TYPE(UInt128, UnsignedInt128Ty)

//===- Signed Types -------------------------------------------------------===//

// 'char' for targets where it's signed
SHARED_SINGLETON_TYPE(SIGNED_TYPE(Char_S, CharTy))

// 'signed char', explicitly qualified
SIGNED_TYPE(SChar, SignedCharTy)

// 'wchar_t' for targets where it's signed
SHARED_SINGLETON_TYPE(SIGNED_TYPE(WChar_S, WCharTy))

// 'short' or 'signed short'
SIGNED_TYPE(Short, ShortTy)

// 'int' or 'signed int'
SIGNED_TYPE(Int, IntTy)

// 'long' or 'signed long'
SIGNED_TYPE(Long, LongTy)

// 'long long' or 'signed long long'
SIGNED_TYPE(LongLong, LongLongTy)

// '__int128_t'
SIGNED_TYPE(Int128, Int128Ty)

//===- Fixed point types --------------------------------------------------===//

// 'short _Accum'
SIGNED_TYPE(ShortAccum, ShortAccumTy)

// '_Accum'
SIGNED_TYPE(Accum, AccumTy)

// 'long _Accum'
SIGNED_TYPE(LongAccum, LongAccumTy)

// 'unsigned short _Accum'
UNSIGNED_TYPE(UShortAccum, UnsignedShortAccumTy)

// 'unsigned _Accum'
UNSIGNED_TYPE(UAccum, UnsignedAccumTy)

// 'unsigned long _Accum'
UNSIGNED_TYPE(ULongAccum, UnsignedLongAccumTy)

// 'short _Fract'
SIGNED_TYPE(ShortFract, ShortFractTy)

// '_Fract'
SIGNED_TYPE(Fract, FractTy)

// 'long _Fract'
SIGNED_TYPE(LongFract, LongFractTy)

// 'unsigned short _Fract'
UNSIGNED_TYPE(UShortFract, UnsignedShortFractTy)

// 'unsigned _Fract'
UNSIGNED_TYPE(UFract, UnsignedFractTy)

// 'unsigned long _Fract'
UNSIGNED_TYPE(ULongFract, UnsignedLongFractTy)

// '_Sat short _Accum'
SIGNED_TYPE(SatShortAccum, SatShortAccumTy)

// '_Sat _Accum'
SIGNED_TYPE(SatAccum, SatAccumTy)

// '_Sat long _Accum'
SIGNED_TYPE(SatLongAccum, SatLongAccumTy)

// '_Sat unsigned short _Accum'
UNSIGNED_TYPE(SatUShortAccum, SatUnsignedShortAccumTy)

// '_Sat unsigned _Accum'
UNSIGNED_TYPE(SatUAccum, SatUnsignedAccumTy)

// '_Sat unsigned long _Accum'
UNSIGNED_TYPE(SatULongAccum, SatUnsignedLongAccumTy)

// '_Sat short _Fract'
SIGNED_TYPE(SatShortFract, SatShortFractTy)

// '_Sat _Fract'
SIGNED_TYPE(SatFract, SatFractTy)

// '_Sat long _Fract'
SIGNED_TYPE(SatLongFract, SatLongFractTy)

// '_Sat unsigned short _Fract'
UNSIGNED_TYPE(SatUShortFract, SatUnsignedShortFractTy)

// '_Sat unsigned _Fract'
UNSIGNED_TYPE(SatUFract, SatUnsignedFractTy)

// '_Sat unsigned long _Fract'
UNSIGNED_TYPE(SatULongFract, SatUnsignedLongFractTy)

//===- Floating point types -----------------------------------------------===//

// 'half' in OpenCL, '__fp16' in ARM NEON.
FLOATING_TYPE(Half, HalfTy)

// 'float'
FLOATING_TYPE(Float, FloatTy)

// 'double'
FLOATING_TYPE(Double, DoubleTy)

// 'long double'
FLOATING_TYPE(LongDouble, LongDoubleTy)

// '_Float16'
FLOATING_TYPE(Float16, HalfTy)

// '__float128'
FLOATING_TYPE(Float128, Float128Ty)

//===- Language-specific types --------------------------------------------===//

// This is the type of C++0x 'nullptr'.
BUILTIN_TYPE(NullPtr, NullPtrTy)

// The primitive Objective C 'id' type.  The user-visible 'id'
// type is a typedef of an ObjCObjectPointerType to an
// ObjCObjectType with this as its base.  In fact, this only ever
// shows up in an AST as the base type of an ObjCObjectType.
BUILTIN_TYPE(ObjCId, ObjCBuiltinIdTy)

// The primitive Objective C 'Class' type.  The user-visible
// 'Class' type is a typedef of an ObjCObjectPointerType to an
// ObjCObjectType with this as its base.  In fact, this only ever
// shows up in an AST as the base type of an ObjCObjectType.
BUILTIN_TYPE(ObjCClass, ObjCBuiltinClassTy)

// The primitive Objective C 'SEL' type.  The user-visible 'SEL'
// type is a typedef of a PointerType to this.
BUILTIN_TYPE(ObjCSel, ObjCBuiltinSelTy)

// OpenCL sampler_t.
BUILTIN_TYPE(OCLSampler, OCLSamplerTy)

// OpenCL event_t.
BUILTIN_TYPE(OCLEvent, OCLEventTy)

// OpenCL clk_event_t.
BUILTIN_TYPE(OCLClkEvent, OCLClkEventTy)

// OpenCL queue_t.
BUILTIN_TYPE(OCLQueue, OCLQueueTy)

// OpenCL reserve_id_t.
BUILTIN_TYPE(OCLReserveID, OCLReserveIDTy)

// This represents the type of an expression whose type is
// totally unknown, e.g. 'T::foo'.  It is permitted for this to
// appear in situations where the structure of the type is
// theoretically deducible.
BUILTIN_TYPE(Dependent, DependentTy)

// The type of an unresolved overload set.  A placeholder type.
// Expressions with this type have one of the following basic
// forms, with parentheses generally permitted:
//   foo          # possibly qualified, not if an implicit access
//   foo          # possibly qualified, not if an implicit access
//   &foo         # possibly qualified, not if an implicit access
//   x->foo       # only if might be a static member function
//   &x->foo      # only if might be a static member function
//   &Class::foo  # when a pointer-to-member; sub-expr also has this type
// OverloadExpr::find can be used to analyze the expression.
//
// Overload should be the first placeholder type, or else change
// BuiltinType::isNonOverloadPlaceholderType()
PLACEHOLDER_TYPE(Overload, OverloadTy)

// The type of a bound C++ non-static member function.
// A placeholder type.  Expressions with this type have one of the
// following basic forms:
//   foo          # if an implicit access
//   x->foo       # if only contains non-static members
PLACEHOLDER_TYPE(BoundMember, BoundMemberTy)

// The type of an expression which refers to a pseudo-object,
// such as those introduced by Objective C's @property or
// VS.NET's __property declarations.  A placeholder type.  The
// pseudo-object is actually accessed by emitting a call to
// some sort of function or method;  typically there is a pair
// of a setter and a getter, with the setter used if the
// pseudo-object reference is used syntactically as the
// left-hand-side of an assignment operator.
//
// A pseudo-object reference naming an Objective-C @property is
// always a dot access with a base of object-pointer type,
// e.g. 'x.foo'.
//
// In VS.NET, a __property declaration creates an implicit
// member with an associated name, which can then be named
// in any of the normal ways an ordinary member could be.
PLACEHOLDER_TYPE(PseudoObject, PseudoObjectTy)

// __builtin_any_type.  A placeholder type.  Useful for clients
// like debuggers that don't know what type to give something.
// Only a small number of operations are valid on expressions of
// unknown type, most notably explicit casts.
PLACEHOLDER_TYPE(UnknownAny, UnknownAnyTy)

PLACEHOLDER_TYPE(BuiltinFn, BuiltinFnTy)

// The type of a cast which, in ARC, would normally require a
// __bridge, but which might be okay depending on the immediate
// context.
PLACEHOLDER_TYPE(ARCUnbridgedCast, ARCUnbridgedCastTy)

// A placeholder type for OpenMP array sections.
PLACEHOLDER_TYPE(OMPArraySection, OMPArraySectionTy)

#ifdef LAST_BUILTIN_TYPE
LAST_BUILTIN_TYPE(OMPArraySection)
#undef LAST_BUILTIN_TYPE
#endif

#undef SHARED_SINGLETON_TYPE
#undef PLACEHOLDER_TYPE
#undef FLOATING_TYPE
#undef SIGNED_TYPE
#undef UNSIGNED_TYPE
#undef BUILTIN_TYPE