blob: 8628d74ff1f39c17517144a150e0d3f58f28f6b3 [file] [log] [blame]
Sebastian Redl05a07602010-08-18 23:57:26 +00001//===- ASTBitCodes.h - Enum values for the PCH bitcode format ---*- C++ -*-===//
Douglas Gregor2cf26342009-04-09 22:27:44 +00002//
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//
Sebastian Redlf29f0a22010-08-18 23:57:22 +000010// This header defines Bitcode enum values for Clang serialized AST files.
Douglas Gregor2cf26342009-04-09 22:27:44 +000011//
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
Argyrios Kyrtzidisc8e5d512010-08-20 16:03:59 +000020#include "clang/AST/Type.h"
Douglas Gregor2cf26342009-04-09 22:27:44 +000021#include "llvm/Bitcode/BitCodes.h"
Chandler Carruth9f8eb202009-10-26 01:37:10 +000022#include "llvm/System/DataTypes.h"
Argyrios Kyrtzidis5d267682010-08-20 16:04:27 +000023#include "llvm/ADT/DenseMap.h"
Douglas Gregor2cf26342009-04-09 22:27:44 +000024
25namespace clang {
Sebastian Redl8538e8d2010-08-18 23:57:32 +000026 namespace serialization {
Sebastian Redlf29f0a22010-08-18 23:57:22 +000027 /// \brief AST file major version number supported by this version of
Douglas Gregorab41e632009-04-27 22:23:34 +000028 /// Clang.
29 ///
Sebastian Redlf29f0a22010-08-18 23:57:22 +000030 /// Whenever the AST file format changes in a way that makes it
Douglas Gregorab41e632009-04-27 22:23:34 +000031 /// incompatible with previous versions (such that a reader
32 /// designed for the previous version could not support reading
33 /// the new version), this number should be increased.
Douglas Gregor445e23e2009-10-05 21:07:28 +000034 ///
Sebastian Redlf29f0a22010-08-18 23:57:22 +000035 /// Version 4 of AST files also requires that the version control branch and
Douglas Gregor445e23e2009-10-05 21:07:28 +000036 /// revision match exactly, since there is no backward compatibility of
Sebastian Redlf29f0a22010-08-18 23:57:22 +000037 /// AST files at this time.
Sebastian Redla93e3b52010-07-08 22:01:51 +000038 const unsigned VERSION_MAJOR = 4;
Douglas Gregorab41e632009-04-27 22:23:34 +000039
Sebastian Redlf29f0a22010-08-18 23:57:22 +000040 /// \brief AST file minor version number supported by this version of
Douglas Gregorab41e632009-04-27 22:23:34 +000041 /// Clang.
42 ///
Sebastian Redlf29f0a22010-08-18 23:57:22 +000043 /// Whenever the AST format changes in a way that is still
Douglas Gregorab41e632009-04-27 22:23:34 +000044 /// compatible with previous versions (such that a reader designed
45 /// for the previous version could still support reading the new
46 /// version by ignoring new kinds of subblocks), this number
47 /// should be increased.
48 const unsigned VERSION_MINOR = 0;
49
Sebastian Redlf29f0a22010-08-18 23:57:22 +000050 /// \brief An ID number that refers to a declaration in an AST file.
Douglas Gregor8038d512009-04-10 17:25:41 +000051 ///
Sebastian Redla93e3b52010-07-08 22:01:51 +000052 /// The ID numbers of declarations are consecutive (in order of
Douglas Gregor8038d512009-04-10 17:25:41 +000053 /// discovery) and start at 2. 0 is reserved for NULL, and 1 is
54 /// reserved for the translation unit declaration.
55 typedef uint32_t DeclID;
56
Sebastian Redlf29f0a22010-08-18 23:57:22 +000057 /// \brief An ID number that refers to a type in an AST file.
Douglas Gregor8038d512009-04-10 17:25:41 +000058 ///
59 /// The ID of a type is partitioned into two parts: the lower
60 /// three bits are used to store the const/volatile/restrict
61 /// qualifiers (as with QualType) and the upper bits provide a
62 /// type index. The type index values are partitioned into two
63 /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type
64 /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a
65 /// placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are
66 /// other types that have serialized representations.
67 typedef uint32_t TypeID;
Douglas Gregor2cf26342009-04-09 22:27:44 +000068
Argyrios Kyrtzidisc8e5d512010-08-20 16:03:59 +000069 /// \brief A type index; the type ID with the qualifier bits removed.
70 class TypeIdx {
71 uint32_t Idx;
72 public:
73 TypeIdx() : Idx(0) { }
74 explicit TypeIdx(uint32_t index) : Idx(index) { }
75
76 uint32_t getIndex() const { return Idx; }
77 TypeID asTypeID(unsigned FastQuals) const {
78 return (Idx << Qualifiers::FastWidth) | FastQuals;
79 }
80 static TypeIdx fromTypeID(TypeID ID) {
81 return TypeIdx(ID >> Qualifiers::FastWidth);
82 }
83 };
84
Argyrios Kyrtzidis5d267682010-08-20 16:04:27 +000085 /// A structure for putting "fast"-unqualified QualTypes into a
86 /// DenseMap. This uses the standard pointer hash function.
87 struct UnsafeQualTypeDenseMapInfo {
88 static inline bool isEqual(QualType A, QualType B) { return A == B; }
89 static inline QualType getEmptyKey() {
90 return QualType::getFromOpaquePtr((void*) 1);
91 }
92 static inline QualType getTombstoneKey() {
93 return QualType::getFromOpaquePtr((void*) 2);
94 }
95 static inline unsigned getHashValue(QualType T) {
96 assert(!T.getLocalFastQualifiers() &&
97 "hash invalid for types with fast quals");
98 uintptr_t v = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
99 return (unsigned(v) >> 4) ^ (unsigned(v) >> 9);
100 }
101 };
102
103 /// \brief Map that provides the ID numbers of each type within the
104 /// output stream, plus those deserialized from a chained PCH.
105 ///
106 /// The ID numbers of types are consecutive (in order of discovery)
107 /// and start at 1. 0 is reserved for NULL. When types are actually
108 /// stored in the stream, the ID number is shifted by 2 bits to
109 /// allow for the const/volatile qualifiers.
110 ///
111 /// Keys in the map never have const/volatile qualifiers.
112 typedef llvm::DenseMap<QualType, TypeIdx, UnsafeQualTypeDenseMapInfo>
113 TypeIdxMap;
114
Sebastian Redlf73c93f2010-09-15 19:54:06 +0000115 /// \brief An ID number that refers to an identifier in an AST file.
Douglas Gregorafaf3082009-04-11 00:14:32 +0000116 typedef uint32_t IdentID;
117
Sebastian Redlf73c93f2010-09-15 19:54:06 +0000118 /// \brief An ID number that refers to a macro in an AST file.
119 typedef uint32_t MacroID;
120
121 /// \brief An ID number that refers to an ObjC selctor in an AST file.
Steve Naroff90cd1bb2009-04-23 10:39:46 +0000122 typedef uint32_t SelectorID;
Mike Stump1eb44332009-09-09 15:08:12 +0000123
Douglas Gregor2cf26342009-04-09 22:27:44 +0000124 /// \brief Describes the various kinds of blocks that occur within
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000125 /// an AST file.
Douglas Gregor2cf26342009-04-09 22:27:44 +0000126 enum BlockIDs {
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000127 /// \brief The AST block, which acts as a container around the
128 /// full AST block.
129 AST_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
Douglas Gregor14f79002009-04-10 03:52:48 +0000130
Douglas Gregor14f79002009-04-10 03:52:48 +0000131 /// \brief The block containing information about the source
132 /// manager.
133 SOURCE_MANAGER_BLOCK_ID,
134
135 /// \brief The block containing information about the
136 /// preprocessor.
137 PREPROCESSOR_BLOCK_ID,
138
Douglas Gregor2cf26342009-04-09 22:27:44 +0000139 /// \brief The block containing the definitions of all of the
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000140 /// types and decls used within the AST file.
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000141 DECLTYPES_BLOCK_ID
Douglas Gregor8038d512009-04-10 17:25:41 +0000142 };
Douglas Gregor2cf26342009-04-09 22:27:44 +0000143
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000144 /// \brief Record types that occur within the AST block itself.
145 enum ASTRecordTypes {
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000146 /// \brief Record code for the offsets of each type.
Douglas Gregor2cf26342009-04-09 22:27:44 +0000147 ///
Douglas Gregor8038d512009-04-10 17:25:41 +0000148 /// The TYPE_OFFSET constant describes the record that occurs
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000149 /// within the AST block. The record itself is an array of offsets that
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000150 /// point into the declarations and types block (identified by
151 /// DECLTYPES_BLOCK_ID). The index into the array is based on the ID
Douglas Gregor8038d512009-04-10 17:25:41 +0000152 /// of a type. For a given type ID @c T, the lower three bits of
153 /// @c T are its qualifiers (const, volatile, restrict), as in
154 /// the QualType class. The upper bits, after being shifted and
155 /// subtracting NUM_PREDEF_TYPE_IDS, are used to index into the
156 /// TYPE_OFFSET block to determine the offset of that type's
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000157 /// corresponding record within the DECLTYPES_BLOCK_ID block.
Douglas Gregor8038d512009-04-10 17:25:41 +0000158 TYPE_OFFSET = 1,
Mike Stump1eb44332009-09-09 15:08:12 +0000159
Douglas Gregor8038d512009-04-10 17:25:41 +0000160 /// \brief Record code for the offsets of each decl.
161 ///
162 /// The DECL_OFFSET constant describes the record that occurs
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000163 /// within the block identified by DECL_OFFSETS_BLOCK_ID within
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000164 /// the AST block. The record itself is an array of offsets that
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000165 /// point into the declarations and types block (identified by
166 /// DECLTYPES_BLOCK_ID). The declaration ID is an index into this
Douglas Gregor8038d512009-04-10 17:25:41 +0000167 /// record, after subtracting one to account for the use of
168 /// declaration ID 0 for a NULL declaration pointer. Index 0 is
169 /// reserved for the translation unit declaration.
Douglas Gregor0a0428e2009-04-10 20:39:37 +0000170 DECL_OFFSET = 2,
171
172 /// \brief Record code for the language options table.
173 ///
174 /// The record with this code contains the contents of the
175 /// LangOptions structure. We serialize the entire contents of
176 /// the structure, and let the reader decide which options are
177 /// actually important to check.
Douglas Gregor2bec0412009-04-10 21:16:55 +0000178 LANGUAGE_OPTIONS = 3,
179
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000180 /// \brief AST file metadata, including the AST file version number
181 /// and the target triple used to build the AST file.
Douglas Gregorab41e632009-04-27 22:23:34 +0000182 METADATA = 4,
Douglas Gregorafaf3082009-04-11 00:14:32 +0000183
184 /// \brief Record code for the table of offsets of each
185 /// identifier ID.
186 ///
187 /// The offset table contains offsets into the blob stored in
188 /// the IDENTIFIER_TABLE record. Each offset points to the
189 /// NULL-terminated string that corresponds to that identifier.
190 IDENTIFIER_OFFSET = 5,
191
192 /// \brief Record code for the identifier table.
193 ///
194 /// The identifier table is a simple blob that contains
195 /// NULL-terminated strings for all of the identifiers
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000196 /// referenced by the AST file. The IDENTIFIER_OFFSET table
Douglas Gregorafaf3082009-04-11 00:14:32 +0000197 /// contains the mapping from identifier IDs to the characters
198 /// in this blob. Note that the starting offsets of all of the
199 /// identifiers are odd, so that, when the identifier offset
200 /// table is loaded in, we can use the low bit to distinguish
201 /// between offsets (for unresolved identifier IDs) and
202 /// IdentifierInfo pointers (for already-resolved identifier
203 /// IDs).
Douglas Gregorfdd01722009-04-14 00:24:19 +0000204 IDENTIFIER_TABLE = 6,
205
206 /// \brief Record code for the array of external definitions.
207 ///
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000208 /// The AST file contains a list of all of the unnamed external
Douglas Gregorfdd01722009-04-14 00:24:19 +0000209 /// definitions present within the parsed headers, stored as an
210 /// array of declaration IDs. These external definitions will be
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000211 /// reported to the AST consumer after the AST file has been
Douglas Gregorfdd01722009-04-14 00:24:19 +0000212 /// read, since their presence can affect the semantics of the
213 /// program (e.g., for code generation).
Douglas Gregor3e1af842009-04-17 22:13:46 +0000214 EXTERNAL_DEFINITIONS = 7,
215
Douglas Gregorad1de002009-04-18 05:55:16 +0000216 /// \brief Record code for the set of non-builtin, special
217 /// types.
218 ///
219 /// This record contains the type IDs for the various type nodes
220 /// that are constructed during semantic analysis (e.g.,
221 /// __builtin_va_list). The SPECIAL_TYPE_* constants provide
222 /// offsets into this record.
223 SPECIAL_TYPES = 8,
224
Douglas Gregor4c0e86b2009-04-22 22:02:47 +0000225 /// \brief Record code for the extra statistics we gather while
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000226 /// generating an AST file.
Douglas Gregor4c0e86b2009-04-22 22:02:47 +0000227 STATISTICS = 9,
228
229 /// \brief Record code for the array of tentative definitions.
Douglas Gregor14c22f22009-04-22 22:18:58 +0000230 TENTATIVE_DEFINITIONS = 10,
231
232 /// \brief Record code for the array of locally-scoped external
233 /// declarations.
Steve Naroff90cd1bb2009-04-23 10:39:46 +0000234 LOCALLY_SCOPED_EXTERNAL_DECLS = 11,
Mike Stump1eb44332009-09-09 15:08:12 +0000235
Douglas Gregor83941df2009-04-25 17:48:32 +0000236 /// \brief Record code for the table of offsets into the
237 /// Objective-C method pool.
238 SELECTOR_OFFSETS = 12,
Douglas Gregorf0aaf7a2009-04-24 21:10:55 +0000239
240 /// \brief Record code for the Objective-C method pool,
Douglas Gregor2eafc1b2009-04-26 00:07:37 +0000241 METHOD_POOL = 13,
242
243 /// \brief The value of the next __COUNTER__ to dispense.
244 /// [PP_COUNTER_VALUE, Val]
Douglas Gregor7f94b0b2009-04-27 06:38:32 +0000245 PP_COUNTER_VALUE = 14,
246
247 /// \brief Record code for the table of offsets into the block
248 /// of source-location information.
249 SOURCE_LOCATION_OFFSETS = 15,
250
251 /// \brief Record code for the set of source location entries
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000252 /// that need to be preloaded by the AST reader.
Douglas Gregor7f94b0b2009-04-27 06:38:32 +0000253 ///
254 /// This set contains the source location entry for the
255 /// predefines buffer and for any file entries that need to be
256 /// preloaded.
Douglas Gregor4fed3f42009-04-27 18:38:38 +0000257 SOURCE_LOCATION_PRELOADS = 16,
258
259 /// \brief Record code for the stat() cache.
Douglas Gregorb81c1702009-04-27 20:06:05 +0000260 STAT_CACHE = 17,
261
262 /// \brief Record code for the set of ext_vector type names.
263 EXT_VECTOR_DECLS = 18,
264
Douglas Gregorb64c1932009-05-12 01:31:05 +0000265 /// \brief Record code for the original file that was used to
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000266 /// generate the AST file.
Argyrios Kyrtzidis1cb35dd2009-07-21 00:06:20 +0000267 ORIGINAL_FILE_NAME = 19,
Mike Stump1eb44332009-09-09 15:08:12 +0000268
Douglas Gregorc6fbbed2010-03-19 22:13:20 +0000269 /// Record #20 intentionally left blank.
Douglas Gregor445e23e2009-10-05 21:07:28 +0000270
Ted Kremenek5b4ec632010-01-22 20:59:36 +0000271 /// \brief Record code for the version control branch and revision
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000272 /// information of the compiler used to build this AST file.
Tanya Lattnere6bbc012010-02-12 00:07:30 +0000273 VERSION_CONTROL_BRANCH_REVISION = 21,
274
Argyrios Kyrtzidis49b96d12010-08-13 18:42:17 +0000275 /// \brief Record code for the array of unused file scoped decls.
276 UNUSED_FILESCOPED_DECLS = 22,
Tanya Lattnere6bbc012010-02-12 00:07:30 +0000277
Douglas Gregor6a5a23f2010-03-19 21:51:54 +0000278 /// \brief Record code for the table of offsets to macro definition
279 /// entries in the preprocessing record.
Argyrios Kyrtzidisd455add2010-07-06 15:37:04 +0000280 MACRO_DEFINITION_OFFSETS = 23,
281
282 /// \brief Record code for the array of VTable uses.
283 VTABLE_USES = 24,
284
285 /// \brief Record code for the array of dynamic classes.
Sebastian Redla93e3b52010-07-08 22:01:51 +0000286 DYNAMIC_CLASSES = 25,
287
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000288 /// \brief Record code for the chained AST metadata, including the
289 /// AST file version and the name of the PCH this depends on.
Fariborz Jahanian32019832010-07-23 19:11:11 +0000290 CHAINED_METADATA = 26,
Sebastian Redld692af72010-07-27 18:24:41 +0000291
Sebastian Redl681d7232010-07-27 00:17:23 +0000292 /// \brief Record code for referenced selector pool.
Sebastian Redld692af72010-07-27 18:24:41 +0000293 REFERENCED_SELECTOR_POOL = 27,
294
295 /// \brief Record code for an update to the TU's lexically contained
296 /// declarations.
Argyrios Kyrtzidis76c38d32010-08-02 07:14:54 +0000297 TU_UPDATE_LEXICAL = 28,
298
Argyrios Kyrtzidisa8650052010-08-03 17:30:10 +0000299 /// \brief Record code for an update to first decls pointing to the
300 /// latest redeclarations.
301 REDECLS_UPDATE_LATEST = 29,
302
Argyrios Kyrtzidis76c38d32010-08-02 07:14:54 +0000303 /// \brief Record code for declarations that Sema keeps references of.
Argyrios Kyrtzidis72b90572010-08-05 09:48:08 +0000304 SEMA_DECL_REFS = 30,
305
306 /// \brief Record code for weak undeclared identifiers.
Argyrios Kyrtzidis0e036382010-08-05 09:48:16 +0000307 WEAK_UNDECLARED_IDENTIFIERS = 31,
308
309 /// \brief Record code for pending implicit instantiations.
Sebastian Redl0b17c612010-08-13 00:28:03 +0000310 PENDING_IMPLICIT_INSTANTIATIONS = 32,
311
312 /// \brief Record code for a decl replacement block.
313 ///
314 /// If a declaration is modified after having been deserialized, and then
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000315 /// written to a dependent AST file, its ID and offset must be added to
Sebastian Redl0b17c612010-08-13 00:28:03 +0000316 /// the replacement block.
Sebastian Redl8b122732010-08-24 00:49:55 +0000317 DECL_REPLACEMENTS = 33,
318
319 /// \brief Record code for an update to a decl context's lookup table.
320 ///
321 /// In practice, this should only be used for the TU and namespaces.
Sebastian Redl6e50e002010-08-24 22:50:19 +0000322 UPDATE_VISIBLE = 34,
323
324 /// \brief Record code for template specializations introduced after
325 /// serializations of the original template decl.
326 ADDITIONAL_TEMPLATE_SPECIALIZATIONS = 35
Douglas Gregor2cf26342009-04-09 22:27:44 +0000327 };
328
Douglas Gregor14f79002009-04-10 03:52:48 +0000329 /// \brief Record types used within a source manager block.
330 enum SourceManagerRecordTypes {
331 /// \brief Describes a source location entry (SLocEntry) for a
332 /// file.
333 SM_SLOC_FILE_ENTRY = 1,
334 /// \brief Describes a source location entry (SLocEntry) for a
335 /// buffer.
336 SM_SLOC_BUFFER_ENTRY = 2,
337 /// \brief Describes a blob that contains the data for a buffer
338 /// entry. This kind of record always directly follows a
339 /// SM_SLOC_BUFFER_ENTRY record.
340 SM_SLOC_BUFFER_BLOB = 3,
341 /// \brief Describes a source location entry (SLocEntry) for a
342 /// macro instantiation.
Douglas Gregorbd945002009-04-13 16:31:14 +0000343 SM_SLOC_INSTANTIATION_ENTRY = 4,
344 /// \brief Describes the SourceManager's line table, with
345 /// information about #line directives.
Douglas Gregor12fab312010-03-16 16:35:32 +0000346 SM_LINE_TABLE = 5
Douglas Gregor14f79002009-04-10 03:52:48 +0000347 };
Mike Stump1eb44332009-09-09 15:08:12 +0000348
Chris Lattner7c5d24e2009-04-10 18:00:12 +0000349 /// \brief Record types used within a preprocessor block.
350 enum PreprocessorRecordTypes {
351 // The macros in the PP section are a PP_MACRO_* instance followed by a
352 // list of PP_TOKEN instances for each token in the definition.
353
354 /// \brief An object-like macro definition.
355 /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
356 PP_MACRO_OBJECT_LIKE = 1,
357
358 /// \brief A function-like macro definition.
359 /// [PP_MACRO_FUNCTION_LIKE, <ObjectLikeStuff>, IsC99Varargs, IsGNUVarars,
360 /// NumArgs, ArgIdentInfoID* ]
361 PP_MACRO_FUNCTION_LIKE = 2,
Mike Stump1eb44332009-09-09 15:08:12 +0000362
Chris Lattner7c5d24e2009-04-10 18:00:12 +0000363 /// \brief Describes one token.
Chris Lattnerc1f9d822009-04-13 01:29:17 +0000364 /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
Douglas Gregor6a5a23f2010-03-19 21:51:54 +0000365 PP_TOKEN = 3,
366
367 /// \brief Describes a macro instantiation within the preprocessing
368 /// record.
369 PP_MACRO_INSTANTIATION = 4,
370
371 /// \brief Describes a macro definition within the preprocessing record.
372 PP_MACRO_DEFINITION = 5
Chris Lattner7c5d24e2009-04-10 18:00:12 +0000373 };
Douglas Gregor14f79002009-04-10 03:52:48 +0000374
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000375 /// \defgroup ASTAST AST file AST constants
Douglas Gregor14f79002009-04-10 03:52:48 +0000376 ///
377 /// The constants in this group describe various components of the
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000378 /// abstract syntax tree within an AST file.
Douglas Gregor14f79002009-04-10 03:52:48 +0000379 ///
380 /// @{
381
Douglas Gregor2cf26342009-04-09 22:27:44 +0000382 /// \brief Predefined type IDs.
383 ///
384 /// These type IDs correspond to predefined types in the AST
385 /// context, such as built-in types (int) and special place-holder
386 /// types (the <overload> and <dependent> type markers). Such
387 /// types are never actually serialized, since they will be built
388 /// by the AST context when it is created.
389 enum PredefinedTypeIDs {
390 /// \brief The NULL type.
391 PREDEF_TYPE_NULL_ID = 0,
392 /// \brief The void type.
393 PREDEF_TYPE_VOID_ID = 1,
394 /// \brief The 'bool' or '_Bool' type.
395 PREDEF_TYPE_BOOL_ID = 2,
396 /// \brief The 'char' type, when it is unsigned.
397 PREDEF_TYPE_CHAR_U_ID = 3,
398 /// \brief The 'unsigned char' type.
399 PREDEF_TYPE_UCHAR_ID = 4,
400 /// \brief The 'unsigned short' type.
401 PREDEF_TYPE_USHORT_ID = 5,
402 /// \brief The 'unsigned int' type.
403 PREDEF_TYPE_UINT_ID = 6,
404 /// \brief The 'unsigned long' type.
405 PREDEF_TYPE_ULONG_ID = 7,
406 /// \brief The 'unsigned long long' type.
407 PREDEF_TYPE_ULONGLONG_ID = 8,
408 /// \brief The 'char' type, when it is signed.
409 PREDEF_TYPE_CHAR_S_ID = 9,
410 /// \brief The 'signed char' type.
411 PREDEF_TYPE_SCHAR_ID = 10,
412 /// \brief The C++ 'wchar_t' type.
413 PREDEF_TYPE_WCHAR_ID = 11,
414 /// \brief The (signed) 'short' type.
415 PREDEF_TYPE_SHORT_ID = 12,
416 /// \brief The (signed) 'int' type.
417 PREDEF_TYPE_INT_ID = 13,
418 /// \brief The (signed) 'long' type.
419 PREDEF_TYPE_LONG_ID = 14,
420 /// \brief The (signed) 'long long' type.
421 PREDEF_TYPE_LONGLONG_ID = 15,
422 /// \brief The 'float' type.
423 PREDEF_TYPE_FLOAT_ID = 16,
424 /// \brief The 'double' type.
425 PREDEF_TYPE_DOUBLE_ID = 17,
426 /// \brief The 'long double' type.
427 PREDEF_TYPE_LONGDOUBLE_ID = 18,
428 /// \brief The placeholder type for overloaded function sets.
429 PREDEF_TYPE_OVERLOAD_ID = 19,
430 /// \brief The placeholder type for dependent types.
Chris Lattner2df9ced2009-04-30 02:43:43 +0000431 PREDEF_TYPE_DEPENDENT_ID = 20,
432 /// \brief The '__uint128_t' type.
433 PREDEF_TYPE_UINT128_ID = 21,
434 /// \brief The '__int128_t' type.
Sebastian Redl6e8ed162009-05-10 18:38:11 +0000435 PREDEF_TYPE_INT128_ID = 22,
436 /// \brief The type of 'nullptr'.
Alisdair Meredithf5c209d2009-07-14 06:30:34 +0000437 PREDEF_TYPE_NULLPTR_ID = 23,
438 /// \brief The C++ 'char16_t' type.
439 PREDEF_TYPE_CHAR16_ID = 24,
440 /// \brief The C++ 'char32_t' type.
Steve Naroffde2e22d2009-07-15 18:40:39 +0000441 PREDEF_TYPE_CHAR32_ID = 25,
442 /// \brief The ObjC 'id' type.
443 PREDEF_TYPE_OBJC_ID = 26,
444 /// \brief The ObjC 'Class' type.
Fariborz Jahanian13dcd002009-11-21 19:53:08 +0000445 PREDEF_TYPE_OBJC_CLASS = 27,
446 /// \brief The ObjC 'SEL' type.
447 PREDEF_TYPE_OBJC_SEL = 28
Douglas Gregor2cf26342009-04-09 22:27:44 +0000448 };
449
450 /// \brief The number of predefined type IDs that are reserved for
451 /// the PREDEF_TYPE_* constants.
452 ///
453 /// Type IDs for non-predefined types will start at
454 /// NUM_PREDEF_TYPE_IDs.
455 const unsigned NUM_PREDEF_TYPE_IDS = 100;
456
457 /// \brief Record codes for each kind of type.
458 ///
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000459 /// These constants describe the type records that can occur within a
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000460 /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
Douglas Gregor2cf26342009-04-09 22:27:44 +0000461 /// constant describes a record for a specific type class in the
462 /// AST.
463 enum TypeCode {
464 /// \brief An ExtQualType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000465 TYPE_EXT_QUAL = 1,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000466 /// \brief A ComplexType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000467 TYPE_COMPLEX = 3,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000468 /// \brief A PointerType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000469 TYPE_POINTER = 4,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000470 /// \brief A BlockPointerType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000471 TYPE_BLOCK_POINTER = 5,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000472 /// \brief An LValueReferenceType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000473 TYPE_LVALUE_REFERENCE = 6,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000474 /// \brief An RValueReferenceType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000475 TYPE_RVALUE_REFERENCE = 7,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000476 /// \brief A MemberPointerType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000477 TYPE_MEMBER_POINTER = 8,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000478 /// \brief A ConstantArrayType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000479 TYPE_CONSTANT_ARRAY = 9,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000480 /// \brief An IncompleteArrayType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000481 TYPE_INCOMPLETE_ARRAY = 10,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000482 /// \brief A VariableArrayType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000483 TYPE_VARIABLE_ARRAY = 11,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000484 /// \brief A VectorType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000485 TYPE_VECTOR = 12,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000486 /// \brief An ExtVectorType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000487 TYPE_EXT_VECTOR = 13,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000488 /// \brief A FunctionNoProtoType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000489 TYPE_FUNCTION_NO_PROTO = 14,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000490 /// \brief A FunctionProtoType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000491 TYPE_FUNCTION_PROTO = 15,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000492 /// \brief A TypedefType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000493 TYPE_TYPEDEF = 16,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000494 /// \brief A TypeOfExprType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000495 TYPE_TYPEOF_EXPR = 17,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000496 /// \brief A TypeOfType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000497 TYPE_TYPEOF = 18,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000498 /// \brief A RecordType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000499 TYPE_RECORD = 19,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000500 /// \brief An EnumType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000501 TYPE_ENUM = 20,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000502 /// \brief An ObjCInterfaceType record.
Douglas Gregor63f5c262009-04-16 02:45:14 +0000503 TYPE_OBJC_INTERFACE = 21,
Steve Naroffd1b3c2d2009-06-17 22:40:22 +0000504 /// \brief An ObjCObjectPointerType record.
Steve Naroffc15cb2a2009-07-18 15:33:26 +0000505 TYPE_OBJC_OBJECT_POINTER = 22,
Anders Carlsson395b4752009-06-24 19:06:50 +0000506 /// \brief a DecltypeType record.
John McCall54e14c42009-10-22 22:37:11 +0000507 TYPE_DECLTYPE = 23,
John McCall7da24312009-09-05 00:15:47 +0000508 /// \brief An ElaboratedType record.
John McCall54e14c42009-10-22 22:37:11 +0000509 TYPE_ELABORATED = 24,
John McCall49a832b2009-10-18 09:09:24 +0000510 /// \brief A SubstTemplateTypeParmType record.
John McCalled976492009-12-04 22:46:56 +0000511 TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
512 /// \brief An UnresolvedUsingType record.
John McCall3cb0ebd2010-03-10 03:28:59 +0000513 TYPE_UNRESOLVED_USING = 26,
514 /// \brief An InjectedClassNameType record.
John McCallc12c5bb2010-05-15 11:32:37 +0000515 TYPE_INJECTED_CLASS_NAME = 27,
516 /// \brief An ObjCObjectType record.
Argyrios Kyrtzidis90b715e2010-06-19 19:28:53 +0000517 TYPE_OBJC_OBJECT = 28,
518 /// \brief An TemplateTypeParmType record.
519 TYPE_TEMPLATE_TYPE_PARM = 29,
520 /// \brief An TemplateSpecializationType record.
Argyrios Kyrtzidis8dfbd8b2010-06-24 08:57:31 +0000521 TYPE_TEMPLATE_SPECIALIZATION = 30,
Argyrios Kyrtzidis3acad622010-06-25 16:24:58 +0000522 /// \brief A DependentNameType record.
523 TYPE_DEPENDENT_NAME = 31,
524 /// \brief A DependentTemplateSpecializationType record.
Argyrios Kyrtzidisae8b17f2010-06-30 08:49:25 +0000525 TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
526 /// \brief A DependentSizedArrayType record.
527 TYPE_DEPENDENT_SIZED_ARRAY = 33
Douglas Gregor2cf26342009-04-09 22:27:44 +0000528 };
529
Douglas Gregorad1de002009-04-18 05:55:16 +0000530 /// \brief The type IDs for special types constructed by semantic
531 /// analysis.
532 ///
533 /// The constants in this enumeration are indices into the
534 /// SPECIAL_TYPES record.
535 enum SpecialTypeIDs {
536 /// \brief __builtin_va_list
Douglas Gregor319ac892009-04-23 22:29:11 +0000537 SPECIAL_TYPE_BUILTIN_VA_LIST = 0,
538 /// \brief Objective-C "id" type
539 SPECIAL_TYPE_OBJC_ID = 1,
540 /// \brief Objective-C selector type
541 SPECIAL_TYPE_OBJC_SELECTOR = 2,
542 /// \brief Objective-C Protocol type
543 SPECIAL_TYPE_OBJC_PROTOCOL = 3,
544 /// \brief Objective-C Class type
545 SPECIAL_TYPE_OBJC_CLASS = 4,
546 /// \brief CFConstantString type
547 SPECIAL_TYPE_CF_CONSTANT_STRING = 5,
548 /// \brief Objective-C fast enumeration state type
Douglas Gregorc29f77b2009-07-07 16:35:42 +0000549 SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE = 6,
550 /// \brief C FILE typedef type
Mike Stump782fa302009-07-28 02:25:19 +0000551 SPECIAL_TYPE_FILE = 7,
552 /// \brief C jmp_buf typedef type
553 SPECIAL_TYPE_jmp_buf = 8,
554 /// \brief C sigjmp_buf typedef type
Douglas Gregord1571ac2009-08-21 00:27:50 +0000555 SPECIAL_TYPE_sigjmp_buf = 9,
556 /// \brief Objective-C "id" redefinition type
557 SPECIAL_TYPE_OBJC_ID_REDEFINITION = 10,
558 /// \brief Objective-C "Class" redefinition type
Mike Stumpadaaad32009-10-20 02:12:22 +0000559 SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 11,
560 /// \brief Block descriptor type for Blocks CodeGen
Mike Stump083c25e2009-10-22 00:49:09 +0000561 SPECIAL_TYPE_BLOCK_DESCRIPTOR = 12,
562 /// \brief Block extedned descriptor type for Blocks CodeGen
Fariborz Jahanian13dcd002009-11-21 19:53:08 +0000563 SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR = 13,
564 /// \brief Objective-C "SEL" redefinition type
Fariborz Jahanian2bb5dda2010-04-23 17:41:07 +0000565 SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 14,
566 /// \brief NSConstantString type
Argyrios Kyrtzidis00611382010-07-04 21:44:19 +0000567 SPECIAL_TYPE_NS_CONSTANT_STRING = 15,
568 /// \brief Whether __[u]int128_t identifier is installed.
569 SPECIAL_TYPE_INT128_INSTALLED = 16
Douglas Gregorad1de002009-04-18 05:55:16 +0000570 };
571
Douglas Gregor2cf26342009-04-09 22:27:44 +0000572 /// \brief Record codes for each kind of declaration.
573 ///
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000574 /// These constants describe the declaration records that can occur within
575 /// a declarations block (identified by DECLS_BLOCK_ID). Each
Douglas Gregor2cf26342009-04-09 22:27:44 +0000576 /// constant describes a record for a specific declaration class
577 /// in the AST.
578 enum DeclCode {
Douglas Gregor68a2eb02009-04-15 21:30:51 +0000579 /// \brief Attributes attached to a declaration.
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000580 DECL_ATTR = 50,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000581 /// \brief A TranslationUnitDecl record.
Douglas Gregor68a2eb02009-04-15 21:30:51 +0000582 DECL_TRANSLATION_UNIT,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000583 /// \brief A TypedefDecl record.
584 DECL_TYPEDEF,
Douglas Gregor0a2b45e2009-04-13 18:14:40 +0000585 /// \brief An EnumDecl record.
586 DECL_ENUM,
Douglas Gregor8c700062009-04-13 21:20:57 +0000587 /// \brief A RecordDecl record.
588 DECL_RECORD,
Douglas Gregor0a2b45e2009-04-13 18:14:40 +0000589 /// \brief An EnumConstantDecl record.
590 DECL_ENUM_CONSTANT,
Douglas Gregor3a2f7e42009-04-13 22:18:37 +0000591 /// \brief A FunctionDecl record.
592 DECL_FUNCTION,
Steve Naroff53c9d8a2009-04-20 15:06:07 +0000593 /// \brief A ObjCMethodDecl record.
594 DECL_OBJC_METHOD,
Steve Naroff33feeb02009-04-20 20:09:33 +0000595 /// \brief A ObjCInterfaceDecl record.
Steve Naroff30833f82009-04-21 15:12:33 +0000596 DECL_OBJC_INTERFACE,
597 /// \brief A ObjCProtocolDecl record.
598 DECL_OBJC_PROTOCOL,
Steve Naroff33feeb02009-04-20 20:09:33 +0000599 /// \brief A ObjCIvarDecl record.
Steve Naroff30833f82009-04-21 15:12:33 +0000600 DECL_OBJC_IVAR,
601 /// \brief A ObjCAtDefsFieldDecl record.
602 DECL_OBJC_AT_DEFS_FIELD,
603 /// \brief A ObjCClassDecl record.
604 DECL_OBJC_CLASS,
605 /// \brief A ObjCForwardProtocolDecl record.
606 DECL_OBJC_FORWARD_PROTOCOL,
607 /// \brief A ObjCCategoryDecl record.
608 DECL_OBJC_CATEGORY,
609 /// \brief A ObjCCategoryImplDecl record.
610 DECL_OBJC_CATEGORY_IMPL,
611 /// \brief A ObjCImplementationDecl record.
612 DECL_OBJC_IMPLEMENTATION,
613 /// \brief A ObjCCompatibleAliasDecl record.
614 DECL_OBJC_COMPATIBLE_ALIAS,
615 /// \brief A ObjCPropertyDecl record.
616 DECL_OBJC_PROPERTY,
617 /// \brief A ObjCPropertyImplDecl record.
618 DECL_OBJC_PROPERTY_IMPL,
Douglas Gregor8c700062009-04-13 21:20:57 +0000619 /// \brief A FieldDecl record.
620 DECL_FIELD,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000621 /// \brief A VarDecl record.
622 DECL_VAR,
Douglas Gregor405bad02009-04-26 22:20:50 +0000623 /// \brief An ImplicitParamDecl record.
624 DECL_IMPLICIT_PARAM,
Douglas Gregor3a2f7e42009-04-13 22:18:37 +0000625 /// \brief A ParmVarDecl record.
626 DECL_PARM_VAR,
Douglas Gregor1028bc62009-04-13 22:49:25 +0000627 /// \brief A FileScopeAsmDecl record.
628 DECL_FILE_SCOPE_ASM,
629 /// \brief A BlockDecl record.
630 DECL_BLOCK,
Douglas Gregor2cf26342009-04-09 22:27:44 +0000631 /// \brief A record that stores the set of declarations that are
632 /// lexically stored within a given DeclContext.
633 ///
Sebastian Redl681d7232010-07-27 00:17:23 +0000634 /// The record itself is a blob that is an array of declaration IDs,
635 /// in the order in which those declarations were added to the
Douglas Gregor2cf26342009-04-09 22:27:44 +0000636 /// declaration context. This data is used when iterating over
637 /// the contents of a DeclContext, e.g., via
638 /// DeclContext::decls_begin()/DeclContext::decls_end().
639 DECL_CONTEXT_LEXICAL,
640 /// \brief A record that stores the set of declarations that are
641 /// visible from a given DeclContext.
642 ///
643 /// The record itself stores a set of mappings, each of which
644 /// associates a declaration name with one or more declaration
645 /// IDs. This data is used when performing qualified name lookup
646 /// into a DeclContext via DeclContext::lookup.
Douglas Gregor0cef4832010-02-21 18:22:14 +0000647 DECL_CONTEXT_VISIBLE,
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000648 /// \brief A NamespaceDecl rcord.
649 DECL_NAMESPACE,
650 /// \brief A NamespaceAliasDecl record.
651 DECL_NAMESPACE_ALIAS,
652 /// \brief A UsingDecl record.
653 DECL_USING,
654 /// \brief A UsingShadowDecl record.
655 DECL_USING_SHADOW,
656 /// \brief A UsingDirecitveDecl record.
657 DECL_USING_DIRECTIVE,
658 /// \brief An UnresolvedUsingValueDecl record.
659 DECL_UNRESOLVED_USING_VALUE,
660 /// \brief An UnresolvedUsingTypenameDecl record.
661 DECL_UNRESOLVED_USING_TYPENAME,
662 /// \brief A LinkageSpecDecl record.
663 DECL_LINKAGE_SPEC,
664 /// \brief A CXXRecordDecl record.
665 DECL_CXX_RECORD,
666 /// \brief A CXXMethodDecl record.
667 DECL_CXX_METHOD,
668 /// \brief A CXXConstructorDecl record.
669 DECL_CXX_CONSTRUCTOR,
670 /// \brief A CXXDestructorDecl record.
671 DECL_CXX_DESTRUCTOR,
672 /// \brief A CXXConversionDecl record.
673 DECL_CXX_CONVERSION,
Abramo Bagnara6206d532010-06-05 05:09:32 +0000674 /// \brief An AccessSpecDecl record.
675 DECL_ACCESS_SPEC,
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000676
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000677 /// \brief A FriendDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000678 DECL_FRIEND,
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000679 /// \brief A FriendTemplateDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000680 DECL_FRIEND_TEMPLATE,
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000681 /// \brief A ClassTemplateDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000682 DECL_CLASS_TEMPLATE,
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000683 /// \brief A ClassTemplateSpecializationDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000684 DECL_CLASS_TEMPLATE_SPECIALIZATION,
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000685 /// \brief A ClassTemplatePartialSpecializationDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000686 DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000687 /// \brief A FunctionTemplateDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000688 DECL_FUNCTION_TEMPLATE,
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000689 /// \brief A TemplateTypeParmDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000690 DECL_TEMPLATE_TYPE_PARM,
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000691 /// \brief A NonTypeTemplateParmDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000692 DECL_NON_TYPE_TEMPLATE_PARM,
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000693 /// \brief A TemplateTemplateParmDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000694 DECL_TEMPLATE_TEMPLATE_PARM,
Argyrios Kyrtzidis5f3dbf52010-07-22 17:28:27 +0000695 /// \brief A StaticAssertDecl record.
Chris Lattner6ad9ac02010-05-07 21:43:38 +0000696 DECL_STATIC_ASSERT
Douglas Gregor2cf26342009-04-09 22:27:44 +0000697 };
Douglas Gregor0b748912009-04-14 21:18:50 +0000698
699 /// \brief Record codes for each kind of statement or expression.
700 ///
701 /// These constants describe the records that describe statements
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000702 /// or expressions. These records occur within type and declarations
703 /// block, so they begin with record values of 100. Each constant
704 /// describes a record for a specific statement or expression class in the
705 /// AST.
Douglas Gregor0b748912009-04-14 21:18:50 +0000706 enum StmtCode {
Douglas Gregor087fd532009-04-14 23:32:43 +0000707 /// \brief A marker record that indicates that we are at the end
708 /// of an expression.
Douglas Gregor61d60ee2009-10-17 00:13:19 +0000709 STMT_STOP = 100,
Douglas Gregor0b748912009-04-14 21:18:50 +0000710 /// \brief A NULL expression.
Douglas Gregorc9490c02009-04-16 22:23:12 +0000711 STMT_NULL_PTR,
Douglas Gregor025452f2009-04-17 00:04:06 +0000712 /// \brief A NullStmt record.
713 STMT_NULL,
714 /// \brief A CompoundStmt record.
715 STMT_COMPOUND,
716 /// \brief A CaseStmt record.
717 STMT_CASE,
718 /// \brief A DefaultStmt record.
719 STMT_DEFAULT,
Douglas Gregor1de05fe2009-04-17 18:18:49 +0000720 /// \brief A LabelStmt record.
721 STMT_LABEL,
Douglas Gregor025452f2009-04-17 00:04:06 +0000722 /// \brief An IfStmt record.
723 STMT_IF,
724 /// \brief A SwitchStmt record.
725 STMT_SWITCH,
Douglas Gregord921cf92009-04-17 00:16:09 +0000726 /// \brief A WhileStmt record.
727 STMT_WHILE,
Douglas Gregor67d82492009-04-17 00:29:51 +0000728 /// \brief A DoStmt record.
729 STMT_DO,
730 /// \brief A ForStmt record.
731 STMT_FOR,
Douglas Gregor1de05fe2009-04-17 18:18:49 +0000732 /// \brief A GotoStmt record.
733 STMT_GOTO,
Douglas Gregor7d5c2f22009-04-17 18:58:21 +0000734 /// \brief An IndirectGotoStmt record.
735 STMT_INDIRECT_GOTO,
Douglas Gregord921cf92009-04-17 00:16:09 +0000736 /// \brief A ContinueStmt record.
737 STMT_CONTINUE,
Douglas Gregor025452f2009-04-17 00:04:06 +0000738 /// \brief A BreakStmt record.
739 STMT_BREAK,
Douglas Gregor0de9d882009-04-17 16:34:57 +0000740 /// \brief A ReturnStmt record.
741 STMT_RETURN,
Douglas Gregor84f21702009-04-17 16:55:36 +0000742 /// \brief A DeclStmt record.
743 STMT_DECL,
Douglas Gregorcd7d5a92009-04-17 20:57:14 +0000744 /// \brief An AsmStmt record.
745 STMT_ASM,
Douglas Gregor17fc2232009-04-14 21:55:33 +0000746 /// \brief A PredefinedExpr record.
747 EXPR_PREDEFINED,
Douglas Gregor0b748912009-04-14 21:18:50 +0000748 /// \brief A DeclRefExpr record.
749 EXPR_DECL_REF,
750 /// \brief An IntegerLiteral record.
751 EXPR_INTEGER_LITERAL,
Douglas Gregor17fc2232009-04-14 21:55:33 +0000752 /// \brief A FloatingLiteral record.
753 EXPR_FLOATING_LITERAL,
Douglas Gregorcb2ca732009-04-15 22:19:53 +0000754 /// \brief An ImaginaryLiteral record.
755 EXPR_IMAGINARY_LITERAL,
Douglas Gregor673ecd62009-04-15 16:35:07 +0000756 /// \brief A StringLiteral record.
757 EXPR_STRING_LITERAL,
Douglas Gregor0b748912009-04-14 21:18:50 +0000758 /// \brief A CharacterLiteral record.
Douglas Gregor087fd532009-04-14 23:32:43 +0000759 EXPR_CHARACTER_LITERAL,
Douglas Gregorc04db4f2009-04-14 23:59:37 +0000760 /// \brief A ParenExpr record.
761 EXPR_PAREN,
Argyrios Kyrtzidis37bdfe22010-06-30 08:49:18 +0000762 /// \brief A ParenListExpr record.
763 EXPR_PAREN_LIST,
Douglas Gregor0b0b77f2009-04-15 15:58:59 +0000764 /// \brief A UnaryOperator record.
765 EXPR_UNARY_OPERATOR,
Douglas Gregor8ecdb652010-04-28 22:16:22 +0000766 /// \brief An OffsetOfExpr record.
767 EXPR_OFFSETOF,
Douglas Gregor0b0b77f2009-04-15 15:58:59 +0000768 /// \brief A SizefAlignOfExpr record.
769 EXPR_SIZEOF_ALIGN_OF,
Douglas Gregorcb2ca732009-04-15 22:19:53 +0000770 /// \brief An ArraySubscriptExpr record.
771 EXPR_ARRAY_SUBSCRIPT,
Douglas Gregor1f0d0132009-04-15 17:43:59 +0000772 /// \brief A CallExpr record.
773 EXPR_CALL,
774 /// \brief A MemberExpr record.
775 EXPR_MEMBER,
Douglas Gregordb600c32009-04-15 00:25:59 +0000776 /// \brief A BinaryOperator record.
777 EXPR_BINARY_OPERATOR,
Douglas Gregorad90e962009-04-15 22:40:36 +0000778 /// \brief A CompoundAssignOperator record.
779 EXPR_COMPOUND_ASSIGN_OPERATOR,
780 /// \brief A ConditionOperator record.
781 EXPR_CONDITIONAL_OPERATOR,
Douglas Gregor087fd532009-04-14 23:32:43 +0000782 /// \brief An ImplicitCastExpr record.
Douglas Gregordb600c32009-04-15 00:25:59 +0000783 EXPR_IMPLICIT_CAST,
784 /// \brief A CStyleCastExpr record.
Douglas Gregord3c98a02009-04-15 23:02:49 +0000785 EXPR_CSTYLE_CAST,
Douglas Gregorba6d7e72009-04-16 02:33:48 +0000786 /// \brief A CompoundLiteralExpr record.
787 EXPR_COMPOUND_LITERAL,
Douglas Gregord3c98a02009-04-15 23:02:49 +0000788 /// \brief An ExtVectorElementExpr record.
789 EXPR_EXT_VECTOR_ELEMENT,
Douglas Gregord077d752009-04-16 00:55:48 +0000790 /// \brief An InitListExpr record.
791 EXPR_INIT_LIST,
792 /// \brief A DesignatedInitExpr record.
793 EXPR_DESIGNATED_INIT,
794 /// \brief An ImplicitValueInitExpr record.
795 EXPR_IMPLICIT_VALUE_INIT,
Douglas Gregord3c98a02009-04-15 23:02:49 +0000796 /// \brief A VAArgExpr record.
Douglas Gregor44cae0c2009-04-15 23:33:31 +0000797 EXPR_VA_ARG,
Douglas Gregor6a2dd552009-04-17 19:05:30 +0000798 /// \brief An AddrLabelExpr record.
Douglas Gregor7d5c2f22009-04-17 18:58:21 +0000799 EXPR_ADDR_LABEL,
Douglas Gregor6a2dd552009-04-17 19:05:30 +0000800 /// \brief A StmtExpr record.
801 EXPR_STMT,
Douglas Gregor44cae0c2009-04-15 23:33:31 +0000802 /// \brief A TypesCompatibleExpr record.
803 EXPR_TYPES_COMPATIBLE,
804 /// \brief A ChooseExpr record.
805 EXPR_CHOOSE,
806 /// \brief A GNUNullExpr record.
Douglas Gregor94cd5d12009-04-16 00:01:45 +0000807 EXPR_GNU_NULL,
808 /// \brief A ShuffleVectorExpr record.
809 EXPR_SHUFFLE_VECTOR,
Douglas Gregor84af7c22009-04-17 19:21:43 +0000810 /// \brief BlockExpr
811 EXPR_BLOCK,
812 /// \brief A BlockDeclRef record.
Chris Lattner4dcf151a2009-04-22 05:57:30 +0000813 EXPR_BLOCK_DECL_REF,
Douglas Gregor39da0b82009-09-09 23:08:42 +0000814
Chris Lattner4dcf151a2009-04-22 05:57:30 +0000815 // Objective-C
Mike Stump1eb44332009-09-09 15:08:12 +0000816
Chris Lattner0389e6b2009-04-26 00:44:05 +0000817 /// \brief An ObjCStringLiteral record.
Chris Lattner3a57a372009-04-22 06:29:42 +0000818 EXPR_OBJC_STRING_LITERAL,
Chris Lattner0389e6b2009-04-26 00:44:05 +0000819 /// \brief An ObjCEncodeExpr record.
Chris Lattner3a57a372009-04-22 06:29:42 +0000820 EXPR_OBJC_ENCODE,
Chris Lattner0389e6b2009-04-26 00:44:05 +0000821 /// \brief An ObjCSelectorExpr record.
Chris Lattner3a57a372009-04-22 06:29:42 +0000822 EXPR_OBJC_SELECTOR_EXPR,
Chris Lattner0389e6b2009-04-26 00:44:05 +0000823 /// \brief An ObjCProtocolExpr record.
Steve Naroffc4f0bbd2009-04-25 14:04:28 +0000824 EXPR_OBJC_PROTOCOL_EXPR,
Chris Lattner0389e6b2009-04-26 00:44:05 +0000825 /// \brief An ObjCIvarRefExpr record.
826 EXPR_OBJC_IVAR_REF_EXPR,
827 /// \brief An ObjCPropertyRefExpr record.
828 EXPR_OBJC_PROPERTY_REF_EXPR,
Fariborz Jahanian09105f52009-08-20 17:02:02 +0000829 /// \brief An ObjCImplicitSetterGetterRefExpr record.
Chris Lattner0389e6b2009-04-26 00:44:05 +0000830 EXPR_OBJC_KVC_REF_EXPR,
831 /// \brief An ObjCMessageExpr record.
832 EXPR_OBJC_MESSAGE_EXPR,
833 /// \brief An ObjCSuperExpr record.
Steve Naroff1eb55402009-04-26 18:52:16 +0000834 EXPR_OBJC_SUPER_EXPR,
Steve Narofff242b1b2009-07-24 17:54:45 +0000835 /// \brief An ObjCIsa Expr record.
836 EXPR_OBJC_ISA,
Mike Stump1eb44332009-09-09 15:08:12 +0000837
838 /// \brief An ObjCForCollectionStmt record.
Steve Naroff1eb55402009-04-26 18:52:16 +0000839 STMT_OBJC_FOR_COLLECTION,
Mike Stump1eb44332009-09-09 15:08:12 +0000840 /// \brief An ObjCAtCatchStmt record.
Steve Naroff1eb55402009-04-26 18:52:16 +0000841 STMT_OBJC_CATCH,
Mike Stump1eb44332009-09-09 15:08:12 +0000842 /// \brief An ObjCAtFinallyStmt record.
Steve Naroff1eb55402009-04-26 18:52:16 +0000843 STMT_OBJC_FINALLY,
Mike Stump1eb44332009-09-09 15:08:12 +0000844 /// \brief An ObjCAtTryStmt record.
Steve Naroff1eb55402009-04-26 18:52:16 +0000845 STMT_OBJC_AT_TRY,
Mike Stump1eb44332009-09-09 15:08:12 +0000846 /// \brief An ObjCAtSynchronizedStmt record.
Steve Naroff1eb55402009-04-26 18:52:16 +0000847 STMT_OBJC_AT_SYNCHRONIZED,
Mike Stump1eb44332009-09-09 15:08:12 +0000848 /// \brief An ObjCAtThrowStmt record.
Argyrios Kyrtzidisba0a9002009-07-14 03:19:21 +0000849 STMT_OBJC_AT_THROW,
850
851 // C++
Argyrios Kyrtzidis7cb45e32010-07-22 16:03:56 +0000852
853 /// \brief A CXXCatchStmt record.
854 STMT_CXX_CATCH,
855 /// \brief A CXXTryStmt record.
856 STMT_CXX_TRY,
Argyrios Kyrtzidisba0a9002009-07-14 03:19:21 +0000857
Douglas Gregor39da0b82009-09-09 23:08:42 +0000858 /// \brief A CXXOperatorCallExpr record.
859 EXPR_CXX_OPERATOR_CALL,
Chris Lattner1817bd42010-05-09 05:36:05 +0000860 /// \brief A CXXMemberCallExpr record.
861 EXPR_CXX_MEMBER_CALL,
Douglas Gregor39da0b82009-09-09 23:08:42 +0000862 /// \brief A CXXConstructExpr record.
Sam Weinigce757a72010-01-16 21:21:01 +0000863 EXPR_CXX_CONSTRUCT,
Argyrios Kyrtzidis6d00c132010-07-10 11:46:15 +0000864 /// \brief A CXXTemporaryObjectExpr record.
865 EXPR_CXX_TEMPORARY_OBJECT,
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000866 /// \brief A CXXStaticCastExpr record.
Sam Weinigce757a72010-01-16 21:21:01 +0000867 EXPR_CXX_STATIC_CAST,
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000868 /// \brief A CXXDynamicCastExpr record.
Sam Weinigce757a72010-01-16 21:21:01 +0000869 EXPR_CXX_DYNAMIC_CAST,
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000870 /// \brief A CXXReinterpretCastExpr record.
Sam Weinigce757a72010-01-16 21:21:01 +0000871 EXPR_CXX_REINTERPRET_CAST,
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000872 /// \brief A CXXConstCastExpr record.
Sam Weinigce757a72010-01-16 21:21:01 +0000873 EXPR_CXX_CONST_CAST,
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000874 /// \brief A CXXFunctionalCastExpr record.
Sam Weinigeb7f9612010-02-07 06:32:43 +0000875 EXPR_CXX_FUNCTIONAL_CAST,
Sebastian Redlf29f0a22010-08-18 23:57:22 +0000876 /// \brief A CXXBoolLiteralExpr record.
Sam Weinigeb7f9612010-02-07 06:32:43 +0000877 EXPR_CXX_BOOL_LITERAL,
Chris Lattner14ab24f2010-05-09 06:03:39 +0000878 EXPR_CXX_NULL_PTR_LITERAL, // CXXNullPtrLiteralExpr
879 EXPR_CXX_TYPEID_EXPR, // CXXTypeidExpr (of expr).
Chris Lattner2fbdfcd2010-05-09 06:15:05 +0000880 EXPR_CXX_TYPEID_TYPE, // CXXTypeidExpr (of type).
Francois Pichet01b7c302010-09-08 12:20:18 +0000881 EXPR_CXX_UUIDOF_EXPR, // CXXUuidofExpr (of expr).
882 EXPR_CXX_UUIDOF_TYPE, // CXXUuidofExpr (of type).
Chris Lattner2fbdfcd2010-05-09 06:15:05 +0000883 EXPR_CXX_THIS, // CXXThisExpr
Chris Lattner030854b2010-05-09 06:40:08 +0000884 EXPR_CXX_THROW, // CXXThrowExpr
Chris Lattnerd2598362010-05-10 00:25:06 +0000885 EXPR_CXX_DEFAULT_ARG, // CXXDefaultArgExpr
886 EXPR_CXX_BIND_TEMPORARY, // CXXBindTemporaryExpr
Argyrios Kyrtzidis6d00c132010-07-10 11:46:15 +0000887
Douglas Gregored8abf12010-07-08 06:14:04 +0000888 EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
Chris Lattner59218632010-05-10 01:22:27 +0000889 EXPR_CXX_NEW, // CXXNewExpr
Argyrios Kyrtzidis95fc98c2010-06-22 17:07:59 +0000890 EXPR_CXX_DELETE, // CXXDeleteExpr
Argyrios Kyrtzidisde4bd182010-06-28 09:32:03 +0000891 EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
Chris Lattnerd2598362010-05-10 00:25:06 +0000892
Sebastian Redl6b219d02010-09-10 20:55:54 +0000893 EXPR_CXX_EXPR_WITH_TEMPORARIES, // CXXExprWithTemporaries
Argyrios Kyrtzidis8dfbd8b2010-06-24 08:57:31 +0000894
Sebastian Redl6b219d02010-09-10 20:55:54 +0000895 EXPR_CXX_DEPENDENT_SCOPE_MEMBER, // CXXDependentScopeMemberExpr
896 EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
897 EXPR_CXX_UNRESOLVED_CONSTRUCT, // CXXUnresolvedConstructExpr
898 EXPR_CXX_UNRESOLVED_MEMBER, // UnresolvedMemberExpr
899 EXPR_CXX_UNRESOLVED_LOOKUP, // UnresolvedLookupExpr
Argyrios Kyrtzidis6d00c132010-07-10 11:46:15 +0000900
Sebastian Redl6b219d02010-09-10 20:55:54 +0000901 EXPR_CXX_UNARY_TYPE_TRAIT, // UnaryTypeTraitExpr
902 EXPR_CXX_NOEXCEPT // CXXNoexceptExpr
Douglas Gregor0b748912009-04-14 21:18:50 +0000903 };
Douglas Gregord077d752009-04-16 00:55:48 +0000904
905 /// \brief The kinds of designators that can occur in a
906 /// DesignatedInitExpr.
907 enum DesignatorTypes {
908 /// \brief Field designator where only the field name is known.
909 DESIG_FIELD_NAME = 0,
910 /// \brief Field designator where the field has been resolved to
911 /// a declaration.
912 DESIG_FIELD_DECL = 1,
913 /// \brief Array designator.
914 DESIG_ARRAY = 2,
915 /// \brief GNU array range designator.
916 DESIG_ARRAY_RANGE = 3
917 };
918
Douglas Gregor14f79002009-04-10 03:52:48 +0000919 /// @}
Douglas Gregor2cf26342009-04-09 22:27:44 +0000920 }
921} // end namespace clang
922
923#endif