]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/clang/include/clang/AST/BuiltinTypes.def
MFC r355940:
[FreeBSD/FreeBSD.git] / contrib / llvm-project / clang / include / clang / AST / BuiltinTypes.def
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 // '__float128'
216 FLOATING_TYPE(Float128, Float128Ty)
217
218 //===- Language-specific types --------------------------------------------===//
219
220 // This is the type of C++0x 'nullptr'.
221 BUILTIN_TYPE(NullPtr, NullPtrTy)
222
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)
228
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)
234
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)
238
239 // OpenCL sampler_t.
240 BUILTIN_TYPE(OCLSampler, OCLSamplerTy)
241
242 // OpenCL event_t.
243 BUILTIN_TYPE(OCLEvent, OCLEventTy)
244
245 // OpenCL clk_event_t.
246 BUILTIN_TYPE(OCLClkEvent, OCLClkEventTy)
247
248 // OpenCL queue_t.
249 BUILTIN_TYPE(OCLQueue, OCLQueueTy)
250
251 // OpenCL reserve_id_t.
252 BUILTIN_TYPE(OCLReserveID, OCLReserveIDTy)
253
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)
259
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.
270 //
271 // Overload should be the first placeholder type, or else change
272 // BuiltinType::isNonOverloadPlaceholderType()
273 PLACEHOLDER_TYPE(Overload, OverloadTy)
274
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)
281
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.
290 //
291 // A pseudo-object reference naming an Objective-C @property is
292 // always a dot access with a base of object-pointer type,
293 // e.g. 'x.foo'.
294 //
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)
299
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)
305
306 PLACEHOLDER_TYPE(BuiltinFn, BuiltinFnTy)
307
308 // The type of a cast which, in ARC, would normally require a
309 // __bridge, but which might be okay depending on the immediate
310 // context.
311 PLACEHOLDER_TYPE(ARCUnbridgedCast, ARCUnbridgedCastTy)
312
313 // A placeholder type for OpenMP array sections.
314 PLACEHOLDER_TYPE(OMPArraySection, OMPArraySectionTy)
315
316 #ifdef LAST_BUILTIN_TYPE
317 LAST_BUILTIN_TYPE(OMPArraySection)
318 #undef LAST_BUILTIN_TYPE
319 #endif
320
321 #undef SHARED_SINGLETON_TYPE
322 #undef PLACEHOLDER_TYPE
323 #undef FLOATING_TYPE
324 #undef SIGNED_TYPE
325 #undef UNSIGNED_TYPE
326 #undef BUILTIN_TYPE