diff options
Diffstat (limited to 'clang/include/clang/Serialization/ASTBitCodes.h')
-rw-r--r-- | clang/include/clang/Serialization/ASTBitCodes.h | 270 |
1 files changed, 179 insertions, 91 deletions
diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h index 1bfcbda8c9f1..c6f9f1d1a08f 100644 --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -30,84 +30,84 @@ 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 = 8; - - /// 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 = 0; - - /// 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. - using IdentifierID = uint32_t; - - /// An ID number that refers to a declaration in an AST file. - /// - /// The ID numbers of declarations are consecutive (in order of - /// discovery), with values below NUM_PREDEF_DECL_IDS being reserved. - /// At the start of a chain of precompiled headers, declaration ID 1 is - /// used for the translation unit declaration. - using DeclID = uint32_t; - - // FIXME: Turn these into classes so we can have some type safety when - // we go from local ID to global and vice-versa. - using LocalDeclID = DeclID; - using GlobalDeclID = DeclID; - - /// An ID number that refers to a type in an AST file. - /// - /// The ID of a type is partitioned into two parts: the lower - /// three bits are used to store the const/volatile/restrict - /// qualifiers (as with QualType) and the upper bits provide a - /// type 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". Values from NUM_PREDEF_TYPE_IDs are - /// other types that have serialized representations. - using TypeID = uint32_t; - - /// A type index; the type ID with the qualifier bits removed. - class TypeIdx { - uint32_t Idx = 0; - - public: - TypeIdx() = default; - explicit TypeIdx(uint32_t index) : Idx(index) {} - - uint32_t getIndex() const { return Idx; } - - TypeID asTypeID(unsigned FastQuals) const { - if (Idx == uint32_t(-1)) - return TypeID(-1); - - return (Idx << Qualifiers::FastWidth) | FastQuals; - } - - static TypeIdx fromTypeID(TypeID ID) { - if (ID == TypeID(-1)) - return TypeIdx(-1); - - return TypeIdx(ID >> Qualifiers::FastWidth); - } - }; +/// 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 = 11; + +/// 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 = 0; + +/// 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. +using IdentifierID = uint32_t; + +/// An ID number that refers to a declaration in an AST file. +/// +/// The ID numbers of declarations are consecutive (in order of +/// discovery), with values below NUM_PREDEF_DECL_IDS being reserved. +/// At the start of a chain of precompiled headers, declaration ID 1 is +/// used for the translation unit declaration. +using DeclID = uint32_t; + +// FIXME: Turn these into classes so we can have some type safety when +// we go from local ID to global and vice-versa. +using LocalDeclID = DeclID; +using GlobalDeclID = DeclID; + +/// An ID number that refers to a type in an AST file. +/// +/// The ID of a type is partitioned into two parts: the lower +/// three bits are used to store the const/volatile/restrict +/// qualifiers (as with QualType) and the upper bits provide a +/// type 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". Values from NUM_PREDEF_TYPE_IDs are +/// other types that have serialized representations. +using TypeID = uint32_t; + +/// A type index; the type ID with the qualifier bits removed. +class TypeIdx { + uint32_t Idx = 0; + +public: + TypeIdx() = default; + explicit TypeIdx(uint32_t index) : Idx(index) {} + + uint32_t getIndex() const { return Idx; } + + TypeID asTypeID(unsigned FastQuals) const { + if (Idx == uint32_t(-1)) + return TypeID(-1); + + return (Idx << Qualifiers::FastWidth) | FastQuals; + } + + static TypeIdx fromTypeID(TypeID ID) { + if (ID == TypeID(-1)) + return TypeIdx(-1); + + return TypeIdx(ID >> Qualifiers::FastWidth); + } +}; /// A structure for putting "fast"-unqualified QualTypes into a /// DenseMap. This uses the standard pointer hash function. @@ -181,7 +181,7 @@ namespace serialization { /// Raw source location of end of range. unsigned End; - /// Offset in the AST file. + /// Offset in the AST file relative to ModuleFile::MacroOffsetsBase. uint32_t BitOffset; PPEntityOffset(SourceRange R, uint32_t BitOffset) @@ -216,17 +216,43 @@ namespace serialization { } }; - /// Source range/offset of a preprocessed entity. + /// Offset 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. + struct UnderalignedInt64 { + uint32_t BitOffsetLow = 0; + uint32_t BitOffsetHigh = 0; + + UnderalignedInt64() = default; + UnderalignedInt64(uint64_t BitOffset) { setBitOffset(BitOffset); } + + void setBitOffset(uint64_t Offset) { + BitOffsetLow = Offset; + BitOffsetHigh = Offset >> 32; + } + + uint64_t getBitOffset() const { + return BitOffsetLow | (uint64_t(BitOffsetHigh) << 32); + } + }; + + /// Source location and bit offset of a declaration. struct DeclOffset { /// Raw source location. unsigned Loc = 0; - /// Offset in the AST file. - uint32_t BitOffset = 0; + /// Offset relative to the start of the DECLTYPES_BLOCK block. Keep + /// structure alignment 32-bit and avoid padding gap because undefined + /// value in the padding affects AST hash. + UnderalignedInt64 BitOffset; DeclOffset() = default; - DeclOffset(SourceLocation Loc, uint32_t BitOffset) - : Loc(Loc.getRawEncoding()), BitOffset(BitOffset) {} + DeclOffset(SourceLocation Loc, uint64_t BitOffset, + uint64_t DeclTypesBlockStartOffset) { + setLocation(Loc); + setBitOffset(BitOffset, DeclTypesBlockStartOffset); + } void setLocation(SourceLocation L) { Loc = L.getRawEncoding(); @@ -235,6 +261,15 @@ namespace serialization { SourceLocation getLocation() const { return SourceLocation::getFromRawEncoding(Loc); } + + void setBitOffset(uint64_t Offset, + const uint64_t DeclTypesBlockStartOffset) { + BitOffset.setBitOffset(Offset - DeclTypesBlockStartOffset); + } + + uint64_t getBitOffset(const uint64_t DeclTypesBlockStartOffset) const { + return BitOffset.getBitOffset() + DeclTypesBlockStartOffset; + } }; /// The number of predefined preprocessed entity IDs. @@ -362,6 +397,9 @@ namespace serialization { /// Record code for the signature that identifiers this AST file. SIGNATURE = 1, + /// Record code for the content hash of the AST block. + AST_BLOCK_HASH, + /// Record code for the diagnostic options table. DIAGNOSTIC_OPTIONS, @@ -650,7 +688,13 @@ namespace serialization { PP_CONDITIONAL_STACK = 62, /// A table of skipped ranges within the preprocessing record. - PPD_SKIPPED_RANGES = 63 + PPD_SKIPPED_RANGES = 63, + + /// Record code for the Decls to be checked for deferred diags. + DECLS_TO_CHECK_FOR_DEFERRED_DIAGS = 64, + + /// Record code for \#pragma float_control options. + FLOAT_CONTROL_PRAGMA_OPTIONS = 65, }; /// Record types used within a source manager block. @@ -1013,6 +1057,18 @@ namespace serialization { /// \brief The '_Sat unsigned long _Fract' type PREDEF_TYPE_SAT_ULONG_FRACT_ID = 69, + /// The placeholder type for OpenMP array shaping operation. + PREDEF_TYPE_OMP_ARRAY_SHAPING = 70, + + /// The placeholder type for OpenMP iterator expression. + PREDEF_TYPE_OMP_ITERATOR = 71, + + /// A placeholder type for incomplete matrix index operations. + PREDEF_TYPE_INCOMPLETE_MATRIX_IDX = 72, + + /// \brief The '__bf16' type + PREDEF_TYPE_BFLOAT16_ID = 73, + /// OpenCL image types with auto numeration #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ PREDEF_TYPE_##Id##_ID, @@ -1125,27 +1181,30 @@ namespace serialization { /// The internal '__builtin_ms_va_list' typedef. PREDEF_DECL_BUILTIN_MS_VA_LIST_ID = 11, + /// The predeclared '_GUID' struct. + PREDEF_DECL_BUILTIN_MS_GUID_ID = 12, + /// The extern "C" context. - PREDEF_DECL_EXTERN_C_CONTEXT_ID = 12, + PREDEF_DECL_EXTERN_C_CONTEXT_ID = 13, /// The internal '__make_integer_seq' template. - PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 13, + PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 14, /// The internal '__NSConstantString' typedef. - PREDEF_DECL_CF_CONSTANT_STRING_ID = 14, + PREDEF_DECL_CF_CONSTANT_STRING_ID = 15, /// The internal '__NSConstantString' tag type. - PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID = 15, + PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID = 16, /// The internal '__type_pack_element' template. - PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 16, + PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 17, }; /// 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 = 17; + const unsigned int NUM_PREDEF_DECL_IDS = 18; /// Record of updates for a declaration that was modified after /// being deserialized. This can occur within DECLTYPES_BLOCK_ID. @@ -1219,6 +1278,9 @@ namespace serialization { /// A MSPropertyDecl record. DECL_MS_PROPERTY, + /// A MSGuidDecl record. + DECL_MS_GUID, + /// A VarDecl record. DECL_VAR, @@ -1403,6 +1465,9 @@ namespace serialization { /// An LifetimeExtendedTemporaryDecl record. DECL_LIFETIME_EXTENDED_TEMPORARY, + /// A RequiresExprBodyDecl record. + DECL_REQUIRES_EXPR_BODY, + /// An ObjCTypeParamDecl record. DECL_OBJC_TYPE_PARAM, @@ -1544,6 +1609,9 @@ namespace serialization { /// An ArraySubscriptExpr record. EXPR_ARRAY_SUBSCRIPT, + /// An MatrixSubscriptExpr record. + EXPR_MATRIX_SUBSCRIPT, + /// A CallExpr record. EXPR_CALL, @@ -1628,6 +1696,9 @@ namespace serialization { /// An AtomicExpr record. EXPR_ATOMIC, + /// A RecoveryExpr record. + EXPR_RECOVERY, + // Objective-C /// An ObjCStringLiteral record. @@ -1735,9 +1806,15 @@ namespace serialization { /// A CXXConstCastExpr record. EXPR_CXX_CONST_CAST, + /// A CXXAddrspaceCastExpr record. + EXPR_CXX_ADDRSPACE_CAST, + /// A CXXFunctionalCastExpr record. EXPR_CXX_FUNCTIONAL_CAST, + /// A BuiltinBitCastExpr record. + EXPR_BUILTIN_BIT_CAST, + /// A UserDefinedLiteral record. EXPR_USER_DEFINED_LITERAL, @@ -1785,6 +1862,7 @@ namespace serialization { EXPR_MATERIALIZE_TEMPORARY, // MaterializeTemporaryExpr EXPR_CXX_FOLD, // CXXFoldExpr EXPR_CONCEPT_SPECIALIZATION,// ConceptSpecializationExpr + EXPR_REQUIRES, // RequiresExpr // CUDA EXPR_CUDA_KERNEL_CALL, // CUDAKernelCallExpr @@ -1821,6 +1899,8 @@ namespace serialization { STMT_OMP_BARRIER_DIRECTIVE, STMT_OMP_TASKWAIT_DIRECTIVE, STMT_OMP_FLUSH_DIRECTIVE, + STMT_OMP_DEPOBJ_DIRECTIVE, + STMT_OMP_SCAN_DIRECTIVE, STMT_OMP_ORDERED_DIRECTIVE, STMT_OMP_ATOMIC_DIRECTIVE, STMT_OMP_TARGET_DIRECTIVE, @@ -1856,6 +1936,8 @@ namespace serialization { STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE, STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE, EXPR_OMP_ARRAY_SECTION, + EXPR_OMP_ARRAY_SHAPING, + EXPR_OMP_ITERATOR, // ARC EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr @@ -1867,6 +1949,9 @@ namespace serialization { EXPR_COAWAIT, EXPR_COYIELD, EXPR_DEPENDENT_COAWAIT, + + // FixedPointLiteral + EXPR_FIXEDPOINT_LITERAL, }; /// The kinds of designators that can occur in a @@ -1895,6 +1980,9 @@ namespace serialization { CTOR_INITIALIZER_INDIRECT_MEMBER }; + /// Kinds of cleanup objects owned by ExprWithCleanups. + enum CleanupObjectKind { COK_Block, COK_CompoundLiteral }; + /// Describes the redeclarations of a declaration. struct LocalRedeclarationsInfo { // The ID of the first declaration |