//===- ASTBitCodes.h - Enum values for the PCH bitcode format ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This header defines Bitcode enum values for Clang serialized AST files. // // The enum values defined in this file should be considered permanent. If // new features are added, they should have values added at the end of the // respective lists. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_SERIALIZATION_ASTBITCODES_H #define LLVM_CLANG_SERIALIZATION_ASTBITCODES_H #include "clang/AST/DeclID.h" #include "clang/AST/DeclarationName.h" #include "clang/AST/Type.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/OperatorKinds.h" #include "clang/Basic/SourceLocation.h" #include "clang/Serialization/SourceLocationEncoding.h" #include "llvm/ADT/DenseMapInfo.h" #include "llvm/Bitstream/BitCodes.h" #include "llvm/Support/MathExtras.h" #include <cassert> #include <cstdint> namespace clang { namespace serialization { /// AST file major version number supported by this version of /// Clang. /// /// Whenever the AST file format changes in a way that makes it /// incompatible with previous versions (such that a reader /// designed for the previous version could not support reading /// the new version), this number should be increased. /// /// Version 4 of AST files also requires that the version control branch and /// revision match exactly, since there is no backward compatibility of /// AST files at this time. const unsigned VERSION_MAJOR = …; /// AST file minor version number supported by this version of /// Clang. /// /// Whenever the AST format changes in a way that is still /// compatible with previous versions (such that a reader designed /// for the previous version could still support reading the new /// version by ignoring new kinds of subblocks), this number /// should be increased. const unsigned VERSION_MINOR = …; /// An ID number that refers to an identifier in an AST file. /// /// The ID numbers of identifiers are consecutive (in order of discovery) /// and start at 1. 0 is reserved for NULL. IdentifierID; /// The number of predefined identifier IDs. const unsigned int NUM_PREDEF_IDENT_IDS = …; /// An ID number that refers to a declaration in an AST file. See the comments /// in DeclIDBase for details. DeclID; /// An ID number that refers to a type in an AST file. /// /// The ID of a type is partitioned into three parts: /// - the lower three bits are used to store the const/volatile/restrict /// qualifiers (as with QualType). /// - the next 29 bits provide a type index in the corresponding /// module file. /// - the upper 32 bits provide a module file index. /// /// The type index values are partitioned into two /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a /// placeholder for "no type". The module file index for predefined /// types are always 0 since they don't belong to any modules. /// Values from NUM_PREDEF_TYPE_IDs are other types that have /// serialized representations. TypeID; /// Same with TypeID except that the LocalTypeID is only meaningful /// with the corresponding ModuleFile. /// /// FIXME: Make TypeID and LocalTypeID a class to improve the type /// safety. LocalTypeID; /// A type index; the type ID with the qualifier bits removed. /// Keep structure alignment 32-bit since the blob is assumed as 32-bit /// aligned. class TypeIdx { … }; static_assert …; /// A structure for putting "fast"-unqualified QualTypes into a /// DenseMap. This uses the standard pointer hash function. struct UnsafeQualTypeDenseMapInfo { … }; /// An ID number that refers to a macro in an AST file. MacroID; /// A global ID number that refers to a macro in an AST file. GlobalMacroID; /// A local to a module ID number that refers to a macro in an /// AST file. LocalMacroID; /// The number of predefined macro IDs. const unsigned int NUM_PREDEF_MACRO_IDS = …; /// An ID number that refers to an ObjC selector in an AST file. SelectorID; /// The number of predefined selector IDs. const unsigned int NUM_PREDEF_SELECTOR_IDS = …; /// An ID number that refers to a set of CXXBaseSpecifiers in an /// AST file. CXXBaseSpecifiersID; /// An ID number that refers to a list of CXXCtorInitializers in an /// AST file. CXXCtorInitializersID; /// An ID number that refers to an entity in the detailed /// preprocessing record. PreprocessedEntityID; /// An ID number that refers to a submodule in a module file. SubmoduleID; /// The number of predefined submodule IDs. const unsigned int NUM_PREDEF_SUBMODULE_IDS = …; /// 32 aligned uint64_t in the AST file. Use splitted 64-bit integer into /// low/high parts to keep structure alignment 32-bit (it is important /// because blobs in bitstream are 32-bit aligned). This structure is /// serialized "as is" to the AST file. class UnalignedUInt64 { … }; /// Source range/offset of a preprocessed entity. class PPEntityOffset { … }; /// Source range of a skipped preprocessor region class PPSkippedRange { … }; /// Source location and bit offset of a declaration. Keep /// structure alignment 32-bit since the blob is assumed as 32-bit aligned. class DeclOffset { … }; // The unaligned decl ID used in the Blobs of bistreams. unaligned_decl_id_t; /// The number of predefined preprocessed entity IDs. const unsigned int NUM_PREDEF_PP_ENTITY_IDS = …; /// Describes the various kinds of blocks that occur within /// an AST file. enum BlockIDs { … }; /// Record types that occur within the control block. enum ControlRecordTypes { … }; /// Record types that occur within the options block inside /// the control block. enum OptionsRecordTypes { … }; /// Record codes for the unhashed control block. enum UnhashedControlBlockRecordTypes { … }; /// Record code for extension blocks. enum ExtensionBlockRecordTypes { … }; /// Record types that occur within the input-files block /// inside the control block. enum InputFileRecordTypes { … }; /// Record types that occur within the AST block itself. enum ASTRecordTypes { … }; /// Record types used within a source manager block. enum SourceManagerRecordTypes { … }; /// Record types used within a preprocessor block. enum PreprocessorRecordTypes { … }; /// Record types used within a preprocessor detail block. enum PreprocessorDetailRecordTypes { … }; /// Record types used within a submodule description block. enum SubmoduleRecordTypes { … }; /// Record types used within a comments block. enum CommentRecordTypes { … }; /// \defgroup ASTAST AST file AST constants /// /// The constants in this group describe various components of the /// abstract syntax tree within an AST file. /// /// @{ /// Predefined type IDs. /// /// These type IDs correspond to predefined types in the AST /// context, such as built-in types (int) and special place-holder /// types (the \<overload> and \<dependent> type markers). Such /// types are never actually serialized, since they will be built /// by the AST context when it is created. enum PredefinedTypeIDs { … }; /// The number of predefined type IDs that are reserved for /// the PREDEF_TYPE_* constants. /// /// Type IDs for non-predefined types will start at /// NUM_PREDEF_TYPE_IDs. const unsigned NUM_PREDEF_TYPE_IDS = …; // Ensure we do not overrun the predefined types we reserved // in the enum PredefinedTypeIDs above. static_assert …; /// Record codes for each kind of type. /// /// These constants describe the type records that can occur within a /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each /// constant describes a record for a specific type class in the /// AST. Note that DeclCode values share this code space. enum TypeCode { … }; /// The type IDs for special types constructed by semantic /// analysis. /// /// The constants in this enumeration are indices into the /// SPECIAL_TYPES record. enum SpecialTypeIDs { … }; /// The number of special type IDs. const unsigned NumSpecialTypeIDs = …; /// Record of updates for a declaration that was modified after /// being deserialized. This can occur within DECLTYPES_BLOCK_ID. const unsigned int DECL_UPDATES = …; /// Record code for a list of local redeclarations of a declaration. /// This can occur within DECLTYPES_BLOCK_ID. const unsigned int LOCAL_REDECLARATIONS = …; /// Record codes for each kind of declaration. /// /// These constants describe the declaration records that can occur within /// a declarations block (identified by DECLTYPES_BLOCK_ID). Each /// constant describes a record for a specific declaration class /// in the AST. Note that TypeCode values share this code space. enum DeclCode { … }; /// Record codes for each kind of statement or expression. /// /// These constants describe the records that describe statements /// or expressions. These records occur within type and declarations /// block, so they begin with record values of 128. Each constant /// describes a record for a specific statement or expression class in the /// AST. enum StmtCode { … }; /// The kinds of designators that can occur in a /// DesignatedInitExpr. enum DesignatorTypes { … }; /// The different kinds of data that can occur in a /// CtorInitializer. enum CtorInitializerType { … }; /// Kinds of cleanup objects owned by ExprWithCleanups. enum CleanupObjectKind { … }; /// Describes the categories of an Objective-C class. struct ObjCCategoriesInfo { … }; static_assert …; static_assert …; /// A key used when looking up entities by \ref DeclarationName. /// /// Different \ref DeclarationNames are mapped to different keys, but the /// same key can occasionally represent multiple names (for names that /// contain types, in particular). class DeclarationNameKey { … }; /// @} } // namespace serialization } // namespace clang namespace llvm { template <> struct DenseMapInfo<clang::serialization::DeclarationNameKey> { … }; } // namespace llvm #endif // LLVM_CLANG_SERIALIZATION_ASTBITCODES_H