1//===-- BuiltinTypes.def - Metadata about BuiltinTypes ----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the database about various builtin singleton types.
10//
11// BuiltinType::Id is the enumerator defining the type.
12//
13// Context.SingletonId is the global singleton of this type. Some global
14// singletons are shared by multiple types.
15//
16// BUILTIN_TYPE(Id, SingletonId) - A builtin type that has not been
17// covered by any other #define. Defining this macro covers all
18// the builtins.
19//
20// SIGNED_TYPE(Id, SingletonId) - A signed integral type.
21//
22// UNSIGNED_TYPE(Id, SingletonId) - An unsigned integral type.
23//
24// FLOATING_TYPE(Id, SingletonId) - A floating-point type.
25//
26// PLACEHOLDER_TYPE(Id, SingletonId) - A placeholder type. Placeholder
27// types are used to perform context-sensitive checking of specific
28// forms of expression.
29//
30// SHARED_SINGLETON_TYPE(Expansion) - The given expansion corresponds
31// to a builtin which uses a shared singleton type.
32//
33//===----------------------------------------------------------------------===//
34
35#ifndef SIGNED_TYPE
36#define SIGNED_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
37#endif
38
39#ifndef UNSIGNED_TYPE
40#define UNSIGNED_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
41#endif
42
43#ifndef FLOATING_TYPE
44#define FLOATING_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
45#endif
46
47#ifndef PLACEHOLDER_TYPE
48#define PLACEHOLDER_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
49#endif
50
51#ifndef SHARED_SINGLETON_TYPE
52#define SHARED_SINGLETON_TYPE(Expansion) Expansion
53#endif
54
55//===- Builtin Types ------------------------------------------------------===//
56
57// void
58BUILTIN_TYPE(Void, VoidTy)
59
60//===- Unsigned Types -----------------------------------------------------===//
61
62// 'bool' in C++, '_Bool' in C99
63UNSIGNED_TYPE(Bool, BoolTy)
64
65// 'char' for targets where it's unsigned
66SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(Char_U, CharTy))
67
68// 'unsigned char', explicitly qualified
69UNSIGNED_TYPE(UChar, UnsignedCharTy)
70
71// 'wchar_t' for targets where it's unsigned
72SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))
73
74// 'char8_t' in C++20 (proposed)
75UNSIGNED_TYPE(Char8, Char8Ty)
76
77// 'char16_t' in C++
78UNSIGNED_TYPE(Char16, Char16Ty)
79
80// 'char32_t' in C++
81UNSIGNED_TYPE(Char32, Char32Ty)
82
83// 'unsigned short'
84UNSIGNED_TYPE(UShort, UnsignedShortTy)
85
86// 'unsigned int'
87UNSIGNED_TYPE(UInt, UnsignedIntTy)
88
89// 'unsigned long'
90UNSIGNED_TYPE(ULong, UnsignedLongTy)
91
92// 'unsigned long long'
93UNSIGNED_TYPE(ULongLong, UnsignedLongLongTy)
94
95// '__uint128_t'
96UNSIGNED_TYPE(UInt128, UnsignedInt128Ty)
97
98//===- Signed Types -------------------------------------------------------===//
99
100// 'char' for targets where it's signed
101SHARED_SINGLETON_TYPE(SIGNED_TYPE(Char_S, CharTy))
102
103// 'signed char', explicitly qualified
104SIGNED_TYPE(SChar, SignedCharTy)
105
106// 'wchar_t' for targets where it's signed
107SHARED_SINGLETON_TYPE(SIGNED_TYPE(WChar_S, WCharTy))
108
109// 'short' or 'signed short'
110SIGNED_TYPE(Short, ShortTy)
111
112// 'int' or 'signed int'
113SIGNED_TYPE(Int, IntTy)
114
115// 'long' or 'signed long'
116SIGNED_TYPE(Long, LongTy)
117
118// 'long long' or 'signed long long'
119SIGNED_TYPE(LongLong, LongLongTy)
120
121// '__int128_t'
122SIGNED_TYPE(Int128, Int128Ty)
123
124//===- Fixed point types --------------------------------------------------===//
125
126// 'short _Accum'
127SIGNED_TYPE(ShortAccum, ShortAccumTy)
128
129// '_Accum'
130SIGNED_TYPE(Accum, AccumTy)
131
132// 'long _Accum'
133SIGNED_TYPE(LongAccum, LongAccumTy)
134
135// 'unsigned short _Accum'
136UNSIGNED_TYPE(UShortAccum, UnsignedShortAccumTy)
137
138// 'unsigned _Accum'
139UNSIGNED_TYPE(UAccum, UnsignedAccumTy)
140
141// 'unsigned long _Accum'
142UNSIGNED_TYPE(ULongAccum, UnsignedLongAccumTy)
143
144// 'short _Fract'
145SIGNED_TYPE(ShortFract, ShortFractTy)
146
147// '_Fract'
148SIGNED_TYPE(Fract, FractTy)
149
150// 'long _Fract'
151SIGNED_TYPE(LongFract, LongFractTy)
152
153// 'unsigned short _Fract'
154UNSIGNED_TYPE(UShortFract, UnsignedShortFractTy)
155
156// 'unsigned _Fract'
157UNSIGNED_TYPE(UFract, UnsignedFractTy)
158
159// 'unsigned long _Fract'
160UNSIGNED_TYPE(ULongFract, UnsignedLongFractTy)
161
162// '_Sat short _Accum'
163SIGNED_TYPE(SatShortAccum, SatShortAccumTy)
164
165// '_Sat _Accum'
166SIGNED_TYPE(SatAccum, SatAccumTy)
167
168// '_Sat long _Accum'
169SIGNED_TYPE(SatLongAccum, SatLongAccumTy)
170
171// '_Sat unsigned short _Accum'
172UNSIGNED_TYPE(SatUShortAccum, SatUnsignedShortAccumTy)
173
174// '_Sat unsigned _Accum'
175UNSIGNED_TYPE(SatUAccum, SatUnsignedAccumTy)
176
177// '_Sat unsigned long _Accum'
178UNSIGNED_TYPE(SatULongAccum, SatUnsignedLongAccumTy)
179
180// '_Sat short _Fract'
181SIGNED_TYPE(SatShortFract, SatShortFractTy)
182
183// '_Sat _Fract'
184SIGNED_TYPE(SatFract, SatFractTy)
185
186// '_Sat long _Fract'
187SIGNED_TYPE(SatLongFract, SatLongFractTy)
188
189// '_Sat unsigned short _Fract'
190UNSIGNED_TYPE(SatUShortFract, SatUnsignedShortFractTy)
191
192// '_Sat unsigned _Fract'
193UNSIGNED_TYPE(SatUFract, SatUnsignedFractTy)
194
195// '_Sat unsigned long _Fract'
196UNSIGNED_TYPE(SatULongFract, SatUnsignedLongFractTy)
197
198//===- Floating point types -----------------------------------------------===//
199
200// 'half' in OpenCL, '__fp16' in ARM NEON.
201FLOATING_TYPE(Half, HalfTy)
202
203// 'float'
204FLOATING_TYPE(Float, FloatTy)
205
206// 'double'
207FLOATING_TYPE(Double, DoubleTy)
208
209// 'long double'
210FLOATING_TYPE(LongDouble, LongDoubleTy)
211
212// '_Float16'
213FLOATING_TYPE(Float16, HalfTy)
214
215// '__bf16'
216FLOATING_TYPE(BFloat16, BFloat16Ty)
217
218// '__float128'
219FLOATING_TYPE(Float128, Float128Ty)
220
221//===- Language-specific types --------------------------------------------===//
222
223// This is the type of C++0x 'nullptr'.
224BUILTIN_TYPE(NullPtr, NullPtrTy)
225
226// The primitive Objective C 'id' type. The user-visible 'id'
227// type is a typedef of an ObjCObjectPointerType to an
228// ObjCObjectType with this as its base. In fact, this only ever
229// shows up in an AST as the base type of an ObjCObjectType.
230BUILTIN_TYPE(ObjCId, ObjCBuiltinIdTy)
231
232// The primitive Objective C 'Class' type. The user-visible
233// 'Class' type is a typedef of an ObjCObjectPointerType to an
234// ObjCObjectType with this as its base. In fact, this only ever
235// shows up in an AST as the base type of an ObjCObjectType.
236BUILTIN_TYPE(ObjCClass, ObjCBuiltinClassTy)
237
238// The primitive Objective C 'SEL' type. The user-visible 'SEL'
239// type is a typedef of a PointerType to this.
240BUILTIN_TYPE(ObjCSel, ObjCBuiltinSelTy)
241
242// OpenCL sampler_t.
243BUILTIN_TYPE(OCLSampler, OCLSamplerTy)
244
245// OpenCL event_t.
246BUILTIN_TYPE(OCLEvent, OCLEventTy)
247
248// OpenCL clk_event_t.
249BUILTIN_TYPE(OCLClkEvent, OCLClkEventTy)
250
251// OpenCL queue_t.
252BUILTIN_TYPE(OCLQueue, OCLQueueTy)
253
254// OpenCL reserve_id_t.
255BUILTIN_TYPE(OCLReserveID, OCLReserveIDTy)
256
257// This represents the type of an expression whose type is
258// totally unknown, e.g. 'T::foo'. It is permitted for this to
259// appear in situations where the structure of the type is
260// theoretically deducible.
261BUILTIN_TYPE(Dependent, DependentTy)
262
263// The type of an unresolved overload set. A placeholder type.
264// Expressions with this type have one of the following basic
265// forms, with parentheses generally permitted:
266// foo # possibly qualified, not if an implicit access
267// foo # possibly qualified, not if an implicit access
268// &foo # possibly qualified, not if an implicit access
269// x->foo # only if might be a static member function
270// &x->foo # only if might be a static member function
271// &Class::foo # when a pointer-to-member; sub-expr also has this type
272// OverloadExpr::find can be used to analyze the expression.
273//
274// Overload should be the first placeholder type, or else change
275// BuiltinType::isNonOverloadPlaceholderType()
276PLACEHOLDER_TYPE(Overload, OverloadTy)
277
278// The type of a bound C++ non-static member function.
279// A placeholder type. Expressions with this type have one of the
280// following basic forms:
281// foo # if an implicit access
282// x->foo # if only contains non-static members
283PLACEHOLDER_TYPE(BoundMember, BoundMemberTy)
284
285// The type of an expression which refers to a pseudo-object,
286// such as those introduced by Objective C's @property or
287// VS.NET's __property declarations. A placeholder type. The
288// pseudo-object is actually accessed by emitting a call to
289// some sort of function or method; typically there is a pair
290// of a setter and a getter, with the setter used if the
291// pseudo-object reference is used syntactically as the
292// left-hand-side of an assignment operator.
293//
294// A pseudo-object reference naming an Objective-C @property is
295// always a dot access with a base of object-pointer type,
296// e.g. 'x.foo'.
297//
298// In VS.NET, a __property declaration creates an implicit
299// member with an associated name, which can then be named
300// in any of the normal ways an ordinary member could be.
301PLACEHOLDER_TYPE(PseudoObject, PseudoObjectTy)
302
303// __builtin_any_type. A placeholder type. Useful for clients
304// like debuggers that don't know what type to give something.
305// Only a small number of operations are valid on expressions of
306// unknown type, most notably explicit casts.
307PLACEHOLDER_TYPE(UnknownAny, UnknownAnyTy)
308
309PLACEHOLDER_TYPE(BuiltinFn, BuiltinFnTy)
310
311// The type of a cast which, in ARC, would normally require a
312// __bridge, but which might be okay depending on the immediate
313// context.
314PLACEHOLDER_TYPE(ARCUnbridgedCast, ARCUnbridgedCastTy)
315
316// A placeholder type for incomplete matrix index expressions.
317PLACEHOLDER_TYPE(IncompleteMatrixIdx, IncompleteMatrixIdxTy)
318
319// A placeholder type for OpenMP array sections.
320PLACEHOLDER_TYPE(OMPArraySection, OMPArraySectionTy)
321
322// A placeholder type for OpenMP array shaping operation.
323PLACEHOLDER_TYPE(OMPArrayShaping, OMPArrayShapingTy)
324
325// A placeholder type for OpenMP iterators.
326PLACEHOLDER_TYPE(OMPIterator, OMPIteratorTy)
327
328#ifdef LAST_BUILTIN_TYPE
329LAST_BUILTIN_TYPE(OMPIterator)
330#undef LAST_BUILTIN_TYPE
331#endif
332
333#undef SHARED_SINGLETON_TYPE
334#undef PLACEHOLDER_TYPE
335#undef FLOATING_TYPE
336#undef SIGNED_TYPE
337#undef UNSIGNED_TYPE
338#undef BUILTIN_TYPE
339