blob: bb5c91b8e060a5a05fa2c988c3bcf927a6eed668 [file] [log] [blame]
Douglas Gregor2cf26342009-04-09 22:27:44 +00001//===- PCHBitCodes.h - Enum values for the PCH bitcode format ---*- 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 header defines Bitcode enum values for Clang precompiled header files.
11//
12// The enum values defined in this file should be considered permanent. If
13// new features are added, they should have values added at the end of the
14// respective lists.
15//
16//===----------------------------------------------------------------------===//
17#ifndef LLVM_CLANG_FRONTEND_PCHBITCODES_H
18#define LLVM_CLANG_FRONTEND_PCHBITCODES_H
19
20#include "llvm/Bitcode/BitCodes.h"
21#include "llvm/Support/DataTypes.h"
22
23namespace clang {
24 namespace pch {
Douglas Gregorab41e632009-04-27 22:23:34 +000025 /// \brief PCH major version number supported by this version of
26 /// Clang.
27 ///
28 /// Whenever the PCH format changes in a way that makes it
29 /// incompatible with previous versions (such that a reader
30 /// designed for the previous version could not support reading
31 /// the new version), this number should be increased.
32 const unsigned VERSION_MAJOR = 1;
33
34 /// \brief PCH minor version number supported by this version of
35 /// Clang.
36 ///
37 /// Whenever the PCH format changes in a way that is still
38 /// compatible with previous versions (such that a reader designed
39 /// for the previous version could still support reading the new
40 /// version by ignoring new kinds of subblocks), this number
41 /// should be increased.
42 const unsigned VERSION_MINOR = 0;
43
Douglas Gregor8038d512009-04-10 17:25:41 +000044 /// \brief An ID number that refers to a declaration in a PCH file.
45 ///
46 /// The ID numbers of types are consecutive (in order of
47 /// discovery) and start at 2. 0 is reserved for NULL, and 1 is
48 /// reserved for the translation unit declaration.
49 typedef uint32_t DeclID;
50
51 /// \brief An ID number that refers to a type in a PCH file.
52 ///
53 /// The ID of a type is partitioned into two parts: the lower
54 /// three bits are used to store the const/volatile/restrict
55 /// qualifiers (as with QualType) and the upper bits provide a
56 /// type index. The type index values are partitioned into two
57 /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type
58 /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a
59 /// placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are
60 /// other types that have serialized representations.
61 typedef uint32_t TypeID;
Douglas Gregor2cf26342009-04-09 22:27:44 +000062
Douglas Gregorafaf3082009-04-11 00:14:32 +000063 /// \brief An ID number that refers to an identifier in a PCH
64 /// file.
65 typedef uint32_t IdentID;
66
Steve Naroff90cd1bb2009-04-23 10:39:46 +000067 typedef uint32_t SelectorID;
68
Douglas Gregor2cf26342009-04-09 22:27:44 +000069 /// \brief Describes the various kinds of blocks that occur within
70 /// a PCH file.
71 enum BlockIDs {
72 /// \brief The PCH block, which acts as a container around the
73 /// full PCH block.
74 PCH_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
Douglas Gregor14f79002009-04-10 03:52:48 +000075
Douglas Gregor14f79002009-04-10 03:52:48 +000076 /// \brief The block containing information about the source
77 /// manager.
78 SOURCE_MANAGER_BLOCK_ID,
79
80 /// \brief The block containing information about the
81 /// preprocessor.
82 PREPROCESSOR_BLOCK_ID,
83
Douglas Gregor2cf26342009-04-09 22:27:44 +000084 /// \brief The block containing the definitions of all of the
85 /// types used within the PCH file.
86 TYPES_BLOCK_ID,
87
Douglas Gregor2cf26342009-04-09 22:27:44 +000088 /// \brief The block containing the definitions of all of the
89 /// declarations stored in the PCH file.
Douglas Gregor83941df2009-04-25 17:48:32 +000090 DECLS_BLOCK_ID
Douglas Gregor8038d512009-04-10 17:25:41 +000091 };
Douglas Gregor2cf26342009-04-09 22:27:44 +000092
Douglas Gregor8038d512009-04-10 17:25:41 +000093 /// \brief Record types that occur within the PCH block itself.
94 enum PCHRecordTypes {
95 /// \brief Offset of each type within the types block.
Douglas Gregor2cf26342009-04-09 22:27:44 +000096 ///
Douglas Gregor8038d512009-04-10 17:25:41 +000097 /// The TYPE_OFFSET constant describes the record that occurs
98 /// within the block identified by TYPE_OFFSETS_BLOCK_ID within
99 /// the PCH file. The record itself is an array of offsets that
100 /// point into the types block (identified by TYPES_BLOCK_ID in
101 /// the PCH file). The index into the array is based on the ID
102 /// of a type. For a given type ID @c T, the lower three bits of
103 /// @c T are its qualifiers (const, volatile, restrict), as in
104 /// the QualType class. The upper bits, after being shifted and
105 /// subtracting NUM_PREDEF_TYPE_IDS, are used to index into the
106 /// TYPE_OFFSET block to determine the offset of that type's
107 /// corresponding record within the TYPES_BLOCK_ID block.
108 TYPE_OFFSET = 1,
109
110 /// \brief Record code for the offsets of each decl.
111 ///
112 /// The DECL_OFFSET constant describes the record that occurs
113 /// within the block identifier by DECL_OFFSETS_BLOCK_ID within
114 /// the PCH file. The record itself is an array of offsets that
115 /// point into the declarations block (identified by
116 /// DECLS_BLOCK_ID). The declaration ID is an index into this
117 /// record, after subtracting one to account for the use of
118 /// declaration ID 0 for a NULL declaration pointer. Index 0 is
119 /// reserved for the translation unit declaration.
Douglas Gregor0a0428e2009-04-10 20:39:37 +0000120 DECL_OFFSET = 2,
121
122 /// \brief Record code for the language options table.
123 ///
124 /// The record with this code contains the contents of the
125 /// LangOptions structure. We serialize the entire contents of
126 /// the structure, and let the reader decide which options are
127 /// actually important to check.
Douglas Gregor2bec0412009-04-10 21:16:55 +0000128 LANGUAGE_OPTIONS = 3,
129
Douglas Gregorab41e632009-04-27 22:23:34 +0000130 /// \brief PCH metadata, including the PCH file version number
131 /// and the target triple used to build the PCH file.
132 METADATA = 4,
Douglas Gregorafaf3082009-04-11 00:14:32 +0000133
134 /// \brief Record code for the table of offsets of each
135 /// identifier ID.
136 ///
137 /// The offset table contains offsets into the blob stored in
138 /// the IDENTIFIER_TABLE record. Each offset points to the
139 /// NULL-terminated string that corresponds to that identifier.
140 IDENTIFIER_OFFSET = 5,
141
142 /// \brief Record code for the identifier table.
143 ///
144 /// The identifier table is a simple blob that contains
145 /// NULL-terminated strings for all of the identifiers
146 /// referenced by the PCH file. The IDENTIFIER_OFFSET table
147 /// contains the mapping from identifier IDs to the characters
148 /// in this blob. Note that the starting offsets of all of the
149 /// identifiers are odd, so that, when the identifier offset
150 /// table is loaded in, we can use the low bit to distinguish
151 /// between offsets (for unresolved identifier IDs) and
152 /// IdentifierInfo pointers (for already-resolved identifier
153 /// IDs).
Douglas Gregorfdd01722009-04-14 00:24:19 +0000154 IDENTIFIER_TABLE = 6,
155
156 /// \brief Record code for the array of external definitions.
157 ///
Douglas Gregor4c0e86b2009-04-22 22:02:47 +0000158 /// The PCH file contains a list of all of the unnamed external
Douglas Gregorfdd01722009-04-14 00:24:19 +0000159 /// definitions present within the parsed headers, stored as an
160 /// array of declaration IDs. These external definitions will be
161 /// reported to the AST consumer after the PCH file has been
162 /// read, since their presence can affect the semantics of the
163 /// program (e.g., for code generation).
Douglas Gregor3e1af842009-04-17 22:13:46 +0000164 EXTERNAL_DEFINITIONS = 7,
165
Douglas Gregorad1de002009-04-18 05:55:16 +0000166 /// \brief Record code for the set of non-builtin, special
167 /// types.
168 ///
169 /// This record contains the type IDs for the various type nodes
170 /// that are constructed during semantic analysis (e.g.,
171 /// __builtin_va_list). The SPECIAL_TYPE_* constants provide
172 /// offsets into this record.
173 SPECIAL_TYPES = 8,
174
Douglas Gregor4c0e86b2009-04-22 22:02:47 +0000175 /// \brief Record code for the extra statistics we gather while
176 /// generating a PCH file.
177 STATISTICS = 9,
178
179 /// \brief Record code for the array of tentative definitions.
Douglas Gregor14c22f22009-04-22 22:18:58 +0000180 TENTATIVE_DEFINITIONS = 10,
181
182 /// \brief Record code for the array of locally-scoped external
183 /// declarations.
Steve Naroff90cd1bb2009-04-23 10:39:46 +0000184 LOCALLY_SCOPED_EXTERNAL_DECLS = 11,
185
Douglas Gregor83941df2009-04-25 17:48:32 +0000186 /// \brief Record code for the table of offsets into the
187 /// Objective-C method pool.
188 SELECTOR_OFFSETS = 12,
Douglas Gregorf0aaf7a2009-04-24 21:10:55 +0000189
190 /// \brief Record code for the Objective-C method pool,
Douglas Gregor2eafc1b2009-04-26 00:07:37 +0000191 METHOD_POOL = 13,
192
193 /// \brief The value of the next __COUNTER__ to dispense.
194 /// [PP_COUNTER_VALUE, Val]
Douglas Gregor7f94b0b2009-04-27 06:38:32 +0000195 PP_COUNTER_VALUE = 14,
196
197 /// \brief Record code for the table of offsets into the block
198 /// of source-location information.
199 SOURCE_LOCATION_OFFSETS = 15,
200
201 /// \brief Record code for the set of source location entries
202 /// that need to be preloaded by the PCH reader.
203 ///
204 /// This set contains the source location entry for the
205 /// predefines buffer and for any file entries that need to be
206 /// preloaded.
Douglas Gregor4fed3f42009-04-27 18:38:38 +0000207 SOURCE_LOCATION_PRELOADS = 16,
208
209 /// \brief Record code for the stat() cache.
Douglas Gregorb81c1702009-04-27 20:06:05 +0000210 STAT_CACHE = 17,
211
212 /// \brief Record code for the set of ext_vector type names.
213 EXT_VECTOR_DECLS = 18,
214
215 /// \brief Record code for the set of Objective-C category
216 /// implementations.
217 OBJC_CATEGORY_IMPLEMENTATIONS = 19
Douglas Gregor2cf26342009-04-09 22:27:44 +0000218 };
219
Douglas Gregor14f79002009-04-10 03:52:48 +0000220 /// \brief Record types used within a source manager block.
221 enum SourceManagerRecordTypes {
222 /// \brief Describes a source location entry (SLocEntry) for a
223 /// file.
224 SM_SLOC_FILE_ENTRY = 1,
225 /// \brief Describes a source location entry (SLocEntry) for a
226 /// buffer.
227 SM_SLOC_BUFFER_ENTRY = 2,
228 /// \brief Describes a blob that contains the data for a buffer
229 /// entry. This kind of record always directly follows a
230 /// SM_SLOC_BUFFER_ENTRY record.
231 SM_SLOC_BUFFER_BLOB = 3,
232 /// \brief Describes a source location entry (SLocEntry) for a
233 /// macro instantiation.
Douglas Gregorbd945002009-04-13 16:31:14 +0000234 SM_SLOC_INSTANTIATION_ENTRY = 4,
235 /// \brief Describes the SourceManager's line table, with
236 /// information about #line directives.
Douglas Gregor2eafc1b2009-04-26 00:07:37 +0000237 SM_LINE_TABLE = 5,
238 /// \brief Describes one header file info [isImport, DirInfo, NumIncludes]
239 /// ControllingMacro is optional.
240 SM_HEADER_FILE_INFO = 6
Douglas Gregor14f79002009-04-10 03:52:48 +0000241 };
Chris Lattner7c5d24e2009-04-10 18:00:12 +0000242
243 /// \brief Record types used within a preprocessor block.
244 enum PreprocessorRecordTypes {
245 // The macros in the PP section are a PP_MACRO_* instance followed by a
246 // list of PP_TOKEN instances for each token in the definition.
247
248 /// \brief An object-like macro definition.
249 /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
250 PP_MACRO_OBJECT_LIKE = 1,
251
252 /// \brief A function-like macro definition.
253 /// [PP_MACRO_FUNCTION_LIKE, <ObjectLikeStuff>, IsC99Varargs, IsGNUVarars,
254 /// NumArgs, ArgIdentInfoID* ]
255 PP_MACRO_FUNCTION_LIKE = 2,
256
257 /// \brief Describes one token.
Chris Lattnerc1f9d822009-04-13 01:29:17 +0000258 /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
Douglas Gregor2eafc1b2009-04-26 00:07:37 +0000259 PP_TOKEN = 3
Chris Lattner7c5d24e2009-04-10 18:00:12 +0000260 };
Douglas Gregor14f79002009-04-10 03:52:48 +0000261
262 /// \defgroup PCHAST Precompiled header AST constants
263 ///
264 /// The constants in this group describe various components of the
265 /// abstract syntax tree within a precompiled header.
266 ///
267 /// @{
268
Douglas Gregor2cf26342009-04-09 22:27:44 +0000269 /// \brief Predefined type IDs.
270 ///
271 /// These type IDs correspond to predefined types in the AST
272 /// context, such as built-in types (int) and special place-holder
273 /// types (the <overload> and <dependent> type markers). Such
274 /// types are never actually serialized, since they will be built
275 /// by the AST context when it is created.
276 enum PredefinedTypeIDs {
277 /// \brief The NULL type.
278 PREDEF_TYPE_NULL_ID = 0,
279 /// \brief The void type.
280 PREDEF_TYPE_VOID_ID = 1,
281 /// \brief The 'bool' or '_Bool' type.
282 PREDEF_TYPE_BOOL_ID = 2,
283 /// \brief The 'char' type, when it is unsigned.
284 PREDEF_TYPE_CHAR_U_ID = 3,
285 /// \brief The 'unsigned char' type.
286 PREDEF_TYPE_UCHAR_ID = 4,
287 /// \brief The 'unsigned short' type.
288 PREDEF_TYPE_USHORT_ID = 5,
289 /// \brief The 'unsigned int' type.
290 PREDEF_TYPE_UINT_ID = 6,
291 /// \brief The 'unsigned long' type.
292 PREDEF_TYPE_ULONG_ID = 7,
293 /// \brief The 'unsigned long long' type.
294 PREDEF_TYPE_ULONGLONG_ID = 8,
295 /// \brief The 'char' type, when it is signed.
296 PREDEF_TYPE_CHAR_S_ID = 9,
297 /// \brief The 'signed char' type.
298 PREDEF_TYPE_SCHAR_ID = 10,
299 /// \brief The C++ 'wchar_t' type.
300 PREDEF_TYPE_WCHAR_ID = 11,
301 /// \brief The (signed) 'short' type.
302 PREDEF_TYPE_SHORT_ID = 12,
303 /// \brief The (signed) 'int' type.
304 PREDEF_TYPE_INT_ID = 13,
305 /// \brief The (signed) 'long' type.
306 PREDEF_TYPE_LONG_ID = 14,
307 /// \brief The (signed) 'long long' type.
308 PREDEF_TYPE_LONGLONG_ID = 15,
309 /// \brief The 'float' type.
310 PREDEF_TYPE_FLOAT_ID = 16,
311 /// \brief The 'double' type.
312 PREDEF_TYPE_DOUBLE_ID = 17,
313 /// \brief The 'long double' type.
314 PREDEF_TYPE_LONGDOUBLE_ID = 18,
315 /// \brief The placeholder type for overloaded function sets.
316 PREDEF_TYPE_OVERLOAD_ID = 19,
317 /// \brief The placeholder type for dependent types.
Chris Lattner2df9ced2009-04-30 02:43:43 +0000318 PREDEF_TYPE_DEPENDENT_ID = 20,
319 /// \brief The '__uint128_t' type.
320 PREDEF_TYPE_UINT128_ID = 21,
321 /// \brief The '__int128_t' type.
322 PREDEF_TYPE_INT128_ID = 22
Douglas Gregor2cf26342009-04-09 22:27:44 +0000323 };
324
325 /// \brief The number of predefined type IDs that are reserved for
326 /// the PREDEF_TYPE_* constants.
327 ///
328 /// Type IDs for non-predefined types will start at
329 /// NUM_PREDEF_TYPE_IDs.
330 const unsigned NUM_PREDEF_TYPE_IDS = 100;
331
332 /// \brief Record codes for each kind of type.
333 ///
334 /// These constants describe the records that can occur within a
335 /// block identified by TYPES_BLOCK_ID in the PCH file. Each
336 /// constant describes a record for a specific type class in the
337 /// AST.
338 enum TypeCode {
339 /// \brief An ExtQualType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000340 TYPE_EXT_QUAL = 1,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000341 /// \brief A FixedWidthIntType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000342 TYPE_FIXED_WIDTH_INT = 2,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000343 /// \brief A ComplexType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000344 TYPE_COMPLEX = 3,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000345 /// \brief A PointerType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000346 TYPE_POINTER = 4,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000347 /// \brief A BlockPointerType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000348 TYPE_BLOCK_POINTER = 5,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000349 /// \brief An LValueReferenceType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000350 TYPE_LVALUE_REFERENCE = 6,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000351 /// \brief An RValueReferenceType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000352 TYPE_RVALUE_REFERENCE = 7,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000353 /// \brief A MemberPointerType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000354 TYPE_MEMBER_POINTER = 8,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000355 /// \brief A ConstantArrayType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000356 TYPE_CONSTANT_ARRAY = 9,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000357 /// \brief An IncompleteArrayType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000358 TYPE_INCOMPLETE_ARRAY = 10,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000359 /// \brief A VariableArrayType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000360 TYPE_VARIABLE_ARRAY = 11,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000361 /// \brief A VectorType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000362 TYPE_VECTOR = 12,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000363 /// \brief An ExtVectorType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000364 TYPE_EXT_VECTOR = 13,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000365 /// \brief A FunctionNoProtoType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000366 TYPE_FUNCTION_NO_PROTO = 14,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000367 /// \brief A FunctionProtoType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000368 TYPE_FUNCTION_PROTO = 15,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000369 /// \brief A TypedefType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000370 TYPE_TYPEDEF = 16,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000371 /// \brief A TypeOfExprType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000372 TYPE_TYPEOF_EXPR = 17,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000373 /// \brief A TypeOfType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000374 TYPE_TYPEOF = 18,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000375 /// \brief A RecordType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000376 TYPE_RECORD = 19,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000377 /// \brief An EnumType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000378 TYPE_ENUM = 20,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000379 /// \brief An ObjCInterfaceType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000380 TYPE_OBJC_INTERFACE = 21,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000381 /// \brief An ObjCQualifiedInterfaceType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000382 TYPE_OBJC_QUALIFIED_INTERFACE = 22,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000383 /// \brief An ObjCQualifiedIdType record.
Chris Lattner068360e2009-04-22 06:50:37 +0000384 TYPE_OBJC_QUALIFIED_ID = 23
Douglas Gregor2cf26342009-04-09 22:27:44 +0000385 };
386
Douglas Gregorad1de002009-04-18 05:55:16 +0000387 /// \brief The type IDs for special types constructed by semantic
388 /// analysis.
389 ///
390 /// The constants in this enumeration are indices into the
391 /// SPECIAL_TYPES record.
392 enum SpecialTypeIDs {
393 /// \brief __builtin_va_list
Douglas Gregor319ac892009-04-23 22:29:11 +0000394 SPECIAL_TYPE_BUILTIN_VA_LIST = 0,
395 /// \brief Objective-C "id" type
396 SPECIAL_TYPE_OBJC_ID = 1,
397 /// \brief Objective-C selector type
398 SPECIAL_TYPE_OBJC_SELECTOR = 2,
399 /// \brief Objective-C Protocol type
400 SPECIAL_TYPE_OBJC_PROTOCOL = 3,
401 /// \brief Objective-C Class type
402 SPECIAL_TYPE_OBJC_CLASS = 4,
403 /// \brief CFConstantString type
404 SPECIAL_TYPE_CF_CONSTANT_STRING = 5,
405 /// \brief Objective-C fast enumeration state type
406 SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE = 6
Douglas Gregorad1de002009-04-18 05:55:16 +0000407 };
408
Douglas Gregor2cf26342009-04-09 22:27:44 +0000409 /// \brief Record codes for each kind of declaration.
410 ///
411 /// These constants describe the records that can occur within a
412 /// declarations block (identified by DECLS_BLOCK_ID). Each
413 /// constant describes a record for a specific declaration class
414 /// in the AST.
415 enum DeclCode {
Douglas Gregor68a2eb02009-04-15 21:30:51 +0000416 /// \brief Attributes attached to a declaration.
Douglas Gregor68a2eb02009-04-15 21:30:51 +0000417 DECL_ATTR = 1,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000418 /// \brief A TranslationUnitDecl record.
Douglas Gregor68a2eb02009-04-15 21:30:51 +0000419 DECL_TRANSLATION_UNIT,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000420 /// \brief A TypedefDecl record.
421 DECL_TYPEDEF,
Douglas Gregor0a2b45e2009-04-13 18:14:40 +0000422 /// \brief An EnumDecl record.
423 DECL_ENUM,
Douglas Gregor8c700062009-04-13 21:20:57 +0000424 /// \brief A RecordDecl record.
425 DECL_RECORD,
Douglas Gregor0a2b45e2009-04-13 18:14:40 +0000426 /// \brief An EnumConstantDecl record.
427 DECL_ENUM_CONSTANT,
Douglas Gregor3a2f7e42009-04-13 22:18:37 +0000428 /// \brief A FunctionDecl record.
429 DECL_FUNCTION,
Steve Naroff53c9d8a2009-04-20 15:06:07 +0000430 /// \brief A ObjCMethodDecl record.
431 DECL_OBJC_METHOD,
Steve Naroff33feeb02009-04-20 20:09:33 +0000432 /// \brief A ObjCInterfaceDecl record.
Steve Naroff30833f82009-04-21 15:12:33 +0000433 DECL_OBJC_INTERFACE,
434 /// \brief A ObjCProtocolDecl record.
435 DECL_OBJC_PROTOCOL,
Steve Naroff33feeb02009-04-20 20:09:33 +0000436 /// \brief A ObjCIvarDecl record.
Steve Naroff30833f82009-04-21 15:12:33 +0000437 DECL_OBJC_IVAR,
438 /// \brief A ObjCAtDefsFieldDecl record.
439 DECL_OBJC_AT_DEFS_FIELD,
440 /// \brief A ObjCClassDecl record.
441 DECL_OBJC_CLASS,
442 /// \brief A ObjCForwardProtocolDecl record.
443 DECL_OBJC_FORWARD_PROTOCOL,
444 /// \brief A ObjCCategoryDecl record.
445 DECL_OBJC_CATEGORY,
446 /// \brief A ObjCCategoryImplDecl record.
447 DECL_OBJC_CATEGORY_IMPL,
448 /// \brief A ObjCImplementationDecl record.
449 DECL_OBJC_IMPLEMENTATION,
450 /// \brief A ObjCCompatibleAliasDecl record.
451 DECL_OBJC_COMPATIBLE_ALIAS,
452 /// \brief A ObjCPropertyDecl record.
453 DECL_OBJC_PROPERTY,
454 /// \brief A ObjCPropertyImplDecl record.
455 DECL_OBJC_PROPERTY_IMPL,
Douglas Gregor8c700062009-04-13 21:20:57 +0000456 /// \brief A FieldDecl record.
457 DECL_FIELD,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000458 /// \brief A VarDecl record.
459 DECL_VAR,
Douglas Gregor405bad02009-04-26 22:20:50 +0000460 /// \brief An ImplicitParamDecl record.
461 DECL_IMPLICIT_PARAM,
Douglas Gregor3a2f7e42009-04-13 22:18:37 +0000462 /// \brief A ParmVarDecl record.
463 DECL_PARM_VAR,
464 /// \brief An OriginalParmVarDecl record.
465 DECL_ORIGINAL_PARM_VAR,
Douglas Gregor1028bc62009-04-13 22:49:25 +0000466 /// \brief A FileScopeAsmDecl record.
467 DECL_FILE_SCOPE_ASM,
468 /// \brief A BlockDecl record.
469 DECL_BLOCK,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000470 /// \brief A record that stores the set of declarations that are
471 /// lexically stored within a given DeclContext.
472 ///
473 /// The record itself is an array of declaration IDs, in the
474 /// order in which those declarations were added to the
475 /// declaration context. This data is used when iterating over
476 /// the contents of a DeclContext, e.g., via
477 /// DeclContext::decls_begin()/DeclContext::decls_end().
478 DECL_CONTEXT_LEXICAL,
479 /// \brief A record that stores the set of declarations that are
480 /// visible from a given DeclContext.
481 ///
482 /// The record itself stores a set of mappings, each of which
483 /// associates a declaration name with one or more declaration
484 /// IDs. This data is used when performing qualified name lookup
485 /// into a DeclContext via DeclContext::lookup.
486 DECL_CONTEXT_VISIBLE
487 };
Douglas Gregor0b748912009-04-14 21:18:50 +0000488
489 /// \brief Record codes for each kind of statement or expression.
490 ///
491 /// These constants describe the records that describe statements
492 /// or expressions. These records can occur within either the type
493 /// or declaration blocks, so they begin with record values of
Chris Lattner5947ca22009-04-27 00:44:11 +0000494 /// 50. Each constant describes a record for a specific
Douglas Gregor0b748912009-04-14 21:18:50 +0000495 /// statement or expression class in the AST.
496 enum StmtCode {
Douglas Gregor087fd532009-04-14 23:32:43 +0000497 /// \brief A marker record that indicates that we are at the end
498 /// of an expression.
Chris Lattner5947ca22009-04-27 00:44:11 +0000499 STMT_STOP = 50,
Douglas Gregor0b748912009-04-14 21:18:50 +0000500 /// \brief A NULL expression.
Douglas Gregorc9490c02009-04-16 22:23:12 +0000501 STMT_NULL_PTR,
Douglas Gregor025452f2009-04-17 00:04:06 +0000502 /// \brief A NullStmt record.
503 STMT_NULL,
504 /// \brief A CompoundStmt record.
505 STMT_COMPOUND,
506 /// \brief A CaseStmt record.
507 STMT_CASE,
508 /// \brief A DefaultStmt record.
509 STMT_DEFAULT,
Douglas Gregor1de05fe2009-04-17 18:18:49 +0000510 /// \brief A LabelStmt record.
511 STMT_LABEL,
Douglas Gregor025452f2009-04-17 00:04:06 +0000512 /// \brief An IfStmt record.
513 STMT_IF,
514 /// \brief A SwitchStmt record.
515 STMT_SWITCH,
Douglas Gregord921cf92009-04-17 00:16:09 +0000516 /// \brief A WhileStmt record.
517 STMT_WHILE,
Douglas Gregor67d82492009-04-17 00:29:51 +0000518 /// \brief A DoStmt record.
519 STMT_DO,
520 /// \brief A ForStmt record.
521 STMT_FOR,
Douglas Gregor1de05fe2009-04-17 18:18:49 +0000522 /// \brief A GotoStmt record.
523 STMT_GOTO,
Douglas Gregor7d5c2f22009-04-17 18:58:21 +0000524 /// \brief An IndirectGotoStmt record.
525 STMT_INDIRECT_GOTO,
Douglas Gregord921cf92009-04-17 00:16:09 +0000526 /// \brief A ContinueStmt record.
527 STMT_CONTINUE,
Douglas Gregor025452f2009-04-17 00:04:06 +0000528 /// \brief A BreakStmt record.
529 STMT_BREAK,
Douglas Gregor0de9d882009-04-17 16:34:57 +0000530 /// \brief A ReturnStmt record.
531 STMT_RETURN,
Douglas Gregor84f21702009-04-17 16:55:36 +0000532 /// \brief A DeclStmt record.
533 STMT_DECL,
Douglas Gregorcd7d5a92009-04-17 20:57:14 +0000534 /// \brief An AsmStmt record.
535 STMT_ASM,
Douglas Gregor17fc2232009-04-14 21:55:33 +0000536 /// \brief A PredefinedExpr record.
537 EXPR_PREDEFINED,
Douglas Gregor0b748912009-04-14 21:18:50 +0000538 /// \brief A DeclRefExpr record.
539 EXPR_DECL_REF,
540 /// \brief An IntegerLiteral record.
541 EXPR_INTEGER_LITERAL,
Douglas Gregor17fc2232009-04-14 21:55:33 +0000542 /// \brief A FloatingLiteral record.
543 EXPR_FLOATING_LITERAL,
Douglas Gregorcb2ca732009-04-15 22:19:53 +0000544 /// \brief An ImaginaryLiteral record.
545 EXPR_IMAGINARY_LITERAL,
Douglas Gregor673ecd62009-04-15 16:35:07 +0000546 /// \brief A StringLiteral record.
547 EXPR_STRING_LITERAL,
Douglas Gregor0b748912009-04-14 21:18:50 +0000548 /// \brief A CharacterLiteral record.
Douglas Gregor087fd532009-04-14 23:32:43 +0000549 EXPR_CHARACTER_LITERAL,
Douglas Gregorc04db4f2009-04-14 23:59:37 +0000550 /// \brief A ParenExpr record.
551 EXPR_PAREN,
Douglas Gregor0b0b77f2009-04-15 15:58:59 +0000552 /// \brief A UnaryOperator record.
553 EXPR_UNARY_OPERATOR,
554 /// \brief A SizefAlignOfExpr record.
555 EXPR_SIZEOF_ALIGN_OF,
Douglas Gregorcb2ca732009-04-15 22:19:53 +0000556 /// \brief An ArraySubscriptExpr record.
557 EXPR_ARRAY_SUBSCRIPT,
Douglas Gregor1f0d0132009-04-15 17:43:59 +0000558 /// \brief A CallExpr record.
559 EXPR_CALL,
560 /// \brief A MemberExpr record.
561 EXPR_MEMBER,
Douglas Gregordb600c32009-04-15 00:25:59 +0000562 /// \brief A BinaryOperator record.
563 EXPR_BINARY_OPERATOR,
Douglas Gregorad90e962009-04-15 22:40:36 +0000564 /// \brief A CompoundAssignOperator record.
565 EXPR_COMPOUND_ASSIGN_OPERATOR,
566 /// \brief A ConditionOperator record.
567 EXPR_CONDITIONAL_OPERATOR,
Douglas Gregor087fd532009-04-14 23:32:43 +0000568 /// \brief An ImplicitCastExpr record.
Douglas Gregordb600c32009-04-15 00:25:59 +0000569 EXPR_IMPLICIT_CAST,
570 /// \brief A CStyleCastExpr record.
Douglas Gregord3c98a02009-04-15 23:02:49 +0000571 EXPR_CSTYLE_CAST,
Douglas Gregorba6d7e72009-04-16 02:33:48 +0000572 /// \brief A CompoundLiteralExpr record.
573 EXPR_COMPOUND_LITERAL,
Douglas Gregord3c98a02009-04-15 23:02:49 +0000574 /// \brief An ExtVectorElementExpr record.
575 EXPR_EXT_VECTOR_ELEMENT,
Douglas Gregord077d752009-04-16 00:55:48 +0000576 /// \brief An InitListExpr record.
577 EXPR_INIT_LIST,
578 /// \brief A DesignatedInitExpr record.
579 EXPR_DESIGNATED_INIT,
580 /// \brief An ImplicitValueInitExpr record.
581 EXPR_IMPLICIT_VALUE_INIT,
Douglas Gregord3c98a02009-04-15 23:02:49 +0000582 /// \brief A VAArgExpr record.
Douglas Gregor44cae0c2009-04-15 23:33:31 +0000583 EXPR_VA_ARG,
Douglas Gregor6a2dd552009-04-17 19:05:30 +0000584 /// \brief An AddrLabelExpr record.
Douglas Gregor7d5c2f22009-04-17 18:58:21 +0000585 EXPR_ADDR_LABEL,
Douglas Gregor6a2dd552009-04-17 19:05:30 +0000586 /// \brief A StmtExpr record.
587 EXPR_STMT,
Douglas Gregor44cae0c2009-04-15 23:33:31 +0000588 /// \brief A TypesCompatibleExpr record.
589 EXPR_TYPES_COMPATIBLE,
590 /// \brief A ChooseExpr record.
591 EXPR_CHOOSE,
592 /// \brief A GNUNullExpr record.
Douglas Gregor94cd5d12009-04-16 00:01:45 +0000593 EXPR_GNU_NULL,
594 /// \brief A ShuffleVectorExpr record.
595 EXPR_SHUFFLE_VECTOR,
Douglas Gregor84af7c22009-04-17 19:21:43 +0000596 /// \brief BlockExpr
597 EXPR_BLOCK,
598 /// \brief A BlockDeclRef record.
Chris Lattner4dcf151a2009-04-22 05:57:30 +0000599 EXPR_BLOCK_DECL_REF,
600
601 // Objective-C
Chris Lattner3a57a372009-04-22 06:29:42 +0000602
Chris Lattner0389e6b2009-04-26 00:44:05 +0000603 /// \brief An ObjCStringLiteral record.
Chris Lattner3a57a372009-04-22 06:29:42 +0000604 EXPR_OBJC_STRING_LITERAL,
Chris Lattner0389e6b2009-04-26 00:44:05 +0000605 /// \brief An ObjCEncodeExpr record.
Chris Lattner3a57a372009-04-22 06:29:42 +0000606 EXPR_OBJC_ENCODE,
Chris Lattner0389e6b2009-04-26 00:44:05 +0000607 /// \brief An ObjCSelectorExpr record.
Chris Lattner3a57a372009-04-22 06:29:42 +0000608 EXPR_OBJC_SELECTOR_EXPR,
Chris Lattner0389e6b2009-04-26 00:44:05 +0000609 /// \brief An ObjCProtocolExpr record.
Steve Naroffc4f0bbd2009-04-25 14:04:28 +0000610 EXPR_OBJC_PROTOCOL_EXPR,
Chris Lattner0389e6b2009-04-26 00:44:05 +0000611 /// \brief An ObjCIvarRefExpr record.
612 EXPR_OBJC_IVAR_REF_EXPR,
613 /// \brief An ObjCPropertyRefExpr record.
614 EXPR_OBJC_PROPERTY_REF_EXPR,
615 /// \brief An ObjCKVCRefExpr record.
616 EXPR_OBJC_KVC_REF_EXPR,
617 /// \brief An ObjCMessageExpr record.
618 EXPR_OBJC_MESSAGE_EXPR,
619 /// \brief An ObjCSuperExpr record.
Steve Naroff1eb55402009-04-26 18:52:16 +0000620 EXPR_OBJC_SUPER_EXPR,
621
622 /// \brief An ObjCForCollectionStmt record.
623 STMT_OBJC_FOR_COLLECTION,
624 /// \brief An ObjCAtCatchStmt record.
625 STMT_OBJC_CATCH,
626 /// \brief An ObjCAtFinallyStmt record.
627 STMT_OBJC_FINALLY,
628 /// \brief An ObjCAtTryStmt record.
629 STMT_OBJC_AT_TRY,
630 /// \brief An ObjCAtSynchronizedStmt record.
631 STMT_OBJC_AT_SYNCHRONIZED,
632 /// \brief An ObjCAtThrowStmt record.
633 STMT_OBJC_AT_THROW
Douglas Gregor0b748912009-04-14 21:18:50 +0000634 };
Douglas Gregord077d752009-04-16 00:55:48 +0000635
636 /// \brief The kinds of designators that can occur in a
637 /// DesignatedInitExpr.
638 enum DesignatorTypes {
639 /// \brief Field designator where only the field name is known.
640 DESIG_FIELD_NAME = 0,
641 /// \brief Field designator where the field has been resolved to
642 /// a declaration.
643 DESIG_FIELD_DECL = 1,
644 /// \brief Array designator.
645 DESIG_ARRAY = 2,
646 /// \brief GNU array range designator.
647 DESIG_ARRAY_RANGE = 3
648 };
649
Douglas Gregor14f79002009-04-10 03:52:48 +0000650 /// @}
Douglas Gregor2cf26342009-04-09 22:27:44 +0000651 }
652} // end namespace clang
653
654#endif