BuiltinTypes.def revision 736104a7619c53ef92553780273d7357a3cdde81
1//===-- BuiltinTypeNodes.def - Metadata about BuiltinTypes ------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10//  This file defines the database about various builtin singleton types.
11//
12//  BuiltinType::Id is the enumerator defining the type.
13//
14//  Context.SingletonId is the global singleton of this type.  Some global
15//  singletons are shared by multiple types.
16//
17//    BUILTIN_TYPE(Id, SingletonId) - A builtin type that has not been
18//    covered by any other #define.  Defining this macro covers all
19//    the builtins.
20//
21//    SIGNED_TYPE(Id, SingletonId) - A signed integral type.
22//
23//    UNSIGNED_TYPE(Id, SingletonId) - An unsigned integral type.
24//
25//    FLOATING_TYPE(Id, SingletonId) - A floating-point type.
26//
27//    PLACEHOLDER_TYPE(Id, SingletonId) - A placeholder type.  Placeholder
28//    types are used to perform context-sensitive checking of specific
29//    forms of expression.
30//
31//    SHARED_SINGLETON_TYPE(Expansion) - The given expansion corresponds
32//    to a builtin which uses a shared singleton type.
33//
34//===----------------------------------------------------------------------===//
35
36#ifndef SIGNED_TYPE
37#define SIGNED_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
38#endif
39
40#ifndef UNSIGNED_TYPE
41#define UNSIGNED_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
42#endif
43
44#ifndef FLOATING_TYPE
45#define FLOATING_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
46#endif
47
48#ifndef PLACEHOLDER_TYPE
49#define PLACEHOLDER_TYPE(Id, SingletonId) BUILTIN_TYPE(Id, SingletonId)
50#endif
51
52#ifndef SHARED_SINGLETON_TYPE
53#define SHARED_SINGLETON_TYPE(Expansion) Expansion
54#endif
55
56//===- Builtin Types ------------------------------------------------------===//
57
58// void
59BUILTIN_TYPE(Void, VoidTy)
60
61//===- Unsigned Types -----------------------------------------------------===//
62
63// 'bool' in C++, '_Bool' in C99
64UNSIGNED_TYPE(Bool, BoolTy)
65
66// 'char' for targets where it's unsigned
67SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(Char_U, CharTy))
68
69// 'unsigned char', explicitly qualified
70UNSIGNED_TYPE(UChar, UnsignedCharTy)
71
72// 'wchar_t' for targets where it's unsigned
73SHARED_SINGLETON_TYPE(UNSIGNED_TYPE(WChar_U, WCharTy))
74
75// 'char16_t' in C++
76UNSIGNED_TYPE(Char16, Char16Ty)
77
78// 'char32_t' in C++
79UNSIGNED_TYPE(Char32, Char32Ty)
80
81// 'unsigned short'
82UNSIGNED_TYPE(UShort, UnsignedShortTy)
83
84// 'unsigned int'
85UNSIGNED_TYPE(UInt, UnsignedIntTy)
86
87// 'unsigned long'
88UNSIGNED_TYPE(ULong, UnsignedLongTy)
89
90// 'unsigned long long'
91UNSIGNED_TYPE(ULongLong, UnsignedLongLongTy)
92
93// '__uint128_t'
94UNSIGNED_TYPE(UInt128, UnsignedInt128Ty)
95
96//===- Signed Types -------------------------------------------------------===//
97
98// 'char' for targets where it's signed
99SHARED_SINGLETON_TYPE(SIGNED_TYPE(Char_S, CharTy))
100
101// 'signed char', explicitly qualified
102SIGNED_TYPE(SChar, SignedCharTy)
103
104// 'wchar_t' for targets where it's signed
105SHARED_SINGLETON_TYPE(SIGNED_TYPE(WChar_S, WCharTy))
106
107// 'short' or 'signed short'
108SIGNED_TYPE(Short, ShortTy)
109
110// 'int' or 'signed int'
111SIGNED_TYPE(Int, IntTy)
112
113// 'long' or 'signed long'
114SIGNED_TYPE(Long, LongTy)
115
116// 'long long' or 'signed long long'
117SIGNED_TYPE(LongLong, LongLongTy)
118
119// '__int128_t'
120SIGNED_TYPE(Int128, Int128Ty)
121
122//===- Floating point types -----------------------------------------------===//
123
124// 'half' in OpenCL, '__fp16' in ARM NEON.
125FLOATING_TYPE(Half, HalfTy)
126
127// 'float'
128FLOATING_TYPE(Float, FloatTy)
129
130// 'double'
131FLOATING_TYPE(Double, DoubleTy)
132
133// 'long double'
134FLOATING_TYPE(LongDouble, LongDoubleTy)
135
136//===- Language-specific types --------------------------------------------===//
137
138// This is the type of C++0x 'nullptr'.
139BUILTIN_TYPE(NullPtr, NullPtrTy)
140
141// The primitive Objective C 'id' type.  The user-visible 'id'
142// type is a typedef of an ObjCObjectPointerType to an
143// ObjCObjectType with this as its base.  In fact, this only ever
144// shows up in an AST as the base type of an ObjCObjectType.
145BUILTIN_TYPE(ObjCId, ObjCBuiltinIdTy)
146
147// The primitive Objective C 'Class' type.  The user-visible
148// 'Class' type is a typedef of an ObjCObjectPointerType to an
149// ObjCObjectType with this as its base.  In fact, this only ever
150// shows up in an AST as the base type of an ObjCObjectType.
151BUILTIN_TYPE(ObjCClass, ObjCBuiltinClassTy)
152
153// The primitive Objective C 'SEL' type.  The user-visible 'SEL'
154// type is a typedef of a PointerType to this.
155BUILTIN_TYPE(ObjCSel, ObjCBuiltinSelTy)
156
157// OpenCL image types.
158BUILTIN_TYPE(OCLImage1d, OCLImage1dTy)
159BUILTIN_TYPE(OCLImage1dArray, OCLImage1dArrayTy)
160BUILTIN_TYPE(OCLImage1dBuffer, OCLImage1dBufferTy)
161BUILTIN_TYPE(OCLImage2d, OCLImage2dTy)
162BUILTIN_TYPE(OCLImage2dArray, OCLImage2dArrayTy)
163BUILTIN_TYPE(OCLImage3d, OCLImage3dTy)
164
165// This represents the type of an expression whose type is
166// totally unknown, e.g. 'T::foo'.  It is permitted for this to
167// appear in situations where the structure of the type is
168// theoretically deducible.
169BUILTIN_TYPE(Dependent, DependentTy)
170
171// The type of an unresolved overload set.  A placeholder type.
172// Expressions with this type have one of the following basic
173// forms, with parentheses generally permitted:
174//   foo          # possibly qualified, not if an implicit access
175//   foo          # possibly qualified, not if an implicit access
176//   &foo         # possibly qualified, not if an implicit access
177//   x->foo       # only if might be a static member function
178//   &x->foo      # only if might be a static member function
179//   &Class::foo  # when a pointer-to-member; sub-expr also has this type
180// OverloadExpr::find can be used to analyze the expression.
181//
182// Overload should be the first placeholder type, or else change
183// BuiltinType::isNonOverloadPlaceholderType()
184PLACEHOLDER_TYPE(Overload, OverloadTy)
185
186// The type of a bound C++ non-static member function.
187// A placeholder type.  Expressions with this type have one of the
188// following basic forms:
189//   foo          # if an implicit access
190//   x->foo       # if only contains non-static members
191PLACEHOLDER_TYPE(BoundMember, BoundMemberTy)
192
193// The type of an expression which refers to a pseudo-object,
194// such as those introduced by Objective C's @property or
195// VS.NET's __property declarations.  A placeholder type.  The
196// pseudo-object is actually accessed by emitting a call to
197// some sort of function or method;  typically there is a pair
198// of a setter and a getter, with the setter used if the
199// pseudo-object reference is used syntactically as the
200// left-hand-side of an assignment operator.
201//
202// A pseudo-object reference naming an Objective-C @property is
203// always a dot access with a base of object-pointer type,
204// e.g. 'x.foo'.
205//
206// In VS.NET, a __property declaration creates an implicit
207// member with an associated name, which can then be named
208// in any of the normal ways an ordinary member could be.
209PLACEHOLDER_TYPE(PseudoObject, PseudoObjectTy)
210
211// __builtin_any_type.  A placeholder type.  Useful for clients
212// like debuggers that don't know what type to give something.
213// Only a small number of operations are valid on expressions of
214// unknown type, most notably explicit casts.
215PLACEHOLDER_TYPE(UnknownAny, UnknownAnyTy)
216
217PLACEHOLDER_TYPE(BuiltinFn, BuiltinFnTy)
218
219// The type of a cast which, in ARC, would normally require a
220// __bridge, but which might be okay depending on the immediate
221// context.
222PLACEHOLDER_TYPE(ARCUnbridgedCast, ARCUnbridgedCastTy)
223
224#ifdef LAST_BUILTIN_TYPE
225LAST_BUILTIN_TYPE(ARCUnbridgedCast)
226#undef LAST_BUILTIN_TYPE
227#endif
228
229#undef SHARED_SINGLETON_TYPE
230#undef PLACEHOLDER_TYPE
231#undef FLOATING_TYPE
232#undef SIGNED_TYPE
233#undef UNSIGNED_TYPE
234#undef BUILTIN_TYPE
235