1 //===-- BuiltinTypes.def - Metadata about BuiltinTypes ----------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file defines the database about various builtin singleton types.
11 // BuiltinType::Id is the enumerator defining the type.
13 // Context.SingletonId is the global singleton of this type. Some global
14 // singletons are shared by multiple types.
16 // BUILTIN_TYPE(Id, SingletonId) - A builtin type that has not been
17 // covered by any other #define. Defining this macro covers all
20 // SIGNED_TYPE(Id, SingletonId) - A signed integral type.
22 // UNSIGNED_TYPE(Id, SingletonId) - An unsigned integral type.
24 // FLOATING_TYPE(Id, SingletonId) - A floating-point type.
26 // PLACEHOLDER_TYPE(Id, SingletonId) - A placeholder type. Placeholder
27 // types are used to perform context-sensitive checking of specific
28 // forms of expression.
30 // SHARED_SINGLETON_TYPE(Expansion) - The given expansion corresponds
31 // to a builtin which uses a shared singleton type.
33 //===----------------------------------------------------------------------===//
36 #define SIGNED_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
40 #define UNSIGNED_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
44 #define FLOATING_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
47 #ifndef PLACEHOLDER_TYPE
48 #define PLACEHOLDER_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
51 #ifndef SHARED_SINGLETON_TYPE
52 #define SHARED_SINGLETON_TYPE(Expansion) Expansion
55 //===- Builtin Types ------------------------------------------------------===//
58 BUILTIN_TYPE(Void, VoidTy)
60 //===- Unsigned Types -----------------------------------------------------===//
62 // 'bool' in C++, '_Bool' in C99
63 UNSIGNED_TYPE(Bool, BoolTy)
65 // 'char' for targets where it's unsigned
66 SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(Char_U, CharTy))
68 // 'unsigned char', explicitly qualified
69 UNSIGNED_TYPE(UChar, UnsignedCharTy)
71 // 'wchar_t' for targets where it's unsigned
72 SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))
74 // 'char8_t' in C++20 (proposed)
75 UNSIGNED_TYPE(Char8, Char8Ty)
78 UNSIGNED_TYPE(Char16, Char16Ty)
81 UNSIGNED_TYPE(Char32, Char32Ty)
84 UNSIGNED_TYPE(UShort, UnsignedShortTy)
87 UNSIGNED_TYPE(UInt, UnsignedIntTy)
90 UNSIGNED_TYPE(ULong, UnsignedLongTy)
92 // 'unsigned long long'
93 UNSIGNED_TYPE(ULongLong, UnsignedLongLongTy)
96 UNSIGNED_TYPE(UInt128, UnsignedInt128Ty)
98 //===- Signed Types -------------------------------------------------------===//
100 // 'char' for targets where it's signed
101 SHARED_SINGLETON_TYPE(SIGNED_TYPE(Char_S, CharTy))
103 // 'signed char', explicitly qualified
104 SIGNED_TYPE(SChar, SignedCharTy)
106 // 'wchar_t' for targets where it's signed
107 SHARED_SINGLETON_TYPE(SIGNED_TYPE(WChar_S, WCharTy))
109 // 'short' or 'signed short'
110 SIGNED_TYPE(Short, ShortTy)
112 // 'int' or 'signed int'
113 SIGNED_TYPE(Int, IntTy)
115 // 'long' or 'signed long'
116 SIGNED_TYPE(Long, LongTy)
118 // 'long long' or 'signed long long'
119 SIGNED_TYPE(LongLong, LongLongTy)
122 SIGNED_TYPE(Int128, Int128Ty)
124 //===- Fixed point types --------------------------------------------------===//
127 SIGNED_TYPE(ShortAccum, ShortAccumTy)
130 SIGNED_TYPE(Accum, AccumTy)
133 SIGNED_TYPE(LongAccum, LongAccumTy)
135 // 'unsigned short _Accum'
136 UNSIGNED_TYPE(UShortAccum, UnsignedShortAccumTy)
139 UNSIGNED_TYPE(UAccum, UnsignedAccumTy)
141 // 'unsigned long _Accum'
142 UNSIGNED_TYPE(ULongAccum, UnsignedLongAccumTy)
145 SIGNED_TYPE(ShortFract, ShortFractTy)
148 SIGNED_TYPE(Fract, FractTy)
151 SIGNED_TYPE(LongFract, LongFractTy)
153 // 'unsigned short _Fract'
154 UNSIGNED_TYPE(UShortFract, UnsignedShortFractTy)
157 UNSIGNED_TYPE(UFract, UnsignedFractTy)
159 // 'unsigned long _Fract'
160 UNSIGNED_TYPE(ULongFract, UnsignedLongFractTy)
162 // '_Sat short _Accum'
163 SIGNED_TYPE(SatShortAccum, SatShortAccumTy)
166 SIGNED_TYPE(SatAccum, SatAccumTy)
168 // '_Sat long _Accum'
169 SIGNED_TYPE(SatLongAccum, SatLongAccumTy)
171 // '_Sat unsigned short _Accum'
172 UNSIGNED_TYPE(SatUShortAccum, SatUnsignedShortAccumTy)
174 // '_Sat unsigned _Accum'
175 UNSIGNED_TYPE(SatUAccum, SatUnsignedAccumTy)
177 // '_Sat unsigned long _Accum'
178 UNSIGNED_TYPE(SatULongAccum, SatUnsignedLongAccumTy)
180 // '_Sat short _Fract'
181 SIGNED_TYPE(SatShortFract, SatShortFractTy)
184 SIGNED_TYPE(SatFract, SatFractTy)
186 // '_Sat long _Fract'
187 SIGNED_TYPE(SatLongFract, SatLongFractTy)
189 // '_Sat unsigned short _Fract'
190 UNSIGNED_TYPE(SatUShortFract, SatUnsignedShortFractTy)
192 // '_Sat unsigned _Fract'
193 UNSIGNED_TYPE(SatUFract, SatUnsignedFractTy)
195 // '_Sat unsigned long _Fract'
196 UNSIGNED_TYPE(SatULongFract, SatUnsignedLongFractTy)
198 //===- Floating point types -----------------------------------------------===//
200 // 'half' in OpenCL, '__fp16' in ARM NEON.
201 FLOATING_TYPE(Half, HalfTy)
204 FLOATING_TYPE(Float, FloatTy)
207 FLOATING_TYPE(Double, DoubleTy)
210 FLOATING_TYPE(LongDouble, LongDoubleTy)
213 FLOATING_TYPE(Float16, HalfTy)
216 FLOATING_TYPE(Float128, Float128Ty)
218 //===- Language-specific types --------------------------------------------===//
220 // This is the type of C++0x 'nullptr'.
221 BUILTIN_TYPE(NullPtr, NullPtrTy)
223 // The primitive Objective C 'id' type. The user-visible 'id'
224 // type is a typedef of an ObjCObjectPointerType to an
225 // ObjCObjectType with this as its base. In fact, this only ever
226 // shows up in an AST as the base type of an ObjCObjectType.
227 BUILTIN_TYPE(ObjCId, ObjCBuiltinIdTy)
229 // The primitive Objective C 'Class' type. The user-visible
230 // 'Class' 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(ObjCClass, ObjCBuiltinClassTy)
235 // The primitive Objective C 'SEL' type. The user-visible 'SEL'
236 // type is a typedef of a PointerType to this.
237 BUILTIN_TYPE(ObjCSel, ObjCBuiltinSelTy)
240 BUILTIN_TYPE(OCLSampler, OCLSamplerTy)
243 BUILTIN_TYPE(OCLEvent, OCLEventTy)
245 // OpenCL clk_event_t.
246 BUILTIN_TYPE(OCLClkEvent, OCLClkEventTy)
249 BUILTIN_TYPE(OCLQueue, OCLQueueTy)
251 // OpenCL reserve_id_t.
252 BUILTIN_TYPE(OCLReserveID, OCLReserveIDTy)
254 // This represents the type of an expression whose type is
255 // totally unknown, e.g. 'T::foo'. It is permitted for this to
256 // appear in situations where the structure of the type is
257 // theoretically deducible.
258 BUILTIN_TYPE(Dependent, DependentTy)
260 // The type of an unresolved overload set. A placeholder type.
261 // Expressions with this type have one of the following basic
262 // forms, with parentheses generally permitted:
263 // foo # possibly qualified, not if an implicit access
264 // foo # possibly qualified, not if an implicit access
265 // &foo # possibly qualified, not if an implicit access
266 // x->foo # only if might be a static member function
267 // &x->foo # only if might be a static member function
268 // &Class::foo # when a pointer-to-member; sub-expr also has this type
269 // OverloadExpr::find can be used to analyze the expression.
271 // Overload should be the first placeholder type, or else change
272 // BuiltinType::isNonOverloadPlaceholderType()
273 PLACEHOLDER_TYPE(Overload, OverloadTy)
275 // The type of a bound C++ non-static member function.
276 // A placeholder type. Expressions with this type have one of the
277 // following basic forms:
278 // foo # if an implicit access
279 // x->foo # if only contains non-static members
280 PLACEHOLDER_TYPE(BoundMember, BoundMemberTy)
282 // The type of an expression which refers to a pseudo-object,
283 // such as those introduced by Objective C's @property or
284 // VS.NET's __property declarations. A placeholder type. The
285 // pseudo-object is actually accessed by emitting a call to
286 // some sort of function or method; typically there is a pair
287 // of a setter and a getter, with the setter used if the
288 // pseudo-object reference is used syntactically as the
289 // left-hand-side of an assignment operator.
291 // A pseudo-object reference naming an Objective-C @property is
292 // always a dot access with a base of object-pointer type,
295 // In VS.NET, a __property declaration creates an implicit
296 // member with an associated name, which can then be named
297 // in any of the normal ways an ordinary member could be.
298 PLACEHOLDER_TYPE(PseudoObject, PseudoObjectTy)
300 // __builtin_any_type. A placeholder type. Useful for clients
301 // like debuggers that don't know what type to give something.
302 // Only a small number of operations are valid on expressions of
303 // unknown type, most notably explicit casts.
304 PLACEHOLDER_TYPE(UnknownAny, UnknownAnyTy)
306 PLACEHOLDER_TYPE(BuiltinFn, BuiltinFnTy)
308 // The type of a cast which, in ARC, would normally require a
309 // __bridge, but which might be okay depending on the immediate
311 PLACEHOLDER_TYPE(ARCUnbridgedCast, ARCUnbridgedCastTy)
313 // A placeholder type for OpenMP array sections.
314 PLACEHOLDER_TYPE(OMPArraySection, OMPArraySectionTy)
316 #ifdef LAST_BUILTIN_TYPE
317 LAST_BUILTIN_TYPE(OMPArraySection)
318 #undef LAST_BUILTIN_TYPE
321 #undef SHARED_SINGLETON_TYPE
322 #undef PLACEHOLDER_TYPE