1 //===- ASTBitCodes.h - Enum values for the PCH bitcode format ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This header defines Bitcode enum values for Clang serialized AST files.
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
16 //===----------------------------------------------------------------------===//
18 #ifndef LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
19 #define LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
21 #include "clang/AST/DeclarationName.h"
22 #include "clang/AST/Type.h"
23 #include "clang/Basic/IdentifierTable.h"
24 #include "clang/Basic/OperatorKinds.h"
25 #include "clang/Basic/SourceLocation.h"
26 #include "llvm/ADT/DenseMapInfo.h"
27 #include "llvm/Bitcode/BitCodes.h"
32 namespace serialization {
34 /// AST file major version number supported by this version of
37 /// Whenever the AST file format changes in a way that makes it
38 /// incompatible with previous versions (such that a reader
39 /// designed for the previous version could not support reading
40 /// the new version), this number should be increased.
42 /// Version 4 of AST files also requires that the version control branch and
43 /// revision match exactly, since there is no backward compatibility of
44 /// AST files at this time.
45 const unsigned VERSION_MAJOR = 7;
47 /// AST file minor version number supported by this version of
50 /// Whenever the AST format changes in a way that is still
51 /// compatible with previous versions (such that a reader designed
52 /// for the previous version could still support reading the new
53 /// version by ignoring new kinds of subblocks), this number
54 /// should be increased.
55 const unsigned VERSION_MINOR = 0;
57 /// An ID number that refers to an identifier in an AST file.
59 /// The ID numbers of identifiers are consecutive (in order of discovery)
60 /// and start at 1. 0 is reserved for NULL.
61 using IdentifierID = uint32_t;
63 /// An ID number that refers to a declaration in an AST file.
65 /// The ID numbers of declarations are consecutive (in order of
66 /// discovery), with values below NUM_PREDEF_DECL_IDS being reserved.
67 /// At the start of a chain of precompiled headers, declaration ID 1 is
68 /// used for the translation unit declaration.
69 using DeclID = uint32_t;
71 // FIXME: Turn these into classes so we can have some type safety when
72 // we go from local ID to global and vice-versa.
73 using LocalDeclID = DeclID;
74 using GlobalDeclID = DeclID;
76 /// An ID number that refers to a type in an AST file.
78 /// The ID of a type is partitioned into two parts: the lower
79 /// three bits are used to store the const/volatile/restrict
80 /// qualifiers (as with QualType) and the upper bits provide a
81 /// type index. The type index values are partitioned into two
82 /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type
83 /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a
84 /// placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are
85 /// other types that have serialized representations.
86 using TypeID = uint32_t;
88 /// A type index; the type ID with the qualifier bits removed.
94 explicit TypeIdx(uint32_t index) : Idx(index) {}
96 uint32_t getIndex() const { return Idx; }
98 TypeID asTypeID(unsigned FastQuals) const {
99 if (Idx == uint32_t(-1))
102 return (Idx << Qualifiers::FastWidth) | FastQuals;
105 static TypeIdx fromTypeID(TypeID ID) {
106 if (ID == TypeID(-1))
109 return TypeIdx(ID >> Qualifiers::FastWidth);
113 /// A structure for putting "fast"-unqualified QualTypes into a
114 /// DenseMap. This uses the standard pointer hash function.
115 struct UnsafeQualTypeDenseMapInfo {
116 static bool isEqual(QualType A, QualType B) { return A == B; }
118 static QualType getEmptyKey() {
119 return QualType::getFromOpaquePtr((void*) 1);
122 static QualType getTombstoneKey() {
123 return QualType::getFromOpaquePtr((void*) 2);
126 static unsigned getHashValue(QualType T) {
127 assert(!T.getLocalFastQualifiers() &&
128 "hash invalid for types with fast quals");
129 uintptr_t v = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
130 return (unsigned(v) >> 4) ^ (unsigned(v) >> 9);
134 /// An ID number that refers to an identifier in an AST file.
135 using IdentID = uint32_t;
137 /// The number of predefined identifier IDs.
138 const unsigned int NUM_PREDEF_IDENT_IDS = 1;
140 /// An ID number that refers to a macro in an AST file.
141 using MacroID = uint32_t;
143 /// A global ID number that refers to a macro in an AST file.
144 using GlobalMacroID = uint32_t;
146 /// A local to a module ID number that refers to a macro in an
148 using LocalMacroID = uint32_t;
150 /// The number of predefined macro IDs.
151 const unsigned int NUM_PREDEF_MACRO_IDS = 1;
153 /// An ID number that refers to an ObjC selector in an AST file.
154 using SelectorID = uint32_t;
156 /// The number of predefined selector IDs.
157 const unsigned int NUM_PREDEF_SELECTOR_IDS = 1;
159 /// An ID number that refers to a set of CXXBaseSpecifiers in an
161 using CXXBaseSpecifiersID = uint32_t;
163 /// An ID number that refers to a list of CXXCtorInitializers in an
165 using CXXCtorInitializersID = uint32_t;
167 /// An ID number that refers to an entity in the detailed
168 /// preprocessing record.
169 using PreprocessedEntityID = uint32_t;
171 /// An ID number that refers to a submodule in a module file.
172 using SubmoduleID = uint32_t;
174 /// The number of predefined submodule IDs.
175 const unsigned int NUM_PREDEF_SUBMODULE_IDS = 1;
177 /// Source range/offset of a preprocessed entity.
178 struct PPEntityOffset {
179 /// Raw source location of beginning of range.
182 /// Raw source location of end of range.
185 /// Offset in the AST file.
188 PPEntityOffset(SourceRange R, uint32_t BitOffset)
189 : Begin(R.getBegin().getRawEncoding()),
190 End(R.getEnd().getRawEncoding()), BitOffset(BitOffset) {}
192 SourceLocation getBegin() const {
193 return SourceLocation::getFromRawEncoding(Begin);
196 SourceLocation getEnd() const {
197 return SourceLocation::getFromRawEncoding(End);
201 /// Source range of a skipped preprocessor region
202 struct PPSkippedRange {
203 /// Raw source location of beginning of range.
205 /// Raw source location of end of range.
208 PPSkippedRange(SourceRange R)
209 : Begin(R.getBegin().getRawEncoding()),
210 End(R.getEnd().getRawEncoding()) { }
212 SourceLocation getBegin() const {
213 return SourceLocation::getFromRawEncoding(Begin);
215 SourceLocation getEnd() const {
216 return SourceLocation::getFromRawEncoding(End);
220 /// Source range/offset of a preprocessed entity.
222 /// Raw source location.
225 /// Offset in the AST file.
226 uint32_t BitOffset = 0;
228 DeclOffset() = default;
229 DeclOffset(SourceLocation Loc, uint32_t BitOffset)
230 : Loc(Loc.getRawEncoding()), BitOffset(BitOffset) {}
232 void setLocation(SourceLocation L) {
233 Loc = L.getRawEncoding();
236 SourceLocation getLocation() const {
237 return SourceLocation::getFromRawEncoding(Loc);
241 /// The number of predefined preprocessed entity IDs.
242 const unsigned int NUM_PREDEF_PP_ENTITY_IDS = 1;
244 /// Describes the various kinds of blocks that occur within
247 /// The AST block, which acts as a container around the
249 AST_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
251 /// The block containing information about the source
253 SOURCE_MANAGER_BLOCK_ID,
255 /// The block containing information about the
257 PREPROCESSOR_BLOCK_ID,
259 /// The block containing the definitions of all of the
260 /// types and decls used within the AST file.
263 /// The block containing the detailed preprocessing record.
264 PREPROCESSOR_DETAIL_BLOCK_ID,
266 /// The block containing the submodule structure.
269 /// The block containing comments.
272 /// The control block, which contains all of the
273 /// information that needs to be validated prior to committing
274 /// to loading the AST file.
277 /// The block of input files, which were used as inputs
278 /// to create this AST file.
280 /// This block is part of the control block.
281 INPUT_FILES_BLOCK_ID,
283 /// The block of configuration options, used to check that
284 /// a module is being used in a configuration compatible with the
285 /// configuration in which it was built.
287 /// This block is part of the control block.
290 /// A block containing a module file extension.
293 /// A block with unhashed content.
295 /// These records should not change the \a ASTFileSignature. See \a
296 /// UnhashedControlBlockRecordTypes for the list of records.
297 UNHASHED_CONTROL_BLOCK_ID,
300 /// Record types that occur within the control block.
301 enum ControlRecordTypes {
302 /// AST file metadata, including the AST file version number
303 /// and information about the compiler used to build this AST file.
306 /// Record code for the list of other AST files imported by
310 /// Record code for the original file that was used to
311 /// generate the AST file, including both its file ID and its
315 /// The directory that the PCH was originally created in.
318 /// Record code for file ID of the file or buffer that was used to
319 /// generate the AST file.
322 /// Offsets into the input-files block where input files
326 /// Record code for the module name.
329 /// Record code for the module map file that was used to build this
333 /// Record code for the module build directory.
337 /// Record types that occur within the options block inside
338 /// the control block.
339 enum OptionsRecordTypes {
340 /// Record code for the language options table.
342 /// The record with this code contains the contents of the
343 /// LangOptions structure. We serialize the entire contents of
344 /// the structure, and let the reader decide which options are
345 /// actually important to check.
346 LANGUAGE_OPTIONS = 1,
348 /// Record code for the target options table.
351 /// Record code for the filesystem options table.
354 /// Record code for the headers search options table.
355 HEADER_SEARCH_OPTIONS,
357 /// Record code for the preprocessor options table.
358 PREPROCESSOR_OPTIONS,
361 /// Record codes for the unhashed control block.
362 enum UnhashedControlBlockRecordTypes {
363 /// Record code for the signature that identifiers this AST file.
366 /// Record code for the diagnostic options table.
369 /// Record code for \#pragma diagnostic mappings.
370 DIAG_PRAGMA_MAPPINGS,
373 /// Record code for extension blocks.
374 enum ExtensionBlockRecordTypes {
375 /// Metadata describing this particular extension.
376 EXTENSION_METADATA = 1,
378 /// The first record ID allocated to the extensions themselves.
379 FIRST_EXTENSION_RECORD_ID = 4
382 /// Record types that occur within the input-files block
383 /// inside the control block.
384 enum InputFileRecordTypes {
389 /// Record types that occur within the AST block itself.
390 enum ASTRecordTypes {
391 /// Record code for the offsets of each type.
393 /// The TYPE_OFFSET constant describes the record that occurs
394 /// within the AST block. The record itself is an array of offsets that
395 /// point into the declarations and types block (identified by
396 /// DECLTYPES_BLOCK_ID). The index into the array is based on the ID
397 /// of a type. For a given type ID @c T, the lower three bits of
398 /// @c T are its qualifiers (const, volatile, restrict), as in
399 /// the QualType class. The upper bits, after being shifted and
400 /// subtracting NUM_PREDEF_TYPE_IDS, are used to index into the
401 /// TYPE_OFFSET block to determine the offset of that type's
402 /// corresponding record within the DECLTYPES_BLOCK_ID block.
405 /// Record code for the offsets of each decl.
407 /// The DECL_OFFSET constant describes the record that occurs
408 /// within the block identified by DECL_OFFSETS_BLOCK_ID within
409 /// the AST block. The record itself is an array of offsets that
410 /// point into the declarations and types block (identified by
411 /// DECLTYPES_BLOCK_ID). The declaration ID is an index into this
412 /// record, after subtracting one to account for the use of
413 /// declaration ID 0 for a NULL declaration pointer. Index 0 is
414 /// reserved for the translation unit declaration.
417 /// Record code for the table of offsets of each
420 /// The offset table contains offsets into the blob stored in
421 /// the IDENTIFIER_TABLE record. Each offset points to the
422 /// NULL-terminated string that corresponds to that identifier.
423 IDENTIFIER_OFFSET = 3,
425 /// This is so that older clang versions, before the introduction
426 /// of the control block, can read and reject the newer PCH format.
427 /// *DON'T CHANGE THIS NUMBER*.
428 METADATA_OLD_FORMAT = 4,
430 /// Record code for the identifier table.
432 /// The identifier table is a simple blob that contains
433 /// NULL-terminated strings for all of the identifiers
434 /// referenced by the AST file. The IDENTIFIER_OFFSET table
435 /// contains the mapping from identifier IDs to the characters
436 /// in this blob. Note that the starting offsets of all of the
437 /// identifiers are odd, so that, when the identifier offset
438 /// table is loaded in, we can use the low bit to distinguish
439 /// between offsets (for unresolved identifier IDs) and
440 /// IdentifierInfo pointers (for already-resolved identifier
442 IDENTIFIER_TABLE = 5,
444 /// Record code for the array of eagerly deserialized decls.
446 /// The AST file contains a list of all of the declarations that should be
447 /// eagerly deserialized present within the parsed headers, stored as an
448 /// array of declaration IDs. These declarations will be
449 /// reported to the AST consumer after the AST file has been
450 /// read, since their presence can affect the semantics of the
451 /// program (e.g., for code generation).
452 EAGERLY_DESERIALIZED_DECLS = 6,
454 /// Record code for the set of non-builtin, special
457 /// This record contains the type IDs for the various type nodes
458 /// that are constructed during semantic analysis (e.g.,
459 /// __builtin_va_list). The SPECIAL_TYPE_* constants provide
460 /// offsets into this record.
463 /// Record code for the extra statistics we gather while
464 /// generating an AST file.
467 /// Record code for the array of tentative definitions.
468 TENTATIVE_DEFINITIONS = 9,
470 // ID 10 used to be for a list of extern "C" declarations.
472 /// Record code for the table of offsets into the
473 /// Objective-C method pool.
474 SELECTOR_OFFSETS = 11,
476 /// Record code for the Objective-C method pool,
479 /// The value of the next __COUNTER__ to dispense.
480 /// [PP_COUNTER_VALUE, Val]
481 PP_COUNTER_VALUE = 13,
483 /// Record code for the table of offsets into the block
484 /// of source-location information.
485 SOURCE_LOCATION_OFFSETS = 14,
487 /// Record code for the set of source location entries
488 /// that need to be preloaded by the AST reader.
490 /// This set contains the source location entry for the
491 /// predefines buffer and for any file entries that need to be
493 SOURCE_LOCATION_PRELOADS = 15,
495 /// Record code for the set of ext_vector type names.
496 EXT_VECTOR_DECLS = 16,
498 /// Record code for the array of unused file scoped decls.
499 UNUSED_FILESCOPED_DECLS = 17,
501 /// Record code for the table of offsets to entries in the
502 /// preprocessing record.
503 PPD_ENTITIES_OFFSETS = 18,
505 /// Record code for the array of VTable uses.
508 // ID 20 used to be for a list of dynamic classes.
510 /// Record code for referenced selector pool.
511 REFERENCED_SELECTOR_POOL = 21,
513 /// Record code for an update to the TU's lexically contained
515 TU_UPDATE_LEXICAL = 22,
517 // ID 23 used to be for a list of local redeclarations.
519 /// Record code for declarations that Sema keeps references of.
522 /// Record code for weak undeclared identifiers.
523 WEAK_UNDECLARED_IDENTIFIERS = 25,
525 /// Record code for pending implicit instantiations.
526 PENDING_IMPLICIT_INSTANTIATIONS = 26,
528 // ID 27 used to be for a list of replacement decls.
530 /// Record code for an update to a decl context's lookup table.
532 /// In practice, this should only be used for the TU and namespaces.
535 /// Record for offsets of DECL_UPDATES records for declarations
536 /// that were modified after being deserialized and need updates.
537 DECL_UPDATE_OFFSETS = 29,
539 // ID 30 used to be a decl update record. These are now in the DECLTYPES
542 // ID 31 used to be a list of offsets to DECL_CXX_BASE_SPECIFIERS records.
544 // ID 32 used to be the code for \#pragma diagnostic mappings.
546 /// Record code for special CUDA declarations.
547 CUDA_SPECIAL_DECL_REFS = 33,
549 /// Record code for header search information.
550 HEADER_SEARCH_TABLE = 34,
552 /// Record code for floating point \#pragma options.
553 FP_PRAGMA_OPTIONS = 35,
555 /// Record code for enabled OpenCL extensions.
556 OPENCL_EXTENSIONS = 36,
558 /// The list of delegating constructor declarations.
559 DELEGATING_CTORS = 37,
561 /// Record code for the set of known namespaces, which are used
562 /// for typo correction.
563 KNOWN_NAMESPACES = 38,
565 /// Record code for the remapping information used to relate
566 /// loaded modules to the various offsets and IDs(e.g., source location
567 /// offests, declaration and type IDs) that are used in that module to
568 /// refer to other modules.
569 MODULE_OFFSET_MAP = 39,
571 /// Record code for the source manager line table information,
572 /// which stores information about \#line directives.
573 SOURCE_MANAGER_LINE_TABLE = 40,
575 /// Record code for map of Objective-C class definition IDs to the
576 /// ObjC categories in a module that are attached to that class.
577 OBJC_CATEGORIES_MAP = 41,
579 /// Record code for a file sorted array of DeclIDs in a module.
580 FILE_SORTED_DECLS = 42,
582 /// Record code for an array of all of the (sub)modules that were
583 /// imported by the AST file.
584 IMPORTED_MODULES = 43,
586 // ID 44 used to be a table of merged canonical declarations.
587 // ID 45 used to be a list of declaration IDs of local redeclarations.
589 /// Record code for the array of Objective-C categories (including
592 /// This array can only be interpreted properly using the Objective-C
594 OBJC_CATEGORIES = 46,
596 /// Record code for the table of offsets of each macro ID.
598 /// The offset table contains offsets into the blob stored in
599 /// the preprocessor block. Each offset points to the corresponding
600 /// macro definition.
603 /// A list of "interesting" identifiers. Only used in C++ (where we
604 /// don't normally do lookups into the serialized identifier table). These
605 /// are eagerly deserialized.
606 INTERESTING_IDENTIFIERS = 48,
608 /// Record code for undefined but used functions and variables that
609 /// need a definition in this TU.
610 UNDEFINED_BUT_USED = 49,
612 /// Record code for late parsed template functions.
613 LATE_PARSED_TEMPLATE = 50,
615 /// Record code for \#pragma optimize options.
616 OPTIMIZE_PRAGMA_OPTIONS = 51,
618 /// Record code for potentially unused local typedef names.
619 UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES = 52,
621 // ID 53 used to be a table of constructor initializer records.
623 /// Delete expressions that will be analyzed later.
624 DELETE_EXPRS_TO_ANALYZE = 54,
626 /// Record code for \#pragma ms_struct options.
627 MSSTRUCT_PRAGMA_OPTIONS = 55,
629 /// Record code for \#pragma ms_struct options.
630 POINTERS_TO_MEMBERS_PRAGMA_OPTIONS = 56,
632 /// Number of unmatched #pragma clang cuda_force_host_device begin
633 /// directives we've seen.
634 CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH = 57,
636 /// Record code for types associated with OpenCL extensions.
637 OPENCL_EXTENSION_TYPES = 58,
639 /// Record code for declarations associated with OpenCL extensions.
640 OPENCL_EXTENSION_DECLS = 59,
642 MODULAR_CODEGEN_DECLS = 60,
644 /// Record code for \#pragma pack options.
645 PACK_PRAGMA_OPTIONS = 61,
647 /// The stack of open #ifs/#ifdefs recorded in a preamble.
648 PP_CONDITIONAL_STACK = 62,
650 /// A table of skipped ranges within the preprocessing record.
651 PPD_SKIPPED_RANGES = 63
654 /// Record types used within a source manager block.
655 enum SourceManagerRecordTypes {
656 /// Describes a source location entry (SLocEntry) for a
658 SM_SLOC_FILE_ENTRY = 1,
660 /// Describes a source location entry (SLocEntry) for a
662 SM_SLOC_BUFFER_ENTRY = 2,
664 /// Describes a blob that contains the data for a buffer
665 /// entry. This kind of record always directly follows a
666 /// SM_SLOC_BUFFER_ENTRY record or a SM_SLOC_FILE_ENTRY with an
667 /// overridden buffer.
668 SM_SLOC_BUFFER_BLOB = 3,
670 /// Describes a zlib-compressed blob that contains the data for
672 SM_SLOC_BUFFER_BLOB_COMPRESSED = 4,
674 /// Describes a source location entry (SLocEntry) for a
676 SM_SLOC_EXPANSION_ENTRY = 5
679 /// Record types used within a preprocessor block.
680 enum PreprocessorRecordTypes {
681 // The macros in the PP section are a PP_MACRO_* instance followed by a
682 // list of PP_TOKEN instances for each token in the definition.
684 /// An object-like macro definition.
685 /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
686 PP_MACRO_OBJECT_LIKE = 1,
688 /// A function-like macro definition.
689 /// [PP_MACRO_FUNCTION_LIKE, \<ObjectLikeStuff>, IsC99Varargs,
690 /// IsGNUVarars, NumArgs, ArgIdentInfoID* ]
691 PP_MACRO_FUNCTION_LIKE = 2,
693 /// Describes one token.
694 /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
697 /// The macro directives history for a particular identifier.
698 PP_MACRO_DIRECTIVE_HISTORY = 4,
700 /// A macro directive exported by a module.
701 /// [PP_MODULE_MACRO, SubmoduleID, MacroID, (Overridden SubmoduleID)*]
705 /// Record types used within a preprocessor detail block.
706 enum PreprocessorDetailRecordTypes {
707 /// Describes a macro expansion within the preprocessing record.
708 PPD_MACRO_EXPANSION = 0,
710 /// Describes a macro definition within the preprocessing record.
711 PPD_MACRO_DEFINITION = 1,
713 /// Describes an inclusion directive within the preprocessing
715 PPD_INCLUSION_DIRECTIVE = 2
718 /// Record types used within a submodule description block.
719 enum SubmoduleRecordTypes {
720 /// Metadata for submodules as a whole.
721 SUBMODULE_METADATA = 0,
723 /// Defines the major attributes of a submodule, including its
725 SUBMODULE_DEFINITION = 1,
727 /// Specifies the umbrella header used to create this module,
729 SUBMODULE_UMBRELLA_HEADER = 2,
731 /// Specifies a header that falls into this (sub)module.
732 SUBMODULE_HEADER = 3,
734 /// Specifies a top-level header that falls into this (sub)module.
735 SUBMODULE_TOPHEADER = 4,
737 /// Specifies an umbrella directory.
738 SUBMODULE_UMBRELLA_DIR = 5,
740 /// Specifies the submodules that are imported by this
742 SUBMODULE_IMPORTS = 6,
744 /// Specifies the submodules that are re-exported from this
746 SUBMODULE_EXPORTS = 7,
748 /// Specifies a required feature.
749 SUBMODULE_REQUIRES = 8,
751 /// Specifies a header that has been explicitly excluded
752 /// from this submodule.
753 SUBMODULE_EXCLUDED_HEADER = 9,
755 /// Specifies a library or framework to link against.
756 SUBMODULE_LINK_LIBRARY = 10,
758 /// Specifies a configuration macro for this module.
759 SUBMODULE_CONFIG_MACRO = 11,
761 /// Specifies a conflict with another module.
762 SUBMODULE_CONFLICT = 12,
764 /// Specifies a header that is private to this submodule.
765 SUBMODULE_PRIVATE_HEADER = 13,
767 /// Specifies a header that is part of the module but must be
768 /// textually included.
769 SUBMODULE_TEXTUAL_HEADER = 14,
771 /// Specifies a header that is private to this submodule but
772 /// must be textually included.
773 SUBMODULE_PRIVATE_TEXTUAL_HEADER = 15,
775 /// Specifies some declarations with initializers that must be
776 /// emitted to initialize the module.
777 SUBMODULE_INITIALIZERS = 16,
779 /// Specifies the name of the module that will eventually
780 /// re-export the entities in this module.
781 SUBMODULE_EXPORT_AS = 17,
784 /// Record types used within a comments block.
785 enum CommentRecordTypes {
786 COMMENTS_RAW_COMMENT = 0
789 /// \defgroup ASTAST AST file AST constants
791 /// The constants in this group describe various components of the
792 /// abstract syntax tree within an AST file.
796 /// Predefined type IDs.
798 /// These type IDs correspond to predefined types in the AST
799 /// context, such as built-in types (int) and special place-holder
800 /// types (the \<overload> and \<dependent> type markers). Such
801 /// types are never actually serialized, since they will be built
802 /// by the AST context when it is created.
803 enum PredefinedTypeIDs {
805 PREDEF_TYPE_NULL_ID = 0,
808 PREDEF_TYPE_VOID_ID = 1,
810 /// The 'bool' or '_Bool' type.
811 PREDEF_TYPE_BOOL_ID = 2,
813 /// The 'char' type, when it is unsigned.
814 PREDEF_TYPE_CHAR_U_ID = 3,
816 /// The 'unsigned char' type.
817 PREDEF_TYPE_UCHAR_ID = 4,
819 /// The 'unsigned short' type.
820 PREDEF_TYPE_USHORT_ID = 5,
822 /// The 'unsigned int' type.
823 PREDEF_TYPE_UINT_ID = 6,
825 /// The 'unsigned long' type.
826 PREDEF_TYPE_ULONG_ID = 7,
828 /// The 'unsigned long long' type.
829 PREDEF_TYPE_ULONGLONG_ID = 8,
831 /// The 'char' type, when it is signed.
832 PREDEF_TYPE_CHAR_S_ID = 9,
834 /// The 'signed char' type.
835 PREDEF_TYPE_SCHAR_ID = 10,
837 /// The C++ 'wchar_t' type.
838 PREDEF_TYPE_WCHAR_ID = 11,
840 /// The (signed) 'short' type.
841 PREDEF_TYPE_SHORT_ID = 12,
843 /// The (signed) 'int' type.
844 PREDEF_TYPE_INT_ID = 13,
846 /// The (signed) 'long' type.
847 PREDEF_TYPE_LONG_ID = 14,
849 /// The (signed) 'long long' type.
850 PREDEF_TYPE_LONGLONG_ID = 15,
852 /// The 'float' type.
853 PREDEF_TYPE_FLOAT_ID = 16,
855 /// The 'double' type.
856 PREDEF_TYPE_DOUBLE_ID = 17,
858 /// The 'long double' type.
859 PREDEF_TYPE_LONGDOUBLE_ID = 18,
861 /// The placeholder type for overloaded function sets.
862 PREDEF_TYPE_OVERLOAD_ID = 19,
864 /// The placeholder type for dependent types.
865 PREDEF_TYPE_DEPENDENT_ID = 20,
867 /// The '__uint128_t' type.
868 PREDEF_TYPE_UINT128_ID = 21,
870 /// The '__int128_t' type.
871 PREDEF_TYPE_INT128_ID = 22,
873 /// The type of 'nullptr'.
874 PREDEF_TYPE_NULLPTR_ID = 23,
876 /// The C++ 'char16_t' type.
877 PREDEF_TYPE_CHAR16_ID = 24,
879 /// The C++ 'char32_t' type.
880 PREDEF_TYPE_CHAR32_ID = 25,
882 /// The ObjC 'id' type.
883 PREDEF_TYPE_OBJC_ID = 26,
885 /// The ObjC 'Class' type.
886 PREDEF_TYPE_OBJC_CLASS = 27,
888 /// The ObjC 'SEL' type.
889 PREDEF_TYPE_OBJC_SEL = 28,
891 /// The 'unknown any' placeholder type.
892 PREDEF_TYPE_UNKNOWN_ANY = 29,
894 /// The placeholder type for bound member functions.
895 PREDEF_TYPE_BOUND_MEMBER = 30,
897 /// The "auto" deduction type.
898 PREDEF_TYPE_AUTO_DEDUCT = 31,
900 /// The "auto &&" deduction type.
901 PREDEF_TYPE_AUTO_RREF_DEDUCT = 32,
903 /// The OpenCL 'half' / ARM NEON __fp16 type.
904 PREDEF_TYPE_HALF_ID = 33,
906 /// ARC's unbridged-cast placeholder type.
907 PREDEF_TYPE_ARC_UNBRIDGED_CAST = 34,
909 /// The pseudo-object placeholder type.
910 PREDEF_TYPE_PSEUDO_OBJECT = 35,
912 /// The placeholder type for builtin functions.
913 PREDEF_TYPE_BUILTIN_FN = 36,
915 /// OpenCL event type.
916 PREDEF_TYPE_EVENT_ID = 37,
918 /// OpenCL clk event type.
919 PREDEF_TYPE_CLK_EVENT_ID = 38,
921 /// OpenCL sampler type.
922 PREDEF_TYPE_SAMPLER_ID = 39,
924 /// OpenCL queue type.
925 PREDEF_TYPE_QUEUE_ID = 40,
927 /// OpenCL reserve_id type.
928 PREDEF_TYPE_RESERVE_ID_ID = 41,
930 /// The placeholder type for OpenMP array section.
931 PREDEF_TYPE_OMP_ARRAY_SECTION = 42,
933 /// The '__float128' type
934 PREDEF_TYPE_FLOAT128_ID = 43,
936 /// The '_Float16' type
937 PREDEF_TYPE_FLOAT16_ID = 44,
939 /// The C++ 'char8_t' type.
940 PREDEF_TYPE_CHAR8_ID = 45,
942 /// \brief The 'short _Accum' type
943 PREDEF_TYPE_SHORT_ACCUM_ID = 46,
945 /// \brief The '_Accum' type
946 PREDEF_TYPE_ACCUM_ID = 47,
948 /// \brief The 'long _Accum' type
949 PREDEF_TYPE_LONG_ACCUM_ID = 48,
951 /// \brief The 'unsigned short _Accum' type
952 PREDEF_TYPE_USHORT_ACCUM_ID = 49,
954 /// \brief The 'unsigned _Accum' type
955 PREDEF_TYPE_UACCUM_ID = 50,
957 /// \brief The 'unsigned long _Accum' type
958 PREDEF_TYPE_ULONG_ACCUM_ID = 51,
960 /// \brief The 'short _Fract' type
961 PREDEF_TYPE_SHORT_FRACT_ID = 52,
963 /// \brief The '_Fract' type
964 PREDEF_TYPE_FRACT_ID = 53,
966 /// \brief The 'long _Fract' type
967 PREDEF_TYPE_LONG_FRACT_ID = 54,
969 /// \brief The 'unsigned short _Fract' type
970 PREDEF_TYPE_USHORT_FRACT_ID = 55,
972 /// \brief The 'unsigned _Fract' type
973 PREDEF_TYPE_UFRACT_ID = 56,
975 /// \brief The 'unsigned long _Fract' type
976 PREDEF_TYPE_ULONG_FRACT_ID = 57,
978 /// \brief The '_Sat short _Accum' type
979 PREDEF_TYPE_SAT_SHORT_ACCUM_ID = 58,
981 /// \brief The '_Sat _Accum' type
982 PREDEF_TYPE_SAT_ACCUM_ID = 59,
984 /// \brief The '_Sat long _Accum' type
985 PREDEF_TYPE_SAT_LONG_ACCUM_ID = 60,
987 /// \brief The '_Sat unsigned short _Accum' type
988 PREDEF_TYPE_SAT_USHORT_ACCUM_ID = 61,
990 /// \brief The '_Sat unsigned _Accum' type
991 PREDEF_TYPE_SAT_UACCUM_ID = 62,
993 /// \brief The '_Sat unsigned long _Accum' type
994 PREDEF_TYPE_SAT_ULONG_ACCUM_ID = 63,
996 /// \brief The '_Sat short _Fract' type
997 PREDEF_TYPE_SAT_SHORT_FRACT_ID = 64,
999 /// \brief The '_Sat _Fract' type
1000 PREDEF_TYPE_SAT_FRACT_ID = 65,
1002 /// \brief The '_Sat long _Fract' type
1003 PREDEF_TYPE_SAT_LONG_FRACT_ID = 66,
1005 /// \brief The '_Sat unsigned short _Fract' type
1006 PREDEF_TYPE_SAT_USHORT_FRACT_ID = 67,
1008 /// \brief The '_Sat unsigned _Fract' type
1009 PREDEF_TYPE_SAT_UFRACT_ID = 68,
1011 /// \brief The '_Sat unsigned long _Fract' type
1012 PREDEF_TYPE_SAT_ULONG_FRACT_ID = 69,
1014 /// OpenCL image types with auto numeration
1015 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1016 PREDEF_TYPE_##Id##_ID,
1017 #include "clang/Basic/OpenCLImageTypes.def"
1018 /// \brief OpenCL extension types with auto numeration
1019 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
1020 PREDEF_TYPE_##Id##_ID,
1021 #include "clang/Basic/OpenCLExtensionTypes.def"
1024 /// The number of predefined type IDs that are reserved for
1025 /// the PREDEF_TYPE_* constants.
1027 /// Type IDs for non-predefined types will start at
1028 /// NUM_PREDEF_TYPE_IDs.
1029 const unsigned NUM_PREDEF_TYPE_IDS = 200;
1031 /// Record codes for each kind of type.
1033 /// These constants describe the type records that can occur within a
1034 /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
1035 /// constant describes a record for a specific type class in the
1036 /// AST. Note that DeclCode values share this code space.
1038 /// An ExtQualType record.
1041 /// A ComplexType record.
1044 /// A PointerType record.
1047 /// A BlockPointerType record.
1048 TYPE_BLOCK_POINTER = 5,
1050 /// An LValueReferenceType record.
1051 TYPE_LVALUE_REFERENCE = 6,
1053 /// An RValueReferenceType record.
1054 TYPE_RVALUE_REFERENCE = 7,
1056 /// A MemberPointerType record.
1057 TYPE_MEMBER_POINTER = 8,
1059 /// A ConstantArrayType record.
1060 TYPE_CONSTANT_ARRAY = 9,
1062 /// An IncompleteArrayType record.
1063 TYPE_INCOMPLETE_ARRAY = 10,
1065 /// A VariableArrayType record.
1066 TYPE_VARIABLE_ARRAY = 11,
1068 /// A VectorType record.
1071 /// An ExtVectorType record.
1072 TYPE_EXT_VECTOR = 13,
1074 /// A FunctionNoProtoType record.
1075 TYPE_FUNCTION_NO_PROTO = 14,
1077 /// A FunctionProtoType record.
1078 TYPE_FUNCTION_PROTO = 15,
1080 /// A TypedefType record.
1083 /// A TypeOfExprType record.
1084 TYPE_TYPEOF_EXPR = 17,
1086 /// A TypeOfType record.
1089 /// A RecordType record.
1092 /// An EnumType record.
1095 /// An ObjCInterfaceType record.
1096 TYPE_OBJC_INTERFACE = 21,
1098 /// An ObjCObjectPointerType record.
1099 TYPE_OBJC_OBJECT_POINTER = 22,
1101 /// a DecltypeType record.
1104 /// An ElaboratedType record.
1105 TYPE_ELABORATED = 24,
1107 /// A SubstTemplateTypeParmType record.
1108 TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
1110 /// An UnresolvedUsingType record.
1111 TYPE_UNRESOLVED_USING = 26,
1113 /// An InjectedClassNameType record.
1114 TYPE_INJECTED_CLASS_NAME = 27,
1116 /// An ObjCObjectType record.
1117 TYPE_OBJC_OBJECT = 28,
1119 /// An TemplateTypeParmType record.
1120 TYPE_TEMPLATE_TYPE_PARM = 29,
1122 /// An TemplateSpecializationType record.
1123 TYPE_TEMPLATE_SPECIALIZATION = 30,
1125 /// A DependentNameType record.
1126 TYPE_DEPENDENT_NAME = 31,
1128 /// A DependentTemplateSpecializationType record.
1129 TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
1131 /// A DependentSizedArrayType record.
1132 TYPE_DEPENDENT_SIZED_ARRAY = 33,
1134 /// A ParenType record.
1137 /// A PackExpansionType record.
1138 TYPE_PACK_EXPANSION = 35,
1140 /// An AttributedType record.
1141 TYPE_ATTRIBUTED = 36,
1143 /// A SubstTemplateTypeParmPackType record.
1144 TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
1146 /// A AutoType record.
1149 /// A UnaryTransformType record.
1150 TYPE_UNARY_TRANSFORM = 39,
1152 /// An AtomicType record.
1155 /// A DecayedType record.
1158 /// An AdjustedType record.
1161 /// A PipeType record.
1164 /// An ObjCTypeParamType record.
1165 TYPE_OBJC_TYPE_PARAM = 44,
1167 /// A DeducedTemplateSpecializationType record.
1168 TYPE_DEDUCED_TEMPLATE_SPECIALIZATION = 45,
1170 /// A DependentSizedExtVectorType record.
1171 TYPE_DEPENDENT_SIZED_EXT_VECTOR = 46,
1173 /// A DependentAddressSpaceType record.
1174 TYPE_DEPENDENT_ADDRESS_SPACE = 47,
1176 /// A dependentSizedVectorType record.
1177 TYPE_DEPENDENT_SIZED_VECTOR = 48
1180 /// The type IDs for special types constructed by semantic
1183 /// The constants in this enumeration are indices into the
1184 /// SPECIAL_TYPES record.
1185 enum SpecialTypeIDs {
1186 /// CFConstantString type
1187 SPECIAL_TYPE_CF_CONSTANT_STRING = 0,
1189 /// C FILE typedef type
1190 SPECIAL_TYPE_FILE = 1,
1192 /// C jmp_buf typedef type
1193 SPECIAL_TYPE_JMP_BUF = 2,
1195 /// C sigjmp_buf typedef type
1196 SPECIAL_TYPE_SIGJMP_BUF = 3,
1198 /// Objective-C "id" redefinition type
1199 SPECIAL_TYPE_OBJC_ID_REDEFINITION = 4,
1201 /// Objective-C "Class" redefinition type
1202 SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 5,
1204 /// Objective-C "SEL" redefinition type
1205 SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 6,
1207 /// C ucontext_t typedef type
1208 SPECIAL_TYPE_UCONTEXT_T = 7
1211 /// The number of special type IDs.
1212 const unsigned NumSpecialTypeIDs = 8;
1214 /// Predefined declaration IDs.
1216 /// These declaration IDs correspond to predefined declarations in the AST
1217 /// context, such as the NULL declaration ID. Such declarations are never
1218 /// actually serialized, since they will be built by the AST context when
1220 enum PredefinedDeclIDs {
1221 /// The NULL declaration.
1222 PREDEF_DECL_NULL_ID = 0,
1224 /// The translation unit.
1225 PREDEF_DECL_TRANSLATION_UNIT_ID = 1,
1227 /// The Objective-C 'id' type.
1228 PREDEF_DECL_OBJC_ID_ID = 2,
1230 /// The Objective-C 'SEL' type.
1231 PREDEF_DECL_OBJC_SEL_ID = 3,
1233 /// The Objective-C 'Class' type.
1234 PREDEF_DECL_OBJC_CLASS_ID = 4,
1236 /// The Objective-C 'Protocol' type.
1237 PREDEF_DECL_OBJC_PROTOCOL_ID = 5,
1239 /// The signed 128-bit integer type.
1240 PREDEF_DECL_INT_128_ID = 6,
1242 /// The unsigned 128-bit integer type.
1243 PREDEF_DECL_UNSIGNED_INT_128_ID = 7,
1245 /// The internal 'instancetype' typedef.
1246 PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8,
1248 /// The internal '__builtin_va_list' typedef.
1249 PREDEF_DECL_BUILTIN_VA_LIST_ID = 9,
1251 /// The internal '__va_list_tag' struct, if any.
1252 PREDEF_DECL_VA_LIST_TAG = 10,
1254 /// The internal '__builtin_ms_va_list' typedef.
1255 PREDEF_DECL_BUILTIN_MS_VA_LIST_ID = 11,
1257 /// The extern "C" context.
1258 PREDEF_DECL_EXTERN_C_CONTEXT_ID = 12,
1260 /// The internal '__make_integer_seq' template.
1261 PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 13,
1263 /// The internal '__NSConstantString' typedef.
1264 PREDEF_DECL_CF_CONSTANT_STRING_ID = 14,
1266 /// The internal '__NSConstantString' tag type.
1267 PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID = 15,
1269 /// The internal '__type_pack_element' template.
1270 PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 16,
1273 /// The number of declaration IDs that are predefined.
1275 /// For more information about predefined declarations, see the
1276 /// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants.
1277 const unsigned int NUM_PREDEF_DECL_IDS = 17;
1279 /// Record of updates for a declaration that was modified after
1280 /// being deserialized. This can occur within DECLTYPES_BLOCK_ID.
1281 const unsigned int DECL_UPDATES = 49;
1283 /// Record code for a list of local redeclarations of a declaration.
1284 /// This can occur within DECLTYPES_BLOCK_ID.
1285 const unsigned int LOCAL_REDECLARATIONS = 50;
1287 /// Record codes for each kind of declaration.
1289 /// These constants describe the declaration records that can occur within
1290 /// a declarations block (identified by DECLTYPES_BLOCK_ID). Each
1291 /// constant describes a record for a specific declaration class
1292 /// in the AST. Note that TypeCode values share this code space.
1294 /// A TypedefDecl record.
1296 /// A TypeAliasDecl record.
1300 /// An EnumDecl record.
1303 /// A RecordDecl record.
1306 /// An EnumConstantDecl record.
1309 /// A FunctionDecl record.
1312 /// A ObjCMethodDecl record.
1315 /// A ObjCInterfaceDecl record.
1316 DECL_OBJC_INTERFACE,
1318 /// A ObjCProtocolDecl record.
1321 /// A ObjCIvarDecl record.
1324 /// A ObjCAtDefsFieldDecl record.
1325 DECL_OBJC_AT_DEFS_FIELD,
1327 /// A ObjCCategoryDecl record.
1330 /// A ObjCCategoryImplDecl record.
1331 DECL_OBJC_CATEGORY_IMPL,
1333 /// A ObjCImplementationDecl record.
1334 DECL_OBJC_IMPLEMENTATION,
1336 /// A ObjCCompatibleAliasDecl record.
1337 DECL_OBJC_COMPATIBLE_ALIAS,
1339 /// A ObjCPropertyDecl record.
1342 /// A ObjCPropertyImplDecl record.
1343 DECL_OBJC_PROPERTY_IMPL,
1345 /// A FieldDecl record.
1348 /// A MSPropertyDecl record.
1351 /// A VarDecl record.
1354 /// An ImplicitParamDecl record.
1355 DECL_IMPLICIT_PARAM,
1357 /// A ParmVarDecl record.
1360 /// A DecompositionDecl record.
1363 /// A BindingDecl record.
1366 /// A FileScopeAsmDecl record.
1367 DECL_FILE_SCOPE_ASM,
1369 /// A BlockDecl record.
1372 /// A CapturedDecl record.
1375 /// A record that stores the set of declarations that are
1376 /// lexically stored within a given DeclContext.
1378 /// The record itself is a blob that is an array of declaration IDs,
1379 /// in the order in which those declarations were added to the
1380 /// declaration context. This data is used when iterating over
1381 /// the contents of a DeclContext, e.g., via
1382 /// DeclContext::decls_begin() and DeclContext::decls_end().
1383 DECL_CONTEXT_LEXICAL,
1385 /// A record that stores the set of declarations that are
1386 /// visible from a given DeclContext.
1388 /// The record itself stores a set of mappings, each of which
1389 /// associates a declaration name with one or more declaration
1390 /// IDs. This data is used when performing qualified name lookup
1391 /// into a DeclContext via DeclContext::lookup.
1392 DECL_CONTEXT_VISIBLE,
1394 /// A LabelDecl record.
1397 /// A NamespaceDecl record.
1400 /// A NamespaceAliasDecl record.
1401 DECL_NAMESPACE_ALIAS,
1403 /// A UsingDecl record.
1406 /// A UsingPackDecl record.
1409 /// A UsingShadowDecl record.
1412 /// A ConstructorUsingShadowDecl record.
1413 DECL_CONSTRUCTOR_USING_SHADOW,
1415 /// A UsingDirecitveDecl record.
1416 DECL_USING_DIRECTIVE,
1418 /// An UnresolvedUsingValueDecl record.
1419 DECL_UNRESOLVED_USING_VALUE,
1421 /// An UnresolvedUsingTypenameDecl record.
1422 DECL_UNRESOLVED_USING_TYPENAME,
1424 /// A LinkageSpecDecl record.
1427 /// An ExportDecl record.
1430 /// A CXXRecordDecl record.
1433 /// A CXXDeductionGuideDecl record.
1434 DECL_CXX_DEDUCTION_GUIDE,
1436 /// A CXXMethodDecl record.
1439 /// A CXXConstructorDecl record.
1440 DECL_CXX_CONSTRUCTOR,
1442 /// A CXXConstructorDecl record for an inherited constructor.
1443 DECL_CXX_INHERITED_CONSTRUCTOR,
1445 /// A CXXDestructorDecl record.
1446 DECL_CXX_DESTRUCTOR,
1448 /// A CXXConversionDecl record.
1449 DECL_CXX_CONVERSION,
1451 /// An AccessSpecDecl record.
1454 /// A FriendDecl record.
1457 /// A FriendTemplateDecl record.
1458 DECL_FRIEND_TEMPLATE,
1460 /// A ClassTemplateDecl record.
1461 DECL_CLASS_TEMPLATE,
1463 /// A ClassTemplateSpecializationDecl record.
1464 DECL_CLASS_TEMPLATE_SPECIALIZATION,
1466 /// A ClassTemplatePartialSpecializationDecl record.
1467 DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
1469 /// A VarTemplateDecl record.
1472 /// A VarTemplateSpecializationDecl record.
1473 DECL_VAR_TEMPLATE_SPECIALIZATION,
1475 /// A VarTemplatePartialSpecializationDecl record.
1476 DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION,
1478 /// A FunctionTemplateDecl record.
1479 DECL_FUNCTION_TEMPLATE,
1481 /// A TemplateTypeParmDecl record.
1482 DECL_TEMPLATE_TYPE_PARM,
1484 /// A NonTypeTemplateParmDecl record.
1485 DECL_NON_TYPE_TEMPLATE_PARM,
1487 /// A TemplateTemplateParmDecl record.
1488 DECL_TEMPLATE_TEMPLATE_PARM,
1490 /// A TypeAliasTemplateDecl record.
1491 DECL_TYPE_ALIAS_TEMPLATE,
1493 /// A StaticAssertDecl record.
1496 /// A record containing CXXBaseSpecifiers.
1497 DECL_CXX_BASE_SPECIFIERS,
1499 /// A record containing CXXCtorInitializers.
1500 DECL_CXX_CTOR_INITIALIZERS,
1502 /// A IndirectFieldDecl record.
1505 /// A NonTypeTemplateParmDecl record that stores an expanded
1506 /// non-type template parameter pack.
1507 DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK,
1509 /// A TemplateTemplateParmDecl record that stores an expanded
1510 /// template template parameter pack.
1511 DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK,
1513 /// A ClassScopeFunctionSpecializationDecl record a class scope
1514 /// function specialization. (Microsoft extension).
1515 DECL_CLASS_SCOPE_FUNCTION_SPECIALIZATION,
1517 /// An ImportDecl recording a module import.
1520 /// An OMPThreadPrivateDecl record.
1521 DECL_OMP_THREADPRIVATE,
1523 /// An OMPRequiresDecl record.
1526 /// An EmptyDecl record.
1529 /// An ObjCTypeParamDecl record.
1530 DECL_OBJC_TYPE_PARAM,
1532 /// An OMPCapturedExprDecl record.
1533 DECL_OMP_CAPTUREDEXPR,
1535 /// A PragmaCommentDecl record.
1536 DECL_PRAGMA_COMMENT,
1538 /// A PragmaDetectMismatchDecl record.
1539 DECL_PRAGMA_DETECT_MISMATCH,
1541 /// An OMPDeclareReductionDecl record.
1542 DECL_OMP_DECLARE_REDUCTION,
1544 DECL_LAST = DECL_OMP_DECLARE_REDUCTION
1547 /// Record codes for each kind of statement or expression.
1549 /// These constants describe the records that describe statements
1550 /// or expressions. These records occur within type and declarations
1551 /// block, so they begin with record values of 128. Each constant
1552 /// describes a record for a specific statement or expression class in the
1555 /// A marker record that indicates that we are at the end
1556 /// of an expression.
1557 STMT_STOP = DECL_LAST + 1,
1559 /// A NULL expression.
1562 /// A reference to a previously [de]serialized Stmt record.
1565 /// A NullStmt record.
1568 /// A CompoundStmt record.
1571 /// A CaseStmt record.
1574 /// A DefaultStmt record.
1577 /// A LabelStmt record.
1580 /// An AttributedStmt record.
1583 /// An IfStmt record.
1586 /// A SwitchStmt record.
1589 /// A WhileStmt record.
1592 /// A DoStmt record.
1595 /// A ForStmt record.
1598 /// A GotoStmt record.
1601 /// An IndirectGotoStmt record.
1604 /// A ContinueStmt record.
1607 /// A BreakStmt record.
1610 /// A ReturnStmt record.
1613 /// A DeclStmt record.
1616 /// A CapturedStmt record.
1619 /// A GCC-style AsmStmt record.
1622 /// A MS-style AsmStmt record.
1625 /// A constant expression context.
1628 /// A PredefinedExpr record.
1631 /// A DeclRefExpr record.
1634 /// An IntegerLiteral record.
1635 EXPR_INTEGER_LITERAL,
1637 /// A FloatingLiteral record.
1638 EXPR_FLOATING_LITERAL,
1640 /// An ImaginaryLiteral record.
1641 EXPR_IMAGINARY_LITERAL,
1643 /// A StringLiteral record.
1644 EXPR_STRING_LITERAL,
1646 /// A CharacterLiteral record.
1647 EXPR_CHARACTER_LITERAL,
1649 /// A ParenExpr record.
1652 /// A ParenListExpr record.
1655 /// A UnaryOperator record.
1656 EXPR_UNARY_OPERATOR,
1658 /// An OffsetOfExpr record.
1661 /// A SizefAlignOfExpr record.
1662 EXPR_SIZEOF_ALIGN_OF,
1664 /// An ArraySubscriptExpr record.
1665 EXPR_ARRAY_SUBSCRIPT,
1667 /// A CallExpr record.
1670 /// A MemberExpr record.
1673 /// A BinaryOperator record.
1674 EXPR_BINARY_OPERATOR,
1676 /// A CompoundAssignOperator record.
1677 EXPR_COMPOUND_ASSIGN_OPERATOR,
1679 /// A ConditionOperator record.
1680 EXPR_CONDITIONAL_OPERATOR,
1682 /// An ImplicitCastExpr record.
1685 /// A CStyleCastExpr record.
1688 /// A CompoundLiteralExpr record.
1689 EXPR_COMPOUND_LITERAL,
1691 /// An ExtVectorElementExpr record.
1692 EXPR_EXT_VECTOR_ELEMENT,
1694 /// An InitListExpr record.
1697 /// A DesignatedInitExpr record.
1698 EXPR_DESIGNATED_INIT,
1700 /// A DesignatedInitUpdateExpr record.
1701 EXPR_DESIGNATED_INIT_UPDATE,
1703 /// An NoInitExpr record.
1706 /// An ArrayInitLoopExpr record.
1707 EXPR_ARRAY_INIT_LOOP,
1709 /// An ArrayInitIndexExpr record.
1710 EXPR_ARRAY_INIT_INDEX,
1712 /// An ImplicitValueInitExpr record.
1713 EXPR_IMPLICIT_VALUE_INIT,
1715 /// A VAArgExpr record.
1718 /// An AddrLabelExpr record.
1721 /// A StmtExpr record.
1724 /// A ChooseExpr record.
1727 /// A GNUNullExpr record.
1730 /// A ShuffleVectorExpr record.
1731 EXPR_SHUFFLE_VECTOR,
1733 /// A ConvertVectorExpr record.
1734 EXPR_CONVERT_VECTOR,
1739 /// A GenericSelectionExpr record.
1740 EXPR_GENERIC_SELECTION,
1742 /// A PseudoObjectExpr record.
1745 /// An AtomicExpr record.
1750 /// An ObjCStringLiteral record.
1751 EXPR_OBJC_STRING_LITERAL,
1753 EXPR_OBJC_BOXED_EXPRESSION,
1754 EXPR_OBJC_ARRAY_LITERAL,
1755 EXPR_OBJC_DICTIONARY_LITERAL,
1757 /// An ObjCEncodeExpr record.
1760 /// An ObjCSelectorExpr record.
1761 EXPR_OBJC_SELECTOR_EXPR,
1763 /// An ObjCProtocolExpr record.
1764 EXPR_OBJC_PROTOCOL_EXPR,
1766 /// An ObjCIvarRefExpr record.
1767 EXPR_OBJC_IVAR_REF_EXPR,
1769 /// An ObjCPropertyRefExpr record.
1770 EXPR_OBJC_PROPERTY_REF_EXPR,
1772 /// An ObjCSubscriptRefExpr record.
1773 EXPR_OBJC_SUBSCRIPT_REF_EXPR,
1776 EXPR_OBJC_KVC_REF_EXPR,
1778 /// An ObjCMessageExpr record.
1779 EXPR_OBJC_MESSAGE_EXPR,
1781 /// An ObjCIsa Expr record.
1784 /// An ObjCIndirectCopyRestoreExpr record.
1785 EXPR_OBJC_INDIRECT_COPY_RESTORE,
1787 /// An ObjCForCollectionStmt record.
1788 STMT_OBJC_FOR_COLLECTION,
1790 /// An ObjCAtCatchStmt record.
1793 /// An ObjCAtFinallyStmt record.
1796 /// An ObjCAtTryStmt record.
1799 /// An ObjCAtSynchronizedStmt record.
1800 STMT_OBJC_AT_SYNCHRONIZED,
1802 /// An ObjCAtThrowStmt record.
1805 /// An ObjCAutoreleasePoolStmt record.
1806 STMT_OBJC_AUTORELEASE_POOL,
1808 /// An ObjCBoolLiteralExpr record.
1809 EXPR_OBJC_BOOL_LITERAL,
1811 /// An ObjCAvailabilityCheckExpr record.
1812 EXPR_OBJC_AVAILABILITY_CHECK,
1816 /// A CXXCatchStmt record.
1819 /// A CXXTryStmt record.
1821 /// A CXXForRangeStmt record.
1825 /// A CXXOperatorCallExpr record.
1826 EXPR_CXX_OPERATOR_CALL,
1828 /// A CXXMemberCallExpr record.
1829 EXPR_CXX_MEMBER_CALL,
1831 /// A CXXConstructExpr record.
1834 /// A CXXInheritedCtorInitExpr record.
1835 EXPR_CXX_INHERITED_CTOR_INIT,
1837 /// A CXXTemporaryObjectExpr record.
1838 EXPR_CXX_TEMPORARY_OBJECT,
1840 /// A CXXStaticCastExpr record.
1841 EXPR_CXX_STATIC_CAST,
1843 /// A CXXDynamicCastExpr record.
1844 EXPR_CXX_DYNAMIC_CAST,
1846 /// A CXXReinterpretCastExpr record.
1847 EXPR_CXX_REINTERPRET_CAST,
1849 /// A CXXConstCastExpr record.
1850 EXPR_CXX_CONST_CAST,
1852 /// A CXXFunctionalCastExpr record.
1853 EXPR_CXX_FUNCTIONAL_CAST,
1855 /// A UserDefinedLiteral record.
1856 EXPR_USER_DEFINED_LITERAL,
1858 /// A CXXStdInitializerListExpr record.
1859 EXPR_CXX_STD_INITIALIZER_LIST,
1861 /// A CXXBoolLiteralExpr record.
1862 EXPR_CXX_BOOL_LITERAL,
1864 EXPR_CXX_NULL_PTR_LITERAL, // CXXNullPtrLiteralExpr
1865 EXPR_CXX_TYPEID_EXPR, // CXXTypeidExpr (of expr).
1866 EXPR_CXX_TYPEID_TYPE, // CXXTypeidExpr (of type).
1867 EXPR_CXX_THIS, // CXXThisExpr
1868 EXPR_CXX_THROW, // CXXThrowExpr
1869 EXPR_CXX_DEFAULT_ARG, // CXXDefaultArgExpr
1870 EXPR_CXX_DEFAULT_INIT, // CXXDefaultInitExpr
1871 EXPR_CXX_BIND_TEMPORARY, // CXXBindTemporaryExpr
1873 EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
1874 EXPR_CXX_NEW, // CXXNewExpr
1875 EXPR_CXX_DELETE, // CXXDeleteExpr
1876 EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
1878 EXPR_EXPR_WITH_CLEANUPS, // ExprWithCleanups
1880 EXPR_CXX_DEPENDENT_SCOPE_MEMBER, // CXXDependentScopeMemberExpr
1881 EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
1882 EXPR_CXX_UNRESOLVED_CONSTRUCT, // CXXUnresolvedConstructExpr
1883 EXPR_CXX_UNRESOLVED_MEMBER, // UnresolvedMemberExpr
1884 EXPR_CXX_UNRESOLVED_LOOKUP, // UnresolvedLookupExpr
1886 EXPR_CXX_EXPRESSION_TRAIT, // ExpressionTraitExpr
1887 EXPR_CXX_NOEXCEPT, // CXXNoexceptExpr
1889 EXPR_OPAQUE_VALUE, // OpaqueValueExpr
1890 EXPR_BINARY_CONDITIONAL_OPERATOR, // BinaryConditionalOperator
1891 EXPR_TYPE_TRAIT, // TypeTraitExpr
1892 EXPR_ARRAY_TYPE_TRAIT, // ArrayTypeTraitIntExpr
1894 EXPR_PACK_EXPANSION, // PackExpansionExpr
1895 EXPR_SIZEOF_PACK, // SizeOfPackExpr
1896 EXPR_SUBST_NON_TYPE_TEMPLATE_PARM, // SubstNonTypeTemplateParmExpr
1897 EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
1898 EXPR_FUNCTION_PARM_PACK, // FunctionParmPackExpr
1899 EXPR_MATERIALIZE_TEMPORARY, // MaterializeTemporaryExpr
1900 EXPR_CXX_FOLD, // CXXFoldExpr
1903 EXPR_CUDA_KERNEL_CALL, // CUDAKernelCallExpr
1906 EXPR_ASTYPE, // AsTypeExpr
1909 EXPR_CXX_PROPERTY_REF_EXPR, // MSPropertyRefExpr
1910 EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR, // MSPropertySubscriptExpr
1911 EXPR_CXX_UUIDOF_EXPR, // CXXUuidofExpr (of expr).
1912 EXPR_CXX_UUIDOF_TYPE, // CXXUuidofExpr (of type).
1913 STMT_SEH_LEAVE, // SEHLeaveStmt
1914 STMT_SEH_EXCEPT, // SEHExceptStmt
1915 STMT_SEH_FINALLY, // SEHFinallyStmt
1916 STMT_SEH_TRY, // SEHTryStmt
1918 // OpenMP directives
1919 STMT_OMP_PARALLEL_DIRECTIVE,
1920 STMT_OMP_SIMD_DIRECTIVE,
1921 STMT_OMP_FOR_DIRECTIVE,
1922 STMT_OMP_FOR_SIMD_DIRECTIVE,
1923 STMT_OMP_SECTIONS_DIRECTIVE,
1924 STMT_OMP_SECTION_DIRECTIVE,
1925 STMT_OMP_SINGLE_DIRECTIVE,
1926 STMT_OMP_MASTER_DIRECTIVE,
1927 STMT_OMP_CRITICAL_DIRECTIVE,
1928 STMT_OMP_PARALLEL_FOR_DIRECTIVE,
1929 STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE,
1930 STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE,
1931 STMT_OMP_TASK_DIRECTIVE,
1932 STMT_OMP_TASKYIELD_DIRECTIVE,
1933 STMT_OMP_BARRIER_DIRECTIVE,
1934 STMT_OMP_TASKWAIT_DIRECTIVE,
1935 STMT_OMP_FLUSH_DIRECTIVE,
1936 STMT_OMP_ORDERED_DIRECTIVE,
1937 STMT_OMP_ATOMIC_DIRECTIVE,
1938 STMT_OMP_TARGET_DIRECTIVE,
1939 STMT_OMP_TARGET_DATA_DIRECTIVE,
1940 STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE,
1941 STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE,
1942 STMT_OMP_TARGET_PARALLEL_DIRECTIVE,
1943 STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE,
1944 STMT_OMP_TEAMS_DIRECTIVE,
1945 STMT_OMP_TASKGROUP_DIRECTIVE,
1946 STMT_OMP_CANCELLATION_POINT_DIRECTIVE,
1947 STMT_OMP_CANCEL_DIRECTIVE,
1948 STMT_OMP_TASKLOOP_DIRECTIVE,
1949 STMT_OMP_TASKLOOP_SIMD_DIRECTIVE,
1950 STMT_OMP_DISTRIBUTE_DIRECTIVE,
1951 STMT_OMP_TARGET_UPDATE_DIRECTIVE,
1952 STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1953 STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1954 STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE,
1955 STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE,
1956 STMT_OMP_TARGET_SIMD_DIRECTIVE,
1957 STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE,
1958 STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
1959 STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1960 STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1961 STMT_OMP_TARGET_TEAMS_DIRECTIVE,
1962 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE,
1963 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1964 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1965 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
1966 EXPR_OMP_ARRAY_SECTION,
1969 EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr
1971 STMT_MS_DEPENDENT_EXISTS, // MSDependentExistsStmt
1972 EXPR_LAMBDA, // LambdaExpr
1973 STMT_COROUTINE_BODY,
1977 EXPR_DEPENDENT_COAWAIT,
1980 /// The kinds of designators that can occur in a
1981 /// DesignatedInitExpr.
1982 enum DesignatorTypes {
1983 /// Field designator where only the field name is known.
1984 DESIG_FIELD_NAME = 0,
1986 /// Field designator where the field has been resolved to
1988 DESIG_FIELD_DECL = 1,
1990 /// Array designator.
1993 /// GNU array range designator.
1994 DESIG_ARRAY_RANGE = 3
1997 /// The different kinds of data that can occur in a
1998 /// CtorInitializer.
1999 enum CtorInitializerType {
2000 CTOR_INITIALIZER_BASE,
2001 CTOR_INITIALIZER_DELEGATING,
2002 CTOR_INITIALIZER_MEMBER,
2003 CTOR_INITIALIZER_INDIRECT_MEMBER
2006 /// Describes the redeclarations of a declaration.
2007 struct LocalRedeclarationsInfo {
2008 // The ID of the first declaration
2011 // Offset into the array of redeclaration chains.
2014 friend bool operator<(const LocalRedeclarationsInfo &X,
2015 const LocalRedeclarationsInfo &Y) {
2016 return X.FirstID < Y.FirstID;
2019 friend bool operator>(const LocalRedeclarationsInfo &X,
2020 const LocalRedeclarationsInfo &Y) {
2021 return X.FirstID > Y.FirstID;
2024 friend bool operator<=(const LocalRedeclarationsInfo &X,
2025 const LocalRedeclarationsInfo &Y) {
2026 return X.FirstID <= Y.FirstID;
2029 friend bool operator>=(const LocalRedeclarationsInfo &X,
2030 const LocalRedeclarationsInfo &Y) {
2031 return X.FirstID >= Y.FirstID;
2035 /// Describes the categories of an Objective-C class.
2036 struct ObjCCategoriesInfo {
2037 // The ID of the definition
2038 DeclID DefinitionID;
2040 // Offset into the array of category lists.
2043 friend bool operator<(const ObjCCategoriesInfo &X,
2044 const ObjCCategoriesInfo &Y) {
2045 return X.DefinitionID < Y.DefinitionID;
2048 friend bool operator>(const ObjCCategoriesInfo &X,
2049 const ObjCCategoriesInfo &Y) {
2050 return X.DefinitionID > Y.DefinitionID;
2053 friend bool operator<=(const ObjCCategoriesInfo &X,
2054 const ObjCCategoriesInfo &Y) {
2055 return X.DefinitionID <= Y.DefinitionID;
2058 friend bool operator>=(const ObjCCategoriesInfo &X,
2059 const ObjCCategoriesInfo &Y) {
2060 return X.DefinitionID >= Y.DefinitionID;
2064 /// A key used when looking up entities by \ref DeclarationName.
2066 /// Different \ref DeclarationNames are mapped to different keys, but the
2067 /// same key can occasionally represent multiple names (for names that
2068 /// contain types, in particular).
2069 class DeclarationNameKey {
2070 using NameKind = unsigned;
2076 DeclarationNameKey() = default;
2077 DeclarationNameKey(DeclarationName Name);
2078 DeclarationNameKey(NameKind Kind, uint64_t Data)
2079 : Kind(Kind), Data(Data) {}
2081 NameKind getKind() const { return Kind; }
2083 IdentifierInfo *getIdentifier() const {
2084 assert(Kind == DeclarationName::Identifier ||
2085 Kind == DeclarationName::CXXLiteralOperatorName ||
2086 Kind == DeclarationName::CXXDeductionGuideName);
2087 return (IdentifierInfo *)Data;
2090 Selector getSelector() const {
2091 assert(Kind == DeclarationName::ObjCZeroArgSelector ||
2092 Kind == DeclarationName::ObjCOneArgSelector ||
2093 Kind == DeclarationName::ObjCMultiArgSelector);
2094 return Selector(Data);
2097 OverloadedOperatorKind getOperatorKind() const {
2098 assert(Kind == DeclarationName::CXXOperatorName);
2099 return (OverloadedOperatorKind)Data;
2102 /// Compute a fingerprint of this key for use in on-disk hash table.
2103 unsigned getHash() const;
2105 friend bool operator==(const DeclarationNameKey &A,
2106 const DeclarationNameKey &B) {
2107 return A.Kind == B.Kind && A.Data == B.Data;
2113 } // namespace serialization
2114 } // namespace clang
2118 template <> struct DenseMapInfo<clang::serialization::DeclarationNameKey> {
2119 static clang::serialization::DeclarationNameKey getEmptyKey() {
2120 return clang::serialization::DeclarationNameKey(-1, 1);
2123 static clang::serialization::DeclarationNameKey getTombstoneKey() {
2124 return clang::serialization::DeclarationNameKey(-1, 2);
2128 getHashValue(const clang::serialization::DeclarationNameKey &Key) {
2129 return Key.getHash();
2132 static bool isEqual(const clang::serialization::DeclarationNameKey &L,
2133 const clang::serialization::DeclarationNameKey &R) {
2140 #endif // LLVM_CLANG_SERIALIZATION_ASTBITCODES_H