Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 1 | //===- 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 | |
| 23 | namespace clang { |
| 24 | namespace pch { |
Douglas Gregor | 8038d51 | 2009-04-10 17:25:41 +0000 | [diff] [blame] | 25 | /// \brief An ID number that refers to a declaration in a PCH file. |
| 26 | /// |
| 27 | /// The ID numbers of types are consecutive (in order of |
| 28 | /// discovery) and start at 2. 0 is reserved for NULL, and 1 is |
| 29 | /// reserved for the translation unit declaration. |
| 30 | typedef uint32_t DeclID; |
| 31 | |
| 32 | /// \brief An ID number that refers to a type in a PCH file. |
| 33 | /// |
| 34 | /// The ID of a type is partitioned into two parts: the lower |
| 35 | /// three bits are used to store the const/volatile/restrict |
| 36 | /// qualifiers (as with QualType) and the upper bits provide a |
| 37 | /// type index. The type index values are partitioned into two |
| 38 | /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type |
| 39 | /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a |
| 40 | /// placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are |
| 41 | /// other types that have serialized representations. |
| 42 | typedef uint32_t TypeID; |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 43 | |
Douglas Gregor | afaf308 | 2009-04-11 00:14:32 +0000 | [diff] [blame] | 44 | /// \brief An ID number that refers to an identifier in a PCH |
| 45 | /// file. |
| 46 | typedef uint32_t IdentID; |
| 47 | |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 48 | /// \brief Describes the various kinds of blocks that occur within |
| 49 | /// a PCH file. |
| 50 | enum BlockIDs { |
| 51 | /// \brief The PCH block, which acts as a container around the |
| 52 | /// full PCH block. |
| 53 | PCH_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID, |
Douglas Gregor | 14f7900 | 2009-04-10 03:52:48 +0000 | [diff] [blame] | 54 | |
Douglas Gregor | 14f7900 | 2009-04-10 03:52:48 +0000 | [diff] [blame] | 55 | /// \brief The block containing information about the source |
| 56 | /// manager. |
| 57 | SOURCE_MANAGER_BLOCK_ID, |
| 58 | |
| 59 | /// \brief The block containing information about the |
| 60 | /// preprocessor. |
| 61 | PREPROCESSOR_BLOCK_ID, |
| 62 | |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 63 | /// \brief The block containing the definitions of all of the |
| 64 | /// types used within the PCH file. |
| 65 | TYPES_BLOCK_ID, |
| 66 | |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 67 | /// \brief The block containing the definitions of all of the |
| 68 | /// declarations stored in the PCH file. |
Douglas Gregor | 8038d51 | 2009-04-10 17:25:41 +0000 | [diff] [blame] | 69 | DECLS_BLOCK_ID |
| 70 | }; |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 71 | |
Douglas Gregor | 8038d51 | 2009-04-10 17:25:41 +0000 | [diff] [blame] | 72 | /// \brief Record types that occur within the PCH block itself. |
| 73 | enum PCHRecordTypes { |
| 74 | /// \brief Offset of each type within the types block. |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 75 | /// |
Douglas Gregor | 8038d51 | 2009-04-10 17:25:41 +0000 | [diff] [blame] | 76 | /// The TYPE_OFFSET constant describes the record that occurs |
| 77 | /// within the block identified by TYPE_OFFSETS_BLOCK_ID within |
| 78 | /// the PCH file. The record itself is an array of offsets that |
| 79 | /// point into the types block (identified by TYPES_BLOCK_ID in |
| 80 | /// the PCH file). The index into the array is based on the ID |
| 81 | /// of a type. For a given type ID @c T, the lower three bits of |
| 82 | /// @c T are its qualifiers (const, volatile, restrict), as in |
| 83 | /// the QualType class. The upper bits, after being shifted and |
| 84 | /// subtracting NUM_PREDEF_TYPE_IDS, are used to index into the |
| 85 | /// TYPE_OFFSET block to determine the offset of that type's |
| 86 | /// corresponding record within the TYPES_BLOCK_ID block. |
| 87 | TYPE_OFFSET = 1, |
| 88 | |
| 89 | /// \brief Record code for the offsets of each decl. |
| 90 | /// |
| 91 | /// The DECL_OFFSET constant describes the record that occurs |
| 92 | /// within the block identifier by DECL_OFFSETS_BLOCK_ID within |
| 93 | /// the PCH file. The record itself is an array of offsets that |
| 94 | /// point into the declarations block (identified by |
| 95 | /// DECLS_BLOCK_ID). The declaration ID is an index into this |
| 96 | /// record, after subtracting one to account for the use of |
| 97 | /// declaration ID 0 for a NULL declaration pointer. Index 0 is |
| 98 | /// reserved for the translation unit declaration. |
Douglas Gregor | 0a0428e | 2009-04-10 20:39:37 +0000 | [diff] [blame] | 99 | DECL_OFFSET = 2, |
| 100 | |
| 101 | /// \brief Record code for the language options table. |
| 102 | /// |
| 103 | /// The record with this code contains the contents of the |
| 104 | /// LangOptions structure. We serialize the entire contents of |
| 105 | /// the structure, and let the reader decide which options are |
| 106 | /// actually important to check. |
Douglas Gregor | 2bec041 | 2009-04-10 21:16:55 +0000 | [diff] [blame] | 107 | LANGUAGE_OPTIONS = 3, |
| 108 | |
| 109 | /// \brief Record code for the target triple used to build the |
| 110 | /// PCH file. |
Douglas Gregor | afaf308 | 2009-04-11 00:14:32 +0000 | [diff] [blame] | 111 | TARGET_TRIPLE = 4, |
| 112 | |
| 113 | /// \brief Record code for the table of offsets of each |
| 114 | /// identifier ID. |
| 115 | /// |
| 116 | /// The offset table contains offsets into the blob stored in |
| 117 | /// the IDENTIFIER_TABLE record. Each offset points to the |
| 118 | /// NULL-terminated string that corresponds to that identifier. |
| 119 | IDENTIFIER_OFFSET = 5, |
| 120 | |
| 121 | /// \brief Record code for the identifier table. |
| 122 | /// |
| 123 | /// The identifier table is a simple blob that contains |
| 124 | /// NULL-terminated strings for all of the identifiers |
| 125 | /// referenced by the PCH file. The IDENTIFIER_OFFSET table |
| 126 | /// contains the mapping from identifier IDs to the characters |
| 127 | /// in this blob. Note that the starting offsets of all of the |
| 128 | /// identifiers are odd, so that, when the identifier offset |
| 129 | /// table is loaded in, we can use the low bit to distinguish |
| 130 | /// between offsets (for unresolved identifier IDs) and |
| 131 | /// IdentifierInfo pointers (for already-resolved identifier |
| 132 | /// IDs). |
Douglas Gregor | fdd0172 | 2009-04-14 00:24:19 +0000 | [diff] [blame] | 133 | IDENTIFIER_TABLE = 6, |
| 134 | |
| 135 | /// \brief Record code for the array of external definitions. |
| 136 | /// |
| 137 | /// The PCH file contains a list of all of the external |
| 138 | /// definitions present within the parsed headers, stored as an |
| 139 | /// array of declaration IDs. These external definitions will be |
| 140 | /// reported to the AST consumer after the PCH file has been |
| 141 | /// read, since their presence can affect the semantics of the |
| 142 | /// program (e.g., for code generation). |
| 143 | EXTERNAL_DEFINITIONS = 7 |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 144 | }; |
| 145 | |
Douglas Gregor | 14f7900 | 2009-04-10 03:52:48 +0000 | [diff] [blame] | 146 | /// \brief Record types used within a source manager block. |
| 147 | enum SourceManagerRecordTypes { |
| 148 | /// \brief Describes a source location entry (SLocEntry) for a |
| 149 | /// file. |
| 150 | SM_SLOC_FILE_ENTRY = 1, |
| 151 | /// \brief Describes a source location entry (SLocEntry) for a |
| 152 | /// buffer. |
| 153 | SM_SLOC_BUFFER_ENTRY = 2, |
| 154 | /// \brief Describes a blob that contains the data for a buffer |
| 155 | /// entry. This kind of record always directly follows a |
| 156 | /// SM_SLOC_BUFFER_ENTRY record. |
| 157 | SM_SLOC_BUFFER_BLOB = 3, |
| 158 | /// \brief Describes a source location entry (SLocEntry) for a |
| 159 | /// macro instantiation. |
Douglas Gregor | bd94500 | 2009-04-13 16:31:14 +0000 | [diff] [blame] | 160 | SM_SLOC_INSTANTIATION_ENTRY = 4, |
| 161 | /// \brief Describes the SourceManager's line table, with |
| 162 | /// information about #line directives. |
| 163 | SM_LINE_TABLE = 5 |
Douglas Gregor | 14f7900 | 2009-04-10 03:52:48 +0000 | [diff] [blame] | 164 | }; |
Chris Lattner | 7c5d24e | 2009-04-10 18:00:12 +0000 | [diff] [blame] | 165 | |
| 166 | /// \brief Record types used within a preprocessor block. |
| 167 | enum PreprocessorRecordTypes { |
| 168 | // The macros in the PP section are a PP_MACRO_* instance followed by a |
| 169 | // list of PP_TOKEN instances for each token in the definition. |
| 170 | |
| 171 | /// \brief An object-like macro definition. |
| 172 | /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed] |
| 173 | PP_MACRO_OBJECT_LIKE = 1, |
| 174 | |
| 175 | /// \brief A function-like macro definition. |
| 176 | /// [PP_MACRO_FUNCTION_LIKE, <ObjectLikeStuff>, IsC99Varargs, IsGNUVarars, |
| 177 | /// NumArgs, ArgIdentInfoID* ] |
| 178 | PP_MACRO_FUNCTION_LIKE = 2, |
| 179 | |
| 180 | /// \brief Describes one token. |
Chris Lattner | c1f9d82 | 2009-04-13 01:29:17 +0000 | [diff] [blame] | 181 | /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags] |
| 182 | PP_TOKEN = 3, |
| 183 | |
| 184 | /// \brief The value of the next __COUNTER__ to dispense. |
| 185 | /// [PP_COUNTER_VALUE, Val] |
| 186 | PP_COUNTER_VALUE = 4 |
Chris Lattner | 7c5d24e | 2009-04-10 18:00:12 +0000 | [diff] [blame] | 187 | }; |
| 188 | |
Douglas Gregor | 14f7900 | 2009-04-10 03:52:48 +0000 | [diff] [blame] | 189 | |
| 190 | /// \defgroup PCHAST Precompiled header AST constants |
| 191 | /// |
| 192 | /// The constants in this group describe various components of the |
| 193 | /// abstract syntax tree within a precompiled header. |
| 194 | /// |
| 195 | /// @{ |
| 196 | |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 197 | /// \brief Predefined type IDs. |
| 198 | /// |
| 199 | /// These type IDs correspond to predefined types in the AST |
| 200 | /// context, such as built-in types (int) and special place-holder |
| 201 | /// types (the <overload> and <dependent> type markers). Such |
| 202 | /// types are never actually serialized, since they will be built |
| 203 | /// by the AST context when it is created. |
| 204 | enum PredefinedTypeIDs { |
| 205 | /// \brief The NULL type. |
| 206 | PREDEF_TYPE_NULL_ID = 0, |
| 207 | /// \brief The void type. |
| 208 | PREDEF_TYPE_VOID_ID = 1, |
| 209 | /// \brief The 'bool' or '_Bool' type. |
| 210 | PREDEF_TYPE_BOOL_ID = 2, |
| 211 | /// \brief The 'char' type, when it is unsigned. |
| 212 | PREDEF_TYPE_CHAR_U_ID = 3, |
| 213 | /// \brief The 'unsigned char' type. |
| 214 | PREDEF_TYPE_UCHAR_ID = 4, |
| 215 | /// \brief The 'unsigned short' type. |
| 216 | PREDEF_TYPE_USHORT_ID = 5, |
| 217 | /// \brief The 'unsigned int' type. |
| 218 | PREDEF_TYPE_UINT_ID = 6, |
| 219 | /// \brief The 'unsigned long' type. |
| 220 | PREDEF_TYPE_ULONG_ID = 7, |
| 221 | /// \brief The 'unsigned long long' type. |
| 222 | PREDEF_TYPE_ULONGLONG_ID = 8, |
| 223 | /// \brief The 'char' type, when it is signed. |
| 224 | PREDEF_TYPE_CHAR_S_ID = 9, |
| 225 | /// \brief The 'signed char' type. |
| 226 | PREDEF_TYPE_SCHAR_ID = 10, |
| 227 | /// \brief The C++ 'wchar_t' type. |
| 228 | PREDEF_TYPE_WCHAR_ID = 11, |
| 229 | /// \brief The (signed) 'short' type. |
| 230 | PREDEF_TYPE_SHORT_ID = 12, |
| 231 | /// \brief The (signed) 'int' type. |
| 232 | PREDEF_TYPE_INT_ID = 13, |
| 233 | /// \brief The (signed) 'long' type. |
| 234 | PREDEF_TYPE_LONG_ID = 14, |
| 235 | /// \brief The (signed) 'long long' type. |
| 236 | PREDEF_TYPE_LONGLONG_ID = 15, |
| 237 | /// \brief The 'float' type. |
| 238 | PREDEF_TYPE_FLOAT_ID = 16, |
| 239 | /// \brief The 'double' type. |
| 240 | PREDEF_TYPE_DOUBLE_ID = 17, |
| 241 | /// \brief The 'long double' type. |
| 242 | PREDEF_TYPE_LONGDOUBLE_ID = 18, |
| 243 | /// \brief The placeholder type for overloaded function sets. |
| 244 | PREDEF_TYPE_OVERLOAD_ID = 19, |
| 245 | /// \brief The placeholder type for dependent types. |
| 246 | PREDEF_TYPE_DEPENDENT_ID = 20 |
| 247 | }; |
| 248 | |
| 249 | /// \brief The number of predefined type IDs that are reserved for |
| 250 | /// the PREDEF_TYPE_* constants. |
| 251 | /// |
| 252 | /// Type IDs for non-predefined types will start at |
| 253 | /// NUM_PREDEF_TYPE_IDs. |
| 254 | const unsigned NUM_PREDEF_TYPE_IDS = 100; |
| 255 | |
| 256 | /// \brief Record codes for each kind of type. |
| 257 | /// |
| 258 | /// These constants describe the records that can occur within a |
| 259 | /// block identified by TYPES_BLOCK_ID in the PCH file. Each |
| 260 | /// constant describes a record for a specific type class in the |
| 261 | /// AST. |
| 262 | enum TypeCode { |
| 263 | /// \brief An ExtQualType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 264 | TYPE_EXT_QUAL = 1, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 265 | /// \brief A FixedWidthIntType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 266 | TYPE_FIXED_WIDTH_INT = 2, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 267 | /// \brief A ComplexType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 268 | TYPE_COMPLEX = 3, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 269 | /// \brief A PointerType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 270 | TYPE_POINTER = 4, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 271 | /// \brief A BlockPointerType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 272 | TYPE_BLOCK_POINTER = 5, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 273 | /// \brief An LValueReferenceType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 274 | TYPE_LVALUE_REFERENCE = 6, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 275 | /// \brief An RValueReferenceType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 276 | TYPE_RVALUE_REFERENCE = 7, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 277 | /// \brief A MemberPointerType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 278 | TYPE_MEMBER_POINTER = 8, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 279 | /// \brief A ConstantArrayType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 280 | TYPE_CONSTANT_ARRAY = 9, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 281 | /// \brief An IncompleteArrayType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 282 | TYPE_INCOMPLETE_ARRAY = 10, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 283 | /// \brief A VariableArrayType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 284 | TYPE_VARIABLE_ARRAY = 11, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 285 | /// \brief A VectorType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 286 | TYPE_VECTOR = 12, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 287 | /// \brief An ExtVectorType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 288 | TYPE_EXT_VECTOR = 13, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 289 | /// \brief A FunctionNoProtoType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 290 | TYPE_FUNCTION_NO_PROTO = 14, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 291 | /// \brief A FunctionProtoType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 292 | TYPE_FUNCTION_PROTO = 15, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 293 | /// \brief A TypedefType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 294 | TYPE_TYPEDEF = 16, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 295 | /// \brief A TypeOfExprType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 296 | TYPE_TYPEOF_EXPR = 17, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 297 | /// \brief A TypeOfType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 298 | TYPE_TYPEOF = 18, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 299 | /// \brief A RecordType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 300 | TYPE_RECORD = 19, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 301 | /// \brief An EnumType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 302 | TYPE_ENUM = 20, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 303 | /// \brief An ObjCInterfaceType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 304 | TYPE_OBJC_INTERFACE = 21, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 305 | /// \brief An ObjCQualifiedInterfaceType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 306 | TYPE_OBJC_QUALIFIED_INTERFACE = 22, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 307 | /// \brief An ObjCQualifiedIdType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 308 | TYPE_OBJC_QUALIFIED_ID = 23, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 309 | /// \brief An ObjCQualifiedClassType record. |
Douglas Gregor | 63f5c26 | 2009-04-16 02:45:14 +0000 | [diff] [blame] | 310 | TYPE_OBJC_QUALIFIED_CLASS = 24 |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 311 | }; |
| 312 | |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 313 | /// \brief Record codes for each kind of declaration. |
| 314 | /// |
| 315 | /// These constants describe the records that can occur within a |
| 316 | /// declarations block (identified by DECLS_BLOCK_ID). Each |
| 317 | /// constant describes a record for a specific declaration class |
| 318 | /// in the AST. |
| 319 | enum DeclCode { |
Douglas Gregor | 68a2eb0 | 2009-04-15 21:30:51 +0000 | [diff] [blame] | 320 | /// \brief Attributes attached to a declaration. |
Douglas Gregor | 68a2eb0 | 2009-04-15 21:30:51 +0000 | [diff] [blame] | 321 | DECL_ATTR = 1, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 322 | /// \brief A TranslationUnitDecl record. |
Douglas Gregor | 68a2eb0 | 2009-04-15 21:30:51 +0000 | [diff] [blame] | 323 | DECL_TRANSLATION_UNIT, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 324 | /// \brief A TypedefDecl record. |
| 325 | DECL_TYPEDEF, |
Douglas Gregor | 0a2b45e | 2009-04-13 18:14:40 +0000 | [diff] [blame] | 326 | /// \brief An EnumDecl record. |
| 327 | DECL_ENUM, |
Douglas Gregor | 8c70006 | 2009-04-13 21:20:57 +0000 | [diff] [blame] | 328 | /// \brief A RecordDecl record. |
| 329 | DECL_RECORD, |
Douglas Gregor | 0a2b45e | 2009-04-13 18:14:40 +0000 | [diff] [blame] | 330 | /// \brief An EnumConstantDecl record. |
| 331 | DECL_ENUM_CONSTANT, |
Douglas Gregor | 3a2f7e4 | 2009-04-13 22:18:37 +0000 | [diff] [blame] | 332 | /// \brief A FunctionDecl record. |
| 333 | DECL_FUNCTION, |
Douglas Gregor | 8c70006 | 2009-04-13 21:20:57 +0000 | [diff] [blame] | 334 | /// \brief A FieldDecl record. |
| 335 | DECL_FIELD, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 336 | /// \brief A VarDecl record. |
| 337 | DECL_VAR, |
Douglas Gregor | 3a2f7e4 | 2009-04-13 22:18:37 +0000 | [diff] [blame] | 338 | /// \brief A ParmVarDecl record. |
| 339 | DECL_PARM_VAR, |
| 340 | /// \brief An OriginalParmVarDecl record. |
| 341 | DECL_ORIGINAL_PARM_VAR, |
Douglas Gregor | 1028bc6 | 2009-04-13 22:49:25 +0000 | [diff] [blame] | 342 | /// \brief A FileScopeAsmDecl record. |
| 343 | DECL_FILE_SCOPE_ASM, |
| 344 | /// \brief A BlockDecl record. |
| 345 | DECL_BLOCK, |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 346 | /// \brief A record that stores the set of declarations that are |
| 347 | /// lexically stored within a given DeclContext. |
| 348 | /// |
| 349 | /// The record itself is an array of declaration IDs, in the |
| 350 | /// order in which those declarations were added to the |
| 351 | /// declaration context. This data is used when iterating over |
| 352 | /// the contents of a DeclContext, e.g., via |
| 353 | /// DeclContext::decls_begin()/DeclContext::decls_end(). |
| 354 | DECL_CONTEXT_LEXICAL, |
| 355 | /// \brief A record that stores the set of declarations that are |
| 356 | /// visible from a given DeclContext. |
| 357 | /// |
| 358 | /// The record itself stores a set of mappings, each of which |
| 359 | /// associates a declaration name with one or more declaration |
| 360 | /// IDs. This data is used when performing qualified name lookup |
| 361 | /// into a DeclContext via DeclContext::lookup. |
| 362 | DECL_CONTEXT_VISIBLE |
| 363 | }; |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 364 | |
| 365 | /// \brief Record codes for each kind of statement or expression. |
| 366 | /// |
| 367 | /// These constants describe the records that describe statements |
| 368 | /// or expressions. These records can occur within either the type |
| 369 | /// or declaration blocks, so they begin with record values of |
| 370 | /// 100. Each constant describes a record for a specific |
| 371 | /// statement or expression class in the AST. |
| 372 | enum StmtCode { |
Douglas Gregor | 087fd53 | 2009-04-14 23:32:43 +0000 | [diff] [blame] | 373 | /// \brief A marker record that indicates that we are at the end |
| 374 | /// of an expression. |
Douglas Gregor | c9490c0 | 2009-04-16 22:23:12 +0000 | [diff] [blame] | 375 | STMT_STOP, |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 376 | /// \brief A NULL expression. |
Douglas Gregor | c9490c0 | 2009-04-16 22:23:12 +0000 | [diff] [blame] | 377 | STMT_NULL_PTR, |
Douglas Gregor | 025452f | 2009-04-17 00:04:06 +0000 | [diff] [blame] | 378 | /// \brief A NullStmt record. |
| 379 | STMT_NULL, |
| 380 | /// \brief A CompoundStmt record. |
| 381 | STMT_COMPOUND, |
| 382 | /// \brief A CaseStmt record. |
| 383 | STMT_CASE, |
| 384 | /// \brief A DefaultStmt record. |
| 385 | STMT_DEFAULT, |
Douglas Gregor | 1de05fe | 2009-04-17 18:18:49 +0000 | [diff] [blame] | 386 | /// \brief A LabelStmt record. |
| 387 | STMT_LABEL, |
Douglas Gregor | 025452f | 2009-04-17 00:04:06 +0000 | [diff] [blame] | 388 | /// \brief An IfStmt record. |
| 389 | STMT_IF, |
| 390 | /// \brief A SwitchStmt record. |
| 391 | STMT_SWITCH, |
Douglas Gregor | d921cf9 | 2009-04-17 00:16:09 +0000 | [diff] [blame] | 392 | /// \brief A WhileStmt record. |
| 393 | STMT_WHILE, |
Douglas Gregor | 67d8249 | 2009-04-17 00:29:51 +0000 | [diff] [blame] | 394 | /// \brief A DoStmt record. |
| 395 | STMT_DO, |
| 396 | /// \brief A ForStmt record. |
| 397 | STMT_FOR, |
Douglas Gregor | 1de05fe | 2009-04-17 18:18:49 +0000 | [diff] [blame] | 398 | /// \brief A GotoStmt record. |
| 399 | STMT_GOTO, |
Douglas Gregor | 7d5c2f2 | 2009-04-17 18:58:21 +0000 | [diff] [blame] | 400 | /// \brief An IndirectGotoStmt record. |
| 401 | STMT_INDIRECT_GOTO, |
Douglas Gregor | d921cf9 | 2009-04-17 00:16:09 +0000 | [diff] [blame] | 402 | /// \brief A ContinueStmt record. |
| 403 | STMT_CONTINUE, |
Douglas Gregor | 025452f | 2009-04-17 00:04:06 +0000 | [diff] [blame] | 404 | /// \brief A BreakStmt record. |
| 405 | STMT_BREAK, |
Douglas Gregor | 0de9d88 | 2009-04-17 16:34:57 +0000 | [diff] [blame] | 406 | /// \brief A ReturnStmt record. |
| 407 | STMT_RETURN, |
Douglas Gregor | 84f2170 | 2009-04-17 16:55:36 +0000 | [diff] [blame] | 408 | /// \brief A DeclStmt record. |
| 409 | STMT_DECL, |
Douglas Gregor | cd7d5a9 | 2009-04-17 20:57:14 +0000 | [diff] [blame^] | 410 | /// \brief An AsmStmt record. |
| 411 | STMT_ASM, |
Douglas Gregor | 17fc223 | 2009-04-14 21:55:33 +0000 | [diff] [blame] | 412 | /// \brief A PredefinedExpr record. |
| 413 | EXPR_PREDEFINED, |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 414 | /// \brief A DeclRefExpr record. |
| 415 | EXPR_DECL_REF, |
| 416 | /// \brief An IntegerLiteral record. |
| 417 | EXPR_INTEGER_LITERAL, |
Douglas Gregor | 17fc223 | 2009-04-14 21:55:33 +0000 | [diff] [blame] | 418 | /// \brief A FloatingLiteral record. |
| 419 | EXPR_FLOATING_LITERAL, |
Douglas Gregor | cb2ca73 | 2009-04-15 22:19:53 +0000 | [diff] [blame] | 420 | /// \brief An ImaginaryLiteral record. |
| 421 | EXPR_IMAGINARY_LITERAL, |
Douglas Gregor | 673ecd6 | 2009-04-15 16:35:07 +0000 | [diff] [blame] | 422 | /// \brief A StringLiteral record. |
| 423 | EXPR_STRING_LITERAL, |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 424 | /// \brief A CharacterLiteral record. |
Douglas Gregor | 087fd53 | 2009-04-14 23:32:43 +0000 | [diff] [blame] | 425 | EXPR_CHARACTER_LITERAL, |
Douglas Gregor | c04db4f | 2009-04-14 23:59:37 +0000 | [diff] [blame] | 426 | /// \brief A ParenExpr record. |
| 427 | EXPR_PAREN, |
Douglas Gregor | 0b0b77f | 2009-04-15 15:58:59 +0000 | [diff] [blame] | 428 | /// \brief A UnaryOperator record. |
| 429 | EXPR_UNARY_OPERATOR, |
| 430 | /// \brief A SizefAlignOfExpr record. |
| 431 | EXPR_SIZEOF_ALIGN_OF, |
Douglas Gregor | cb2ca73 | 2009-04-15 22:19:53 +0000 | [diff] [blame] | 432 | /// \brief An ArraySubscriptExpr record. |
| 433 | EXPR_ARRAY_SUBSCRIPT, |
Douglas Gregor | 1f0d013 | 2009-04-15 17:43:59 +0000 | [diff] [blame] | 434 | /// \brief A CallExpr record. |
| 435 | EXPR_CALL, |
| 436 | /// \brief A MemberExpr record. |
| 437 | EXPR_MEMBER, |
Douglas Gregor | db600c3 | 2009-04-15 00:25:59 +0000 | [diff] [blame] | 438 | /// \brief A BinaryOperator record. |
| 439 | EXPR_BINARY_OPERATOR, |
Douglas Gregor | ad90e96 | 2009-04-15 22:40:36 +0000 | [diff] [blame] | 440 | /// \brief A CompoundAssignOperator record. |
| 441 | EXPR_COMPOUND_ASSIGN_OPERATOR, |
| 442 | /// \brief A ConditionOperator record. |
| 443 | EXPR_CONDITIONAL_OPERATOR, |
Douglas Gregor | 087fd53 | 2009-04-14 23:32:43 +0000 | [diff] [blame] | 444 | /// \brief An ImplicitCastExpr record. |
Douglas Gregor | db600c3 | 2009-04-15 00:25:59 +0000 | [diff] [blame] | 445 | EXPR_IMPLICIT_CAST, |
| 446 | /// \brief A CStyleCastExpr record. |
Douglas Gregor | d3c98a0 | 2009-04-15 23:02:49 +0000 | [diff] [blame] | 447 | EXPR_CSTYLE_CAST, |
Douglas Gregor | ba6d7e7 | 2009-04-16 02:33:48 +0000 | [diff] [blame] | 448 | /// \brief A CompoundLiteralExpr record. |
| 449 | EXPR_COMPOUND_LITERAL, |
Douglas Gregor | d3c98a0 | 2009-04-15 23:02:49 +0000 | [diff] [blame] | 450 | /// \brief An ExtVectorElementExpr record. |
| 451 | EXPR_EXT_VECTOR_ELEMENT, |
Douglas Gregor | d077d75 | 2009-04-16 00:55:48 +0000 | [diff] [blame] | 452 | /// \brief An InitListExpr record. |
| 453 | EXPR_INIT_LIST, |
| 454 | /// \brief A DesignatedInitExpr record. |
| 455 | EXPR_DESIGNATED_INIT, |
| 456 | /// \brief An ImplicitValueInitExpr record. |
| 457 | EXPR_IMPLICIT_VALUE_INIT, |
Douglas Gregor | d3c98a0 | 2009-04-15 23:02:49 +0000 | [diff] [blame] | 458 | /// \brief A VAArgExpr record. |
Douglas Gregor | 44cae0c | 2009-04-15 23:33:31 +0000 | [diff] [blame] | 459 | EXPR_VA_ARG, |
Douglas Gregor | 6a2dd55 | 2009-04-17 19:05:30 +0000 | [diff] [blame] | 460 | /// \brief An AddrLabelExpr record. |
Douglas Gregor | 7d5c2f2 | 2009-04-17 18:58:21 +0000 | [diff] [blame] | 461 | EXPR_ADDR_LABEL, |
Douglas Gregor | 6a2dd55 | 2009-04-17 19:05:30 +0000 | [diff] [blame] | 462 | /// \brief A StmtExpr record. |
| 463 | EXPR_STMT, |
Douglas Gregor | 44cae0c | 2009-04-15 23:33:31 +0000 | [diff] [blame] | 464 | /// \brief A TypesCompatibleExpr record. |
| 465 | EXPR_TYPES_COMPATIBLE, |
| 466 | /// \brief A ChooseExpr record. |
| 467 | EXPR_CHOOSE, |
| 468 | /// \brief A GNUNullExpr record. |
Douglas Gregor | 94cd5d1 | 2009-04-16 00:01:45 +0000 | [diff] [blame] | 469 | EXPR_GNU_NULL, |
| 470 | /// \brief A ShuffleVectorExpr record. |
| 471 | EXPR_SHUFFLE_VECTOR, |
Douglas Gregor | 84af7c2 | 2009-04-17 19:21:43 +0000 | [diff] [blame] | 472 | /// \brief BlockExpr |
| 473 | EXPR_BLOCK, |
| 474 | /// \brief A BlockDeclRef record. |
Douglas Gregor | 94cd5d1 | 2009-04-16 00:01:45 +0000 | [diff] [blame] | 475 | EXPR_BLOCK_DECL_REF |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 476 | }; |
Douglas Gregor | d077d75 | 2009-04-16 00:55:48 +0000 | [diff] [blame] | 477 | |
| 478 | /// \brief The kinds of designators that can occur in a |
| 479 | /// DesignatedInitExpr. |
| 480 | enum DesignatorTypes { |
| 481 | /// \brief Field designator where only the field name is known. |
| 482 | DESIG_FIELD_NAME = 0, |
| 483 | /// \brief Field designator where the field has been resolved to |
| 484 | /// a declaration. |
| 485 | DESIG_FIELD_DECL = 1, |
| 486 | /// \brief Array designator. |
| 487 | DESIG_ARRAY = 2, |
| 488 | /// \brief GNU array range designator. |
| 489 | DESIG_ARRAY_RANGE = 3 |
| 490 | }; |
| 491 | |
Douglas Gregor | 14f7900 | 2009-04-10 03:52:48 +0000 | [diff] [blame] | 492 | /// @} |
Douglas Gregor | 2cf2634 | 2009-04-09 22:27:44 +0000 | [diff] [blame] | 493 | } |
| 494 | } // end namespace clang |
| 495 | |
| 496 | #endif |