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