diff options
Diffstat (limited to 'include/clang/Serialization/ASTBitCodes.h')
-rw-r--r-- | include/clang/Serialization/ASTBitCodes.h | 260 |
1 files changed, 187 insertions, 73 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index 4b66207..16bda6e 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -17,6 +17,7 @@ #ifndef LLVM_CLANG_SERIALIZATION_ASTBITCODES_H #define LLVM_CLANG_SERIALIZATION_ASTBITCODES_H +#include "clang/AST/DeclarationName.h" #include "clang/AST/Type.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Bitcode/BitCodes.h" @@ -61,9 +62,6 @@ namespace clang { /// used for the translation unit declaration. typedef uint32_t DeclID; - /// \brief a Decl::Kind/DeclID pair. - typedef std::pair<uint32_t, DeclID> KindDeclIDPair; - // FIXME: Turn these into classes so we can have some type safety when // we go from local ID to global and vice-versa. typedef DeclID LocalDeclID; @@ -235,7 +233,17 @@ namespace clang { /// to create this AST file. /// /// This block is part of the control block. - INPUT_FILES_BLOCK_ID + INPUT_FILES_BLOCK_ID, + + /// \brief The block of configuration options, used to check that + /// a module is being used in a configuration compatible with the + /// configuration in which it was built. + /// + /// This block is part of the control block. + OPTIONS_BLOCK_ID, + + /// \brief A block containing a module file extension. + EXTENSION_BLOCK_ID, }; /// \brief Record types that occur within the control block. @@ -246,63 +254,72 @@ namespace clang { /// \brief Record code for the list of other AST files imported by /// this AST file. - IMPORTS = 2, - - /// \brief Record code for the language options table. - /// - /// The record with this code contains the contents of the - /// LangOptions structure. We serialize the entire contents of - /// the structure, and let the reader decide which options are - /// actually important to check. - LANGUAGE_OPTIONS = 3, - - /// \brief Record code for the target options table. - TARGET_OPTIONS = 4, + IMPORTS, /// \brief Record code for the original file that was used to /// generate the AST file, including both its file ID and its /// name. - ORIGINAL_FILE = 5, + ORIGINAL_FILE, /// \brief The directory that the PCH was originally created in. - ORIGINAL_PCH_DIR = 6, + ORIGINAL_PCH_DIR, /// \brief Record code for file ID of the file or buffer that was used to /// generate the AST file. - ORIGINAL_FILE_ID = 7, + ORIGINAL_FILE_ID, /// \brief Offsets into the input-files block where input files /// reside. - INPUT_FILE_OFFSETS = 8, - - /// \brief Record code for the diagnostic options table. - DIAGNOSTIC_OPTIONS = 9, - - /// \brief Record code for the filesystem options table. - FILE_SYSTEM_OPTIONS = 10, - - /// \brief Record code for the headers search options table. - HEADER_SEARCH_OPTIONS = 11, - - /// \brief Record code for the preprocessor options table. - PREPROCESSOR_OPTIONS = 12, + INPUT_FILE_OFFSETS, /// \brief Record code for the module name. - MODULE_NAME = 13, + MODULE_NAME, /// \brief Record code for the module map file that was used to build this /// AST file. - MODULE_MAP_FILE = 14, + MODULE_MAP_FILE, /// \brief Record code for the signature that identifiers this AST file. - SIGNATURE = 15, + SIGNATURE, /// \brief Record code for the module build directory. - MODULE_DIRECTORY = 16, + MODULE_DIRECTORY, + }; + + /// \brief Record types that occur within the options block inside + /// the control block. + enum OptionsRecordTypes { + /// \brief Record code for the language options table. + /// + /// The record with this code contains the contents of the + /// LangOptions structure. We serialize the entire contents of + /// the structure, and let the reader decide which options are + /// actually important to check. + LANGUAGE_OPTIONS = 1, - /// \brief Record code for the list of other AST files made available by - /// this AST file but not actually used by it. - KNOWN_MODULE_FILES = 17, + /// \brief Record code for the target options table. + TARGET_OPTIONS, + + /// \brief Record code for the diagnostic options table. + DIAGNOSTIC_OPTIONS, + + /// \brief Record code for the filesystem options table. + FILE_SYSTEM_OPTIONS, + + /// \brief Record code for the headers search options table. + HEADER_SEARCH_OPTIONS, + + /// \brief Record code for the preprocessor options table. + PREPROCESSOR_OPTIONS, + }; + + /// \brief Record code for extension blocks. + enum ExtensionBlockRecordTypes { + /// Metadata describing this particular extension. + EXTENSION_METADATA = 1, + + /// The first record ID allocated to the extensions themselves. + FIRST_EXTENSION_RECORD_ID = 4 }; /// \brief Record types that occur within the input-files block @@ -350,7 +367,7 @@ namespace clang { /// \brief This is so that older clang versions, before the introduction /// of the control block, can read and reject the newer PCH format. - /// *DON"T CHANGE THIS NUMBER*. + /// *DON'T CHANGE THIS NUMBER*. METADATA_OLD_FORMAT = 4, /// \brief Record code for the identifier table. @@ -440,10 +457,7 @@ namespace clang { /// declarations. TU_UPDATE_LEXICAL = 22, - /// \brief Record code for the array describing the locations (in the - /// LOCAL_REDECLARATIONS record) of the redeclaration chains, indexed by - /// the first known ID. - LOCAL_REDECLARATIONS_MAP = 23, + // ID 23 used to be for a list of local redeclarations. /// \brief Record code for declarations that Sema keeps references of. SEMA_DECL_REFS = 24, @@ -521,13 +535,8 @@ namespace clang { /// imported by the AST file. IMPORTED_MODULES = 43, - // ID 40 used to be a table of merged canonical declarations. - - /// \brief Record code for the array of redeclaration chains. - /// - /// This array can only be interpreted properly using the local - /// redeclarations map. - LOCAL_REDECLARATIONS = 45, + // ID 44 used to be a table of merged canonical declarations. + // ID 45 used to be a list of declaration IDs of local redeclarations. /// \brief Record code for the array of Objective-C categories (including /// extensions). @@ -543,7 +552,10 @@ namespace clang { /// macro definition. MACRO_OFFSET = 47, - // ID 48 used to be a table of macros. + /// \brief A list of "interesting" identifiers. Only used in C++ (where we + /// don't normally do lookups into the serialized identifier table). These + /// are eagerly deserialized. + INTERESTING_IDENTIFIERS = 48, /// \brief Record code for undefined but used functions and variables that /// need a definition in this TU. @@ -758,26 +770,46 @@ namespace clang { PREDEF_TYPE_ARC_UNBRIDGED_CAST = 34, /// \brief The pseudo-object placeholder type. PREDEF_TYPE_PSEUDO_OBJECT = 35, - /// \brief The __va_list_tag placeholder type. - PREDEF_TYPE_VA_LIST_TAG = 36, /// \brief The placeholder type for builtin functions. - PREDEF_TYPE_BUILTIN_FN = 37, + PREDEF_TYPE_BUILTIN_FN = 36, /// \brief OpenCL 1d image type. - PREDEF_TYPE_IMAGE1D_ID = 38, + PREDEF_TYPE_IMAGE1D_ID = 37, /// \brief OpenCL 1d image array type. - PREDEF_TYPE_IMAGE1D_ARR_ID = 39, + PREDEF_TYPE_IMAGE1D_ARR_ID = 38, /// \brief OpenCL 1d image buffer type. - PREDEF_TYPE_IMAGE1D_BUFF_ID = 40, + PREDEF_TYPE_IMAGE1D_BUFF_ID = 39, /// \brief OpenCL 2d image type. - PREDEF_TYPE_IMAGE2D_ID = 41, + PREDEF_TYPE_IMAGE2D_ID = 40, /// \brief OpenCL 2d image array type. - PREDEF_TYPE_IMAGE2D_ARR_ID = 42, + PREDEF_TYPE_IMAGE2D_ARR_ID = 41, + /// \brief OpenCL 2d image depth type. + PREDEF_TYPE_IMAGE2D_DEP_ID = 42, + /// \brief OpenCL 2d image array depth type. + PREDEF_TYPE_IMAGE2D_ARR_DEP_ID = 43, + /// \brief OpenCL 2d image MSAA type. + PREDEF_TYPE_IMAGE2D_MSAA_ID = 44, + /// \brief OpenCL 2d image array MSAA type. + PREDEF_TYPE_IMAGE2D_ARR_MSAA_ID = 45, + /// \brief OpenCL 2d image MSAA depth type. + PREDEF_TYPE_IMAGE2D_MSAA_DEP_ID = 46, + /// \brief OpenCL 2d image array MSAA depth type. + PREDEF_TYPE_IMAGE2D_ARR_MSAA_DEPTH_ID = 47, /// \brief OpenCL 3d image type. - PREDEF_TYPE_IMAGE3D_ID = 43, + PREDEF_TYPE_IMAGE3D_ID = 48, /// \brief OpenCL event type. - PREDEF_TYPE_EVENT_ID = 44, + PREDEF_TYPE_EVENT_ID = 49, + /// \brief OpenCL clk event type. + PREDEF_TYPE_CLK_EVENT_ID = 50, /// \brief OpenCL sampler type. - PREDEF_TYPE_SAMPLER_ID = 45 + PREDEF_TYPE_SAMPLER_ID = 51, + /// \brief OpenCL queue type. + PREDEF_TYPE_QUEUE_ID = 52, + /// \brief OpenCL ndrange type. + PREDEF_TYPE_NDRANGE_ID = 53, + /// \brief OpenCL reserve_id type. + PREDEF_TYPE_RESERVE_ID_ID = 54, + /// \brief The placeholder type for OpenMP array section. + PREDEF_TYPE_OMP_ARRAY_SECTION = 55 }; /// \brief The number of predefined type IDs that are reserved for @@ -913,44 +945,56 @@ namespace clang { /// it is created. enum PredefinedDeclIDs { /// \brief The NULL declaration. - PREDEF_DECL_NULL_ID = 0, - + PREDEF_DECL_NULL_ID = 0, + /// \brief The translation unit. PREDEF_DECL_TRANSLATION_UNIT_ID = 1, - + /// \brief The Objective-C 'id' type. PREDEF_DECL_OBJC_ID_ID = 2, - + /// \brief The Objective-C 'SEL' type. PREDEF_DECL_OBJC_SEL_ID = 3, - + /// \brief The Objective-C 'Class' type. PREDEF_DECL_OBJC_CLASS_ID = 4, - + /// \brief The Objective-C 'Protocol' type. PREDEF_DECL_OBJC_PROTOCOL_ID = 5, - + /// \brief The signed 128-bit integer type. PREDEF_DECL_INT_128_ID = 6, /// \brief The unsigned 128-bit integer type. PREDEF_DECL_UNSIGNED_INT_128_ID = 7, - + /// \brief The internal 'instancetype' typedef. PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8, /// \brief The internal '__builtin_va_list' typedef. PREDEF_DECL_BUILTIN_VA_LIST_ID = 9, + /// \brief The internal '__va_list_tag' struct, if any. + PREDEF_DECL_VA_LIST_TAG = 10, + + /// \brief The internal '__builtin_ms_va_list' typedef. + PREDEF_DECL_BUILTIN_MS_VA_LIST_ID = 11, + /// \brief The extern "C" context. - PREDEF_DECL_EXTERN_C_CONTEXT_ID = 10, + PREDEF_DECL_EXTERN_C_CONTEXT_ID = 12, + + /// \brief The internal '__make_integer_seq' template. + PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 13, }; /// \brief The number of declaration IDs that are predefined. /// /// For more information about predefined declarations, see the /// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants. - const unsigned int NUM_PREDEF_DECL_IDS = 11; + const unsigned int NUM_PREDEF_DECL_IDS = 14; + + /// \brief Record code for a list of local redeclarations of a declaration. + const unsigned int LOCAL_REDECLARATIONS = 50; /// \brief Record codes for each kind of declaration. /// @@ -1369,6 +1413,7 @@ namespace clang { // Microsoft EXPR_CXX_PROPERTY_REF_EXPR, // MSPropertyRefExpr + EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR, // MSPropertySubscriptExpr EXPR_CXX_UUIDOF_EXPR, // CXXUuidofExpr (of expr). EXPR_CXX_UUIDOF_TYPE, // CXXUuidofExpr (of type). STMT_SEH_LEAVE, // SEHLeaveStmt @@ -1397,10 +1442,15 @@ namespace clang { STMT_OMP_ORDERED_DIRECTIVE, STMT_OMP_ATOMIC_DIRECTIVE, STMT_OMP_TARGET_DIRECTIVE, + STMT_OMP_TARGET_DATA_DIRECTIVE, STMT_OMP_TEAMS_DIRECTIVE, STMT_OMP_TASKGROUP_DIRECTIVE, STMT_OMP_CANCELLATION_POINT_DIRECTIVE, STMT_OMP_CANCEL_DIRECTIVE, + STMT_OMP_TASKLOOP_DIRECTIVE, + STMT_OMP_TASKLOOP_SIMD_DIRECTIVE, + STMT_OMP_DISTRIBUTE_DIRECTIVE, + EXPR_OMP_ARRAY_SECTION, // ARC EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr @@ -1484,8 +1534,72 @@ namespace clang { } }; + /// \brief 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 { + typedef unsigned NameKind; + + NameKind Kind; + uint64_t Data; + + public: + DeclarationNameKey() : Kind(), Data() {} + DeclarationNameKey(DeclarationName Name); + + DeclarationNameKey(NameKind Kind, uint64_t Data) + : Kind(Kind), Data(Data) {} + + NameKind getKind() const { return Kind; } + + IdentifierInfo *getIdentifier() const { + assert(Kind == DeclarationName::Identifier || + Kind == DeclarationName::CXXLiteralOperatorName); + return (IdentifierInfo *)Data; + } + Selector getSelector() const { + assert(Kind == DeclarationName::ObjCZeroArgSelector || + Kind == DeclarationName::ObjCOneArgSelector || + Kind == DeclarationName::ObjCMultiArgSelector); + return Selector(Data); + } + OverloadedOperatorKind getOperatorKind() const { + assert(Kind == DeclarationName::CXXOperatorName); + return (OverloadedOperatorKind)Data; + } + + /// Compute a fingerprint of this key for use in on-disk hash table. + unsigned getHash() const; + + friend bool operator==(const DeclarationNameKey &A, + const DeclarationNameKey &B) { + return A.Kind == B.Kind && A.Data == B.Data; + } + }; + /// @} } } // end namespace clang +namespace llvm { + template <> struct DenseMapInfo<clang::serialization::DeclarationNameKey> { + static clang::serialization::DeclarationNameKey getEmptyKey() { + return clang::serialization::DeclarationNameKey(-1, 1); + } + static clang::serialization::DeclarationNameKey getTombstoneKey() { + return clang::serialization::DeclarationNameKey(-1, 2); + } + static unsigned + getHashValue(const clang::serialization::DeclarationNameKey &Key) { + return Key.getHash(); + } + static bool isEqual(const clang::serialization::DeclarationNameKey &L, + const clang::serialization::DeclarationNameKey &R) { + return L == R; + } + }; +} + #endif |