-
Notifications
You must be signed in to change notification settings - Fork 15.7k
[serialization] No transitive type change #92511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
e8f756e
57cfb2b
7dad94d
1263691
381d513
011abc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
| #include "clang/Serialization/SourceLocationEncoding.h" | ||
| #include "llvm/ADT/DenseMapInfo.h" | ||
| #include "llvm/Bitstream/BitCodes.h" | ||
| #include "llvm/Support/MathExtras.h" | ||
| #include <cassert> | ||
| #include <cstdint> | ||
|
|
||
|
|
@@ -59,7 +60,7 @@ const unsigned VERSION_MINOR = 1; | |
| /// | ||
| /// The ID numbers of identifiers are consecutive (in order of discovery) | ||
| /// and start at 1. 0 is reserved for NULL. | ||
| using IdentifierID = uint32_t; | ||
| using IdentifierID = uint64_t; | ||
|
|
||
| /// The number of predefined identifier IDs. | ||
| const unsigned int NUM_PREDEF_IDENT_IDS = 1; | ||
|
|
@@ -70,38 +71,53 @@ using DeclID = DeclIDBase::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 | ||
| /// 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) and the upper bits provide a | ||
| /// type index. The type index values are partitioned into two | ||
| /// qualifiers (as with QualType). | ||
| /// - the upper 29 bits provide a type index in the corresponding | ||
ilya-biryukov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// 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". Values from NUM_PREDEF_TYPE_IDs are | ||
|
||
| /// other types that have serialized representations. | ||
| using TypeID = uint32_t; | ||
| using TypeID = uint64_t; | ||
|
|
||
| /// A type index; the type ID with the qualifier bits removed. | ||
| /// Keep structure alignment 32-bit since the blob is assumed as 32-bit | ||
ilya-biryukov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// aligned. | ||
| class TypeIdx { | ||
| uint32_t ModuleFileIndex = 0; | ||
| uint32_t Idx = 0; | ||
|
|
||
| public: | ||
| TypeIdx() = default; | ||
| explicit TypeIdx(uint32_t index) : Idx(index) {} | ||
| explicit TypeIdx(uint32_t Idx) : ModuleFileIndex(0), Idx(Idx) {} | ||
|
||
|
|
||
| explicit TypeIdx(uint32_t ModuleFileIdx, uint32_t Idx) | ||
| : ModuleFileIndex(ModuleFileIdx), Idx(Idx) {} | ||
|
|
||
| uint32_t getModuleFileIndex() const { return ModuleFileIndex; } | ||
|
|
||
| uint32_t getIndex() const { return Idx; } | ||
| uint64_t getValue() const { return ((uint64_t)ModuleFileIndex << 32) | Idx; } | ||
|
|
||
| TypeID asTypeID(unsigned FastQuals) const { | ||
| if (Idx == uint32_t(-1)) | ||
| return TypeID(-1); | ||
|
|
||
| return (Idx << Qualifiers::FastWidth) | FastQuals; | ||
| unsigned Index = (Idx << Qualifiers::FastWidth) | FastQuals; | ||
| return ((uint64_t)ModuleFileIndex << 32) | Index; | ||
| } | ||
|
|
||
| static TypeIdx fromTypeID(TypeID ID) { | ||
| if (ID == TypeID(-1)) | ||
| return TypeIdx(-1); | ||
|
|
||
| return TypeIdx(ID >> Qualifiers::FastWidth); | ||
| return TypeIdx(ID >> 32, (ID & llvm::maskTrailingOnes<TypeID>(32)) >> | ||
| Qualifiers::FastWidth); | ||
| } | ||
| }; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.