-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[DebugInfo] Add num_extra_inhabitants to debug info #112590
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 1 commit
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 |
|---|---|---|
|
|
@@ -712,31 +712,38 @@ class DIType : public DIScope { | |
| DIFlags Flags; | ||
| uint64_t SizeInBits; | ||
| uint64_t OffsetInBits; | ||
| uint32_t NumExtraInhabitants; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the Swift frontend ever use the OffsetInBits? If not, we could store the extra inhabitants in there. (That would be an implementation detail of DIType and DIType would assert that you don't try to set both extra inhabitants and an offset).
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For everything else (Bitcode, Interface, assembler) leave it as it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Swift uses |
||
|
|
||
| protected: | ||
| DIType(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, | ||
| unsigned Line, uint64_t SizeInBits, uint32_t AlignInBits, | ||
| uint64_t OffsetInBits, DIFlags Flags, ArrayRef<Metadata *> Ops) | ||
| uint64_t OffsetInBits, uint32_t NumExtraInhabitants, DIFlags Flags, | ||
| ArrayRef<Metadata *> Ops) | ||
| : DIScope(C, ID, Storage, Tag, Ops) { | ||
| init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags); | ||
| init(Line, SizeInBits, AlignInBits, OffsetInBits, NumExtraInhabitants, | ||
| Flags); | ||
| } | ||
| ~DIType() = default; | ||
|
|
||
| void init(unsigned Line, uint64_t SizeInBits, uint32_t AlignInBits, | ||
| uint64_t OffsetInBits, DIFlags Flags) { | ||
| uint64_t OffsetInBits, uint32_t NumExtraInhabitants, | ||
| DIFlags Flags) { | ||
| this->Line = Line; | ||
| this->Flags = Flags; | ||
| this->SizeInBits = SizeInBits; | ||
| this->SubclassData32 = AlignInBits; | ||
| this->OffsetInBits = OffsetInBits; | ||
| this->NumExtraInhabitants = NumExtraInhabitants; | ||
| } | ||
|
|
||
| /// Change fields in place. | ||
| void mutate(unsigned Tag, unsigned Line, uint64_t SizeInBits, | ||
| uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags) { | ||
| uint32_t AlignInBits, uint64_t OffsetInBits, | ||
| uint32_t NumExtraInhabitants, DIFlags Flags) { | ||
| assert(isDistinct() && "Only distinct nodes can mutate"); | ||
| setTag(Tag); | ||
| init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags); | ||
| init(Line, SizeInBits, AlignInBits, OffsetInBits, NumExtraInhabitants, | ||
| Flags); | ||
| } | ||
|
|
||
| public: | ||
|
|
@@ -749,6 +756,7 @@ class DIType : public DIScope { | |
| uint32_t getAlignInBits() const; | ||
| uint32_t getAlignInBytes() const { return getAlignInBits() / CHAR_BIT; } | ||
| uint64_t getOffsetInBits() const { return OffsetInBits; } | ||
| uint32_t getNumExtraInhabitants() const { return NumExtraInhabitants; } | ||
| DIFlags getFlags() const { return Flags; } | ||
|
|
||
| DIScope *getScope() const { return cast_or_null<DIScope>(getRawScope()); } | ||
|
|
@@ -820,49 +828,63 @@ class DIBasicType : public DIType { | |
|
|
||
| DIBasicType(LLVMContext &C, StorageType Storage, unsigned Tag, | ||
| uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding, | ||
| DIFlags Flags, ArrayRef<Metadata *> Ops) | ||
| uint32_t NumExtraInhabitants, DIFlags Flags, | ||
| ArrayRef<Metadata *> Ops) | ||
| : DIType(C, DIBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0, | ||
| Flags, Ops), | ||
| NumExtraInhabitants, Flags, Ops), | ||
| Encoding(Encoding) {} | ||
| ~DIBasicType() = default; | ||
|
|
||
| static DIBasicType *getImpl(LLVMContext &Context, unsigned Tag, | ||
| StringRef Name, uint64_t SizeInBits, | ||
| uint32_t AlignInBits, unsigned Encoding, | ||
| DIFlags Flags, StorageType Storage, | ||
| bool ShouldCreate = true) { | ||
| uint32_t NumExtraInhabitants, DIFlags Flags, | ||
| StorageType Storage, bool ShouldCreate = true) { | ||
| return getImpl(Context, Tag, getCanonicalMDString(Context, Name), | ||
| SizeInBits, AlignInBits, Encoding, Flags, Storage, | ||
| ShouldCreate); | ||
| SizeInBits, AlignInBits, Encoding, NumExtraInhabitants, | ||
| Flags, Storage, ShouldCreate); | ||
| } | ||
| static DIBasicType *getImpl(LLVMContext &Context, unsigned Tag, | ||
| MDString *Name, uint64_t SizeInBits, | ||
| uint32_t AlignInBits, unsigned Encoding, | ||
| DIFlags Flags, StorageType Storage, | ||
| bool ShouldCreate = true); | ||
| uint32_t NumExtraInhabitants, DIFlags Flags, | ||
| StorageType Storage, bool ShouldCreate = true); | ||
|
|
||
| TempDIBasicType cloneImpl() const { | ||
| return getTemporary(getContext(), getTag(), getName(), getSizeInBits(), | ||
| getAlignInBits(), getEncoding(), getFlags()); | ||
| getAlignInBits(), getEncoding(), | ||
| getNumExtraInhabitants(), getFlags()); | ||
| } | ||
|
|
||
| public: | ||
| DEFINE_MDNODE_GET(DIBasicType, (unsigned Tag, StringRef Name), | ||
| (Tag, Name, 0, 0, 0, FlagZero)) | ||
| (Tag, Name, 0, 0, 0, 0, FlagZero)) | ||
| DEFINE_MDNODE_GET(DIBasicType, | ||
| (unsigned Tag, StringRef Name, uint64_t SizeInBits), | ||
| (Tag, Name, SizeInBits, 0, 0, FlagZero)) | ||
| (Tag, Name, SizeInBits, 0, 0, 0, FlagZero)) | ||
| DEFINE_MDNODE_GET(DIBasicType, | ||
| (unsigned Tag, MDString *Name, uint64_t SizeInBits), | ||
| (Tag, Name, SizeInBits, 0, 0, FlagZero)) | ||
| (Tag, Name, SizeInBits, 0, 0, 0, FlagZero)) | ||
| DEFINE_MDNODE_GET(DIBasicType, | ||
| (unsigned Tag, StringRef Name, uint64_t SizeInBits, | ||
| uint32_t AlignInBits, unsigned Encoding, DIFlags Flags), | ||
| (Tag, Name, SizeInBits, AlignInBits, Encoding, Flags)) | ||
| (Tag, Name, SizeInBits, AlignInBits, Encoding, 0, Flags)) | ||
| DEFINE_MDNODE_GET(DIBasicType, | ||
| (unsigned Tag, MDString *Name, uint64_t SizeInBits, | ||
| uint32_t AlignInBits, unsigned Encoding, DIFlags Flags), | ||
| (Tag, Name, SizeInBits, AlignInBits, Encoding, Flags)) | ||
| (Tag, Name, SizeInBits, AlignInBits, Encoding, 0, Flags)) | ||
| DEFINE_MDNODE_GET(DIBasicType, | ||
| (unsigned Tag, StringRef Name, uint64_t SizeInBits, | ||
| uint32_t AlignInBits, unsigned Encoding, | ||
| uint32_t NumExtraInhabitants, DIFlags Flags), | ||
| (Tag, Name, SizeInBits, AlignInBits, Encoding, | ||
| NumExtraInhabitants, Flags)) | ||
| DEFINE_MDNODE_GET(DIBasicType, | ||
| (unsigned Tag, MDString *Name, uint64_t SizeInBits, | ||
| uint32_t AlignInBits, unsigned Encoding, | ||
| uint32_t NumExtraInhabitants, DIFlags Flags), | ||
| (Tag, Name, SizeInBits, AlignInBits, Encoding, | ||
| NumExtraInhabitants, Flags)) | ||
|
|
||
| TempDIBasicType clone() const { return cloneImpl(); } | ||
|
|
||
|
|
@@ -890,7 +912,7 @@ class DIStringType : public DIType { | |
| uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding, | ||
| ArrayRef<Metadata *> Ops) | ||
| : DIType(C, DIStringTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0, | ||
| FlagZero, Ops), | ||
| 0, FlagZero, Ops), | ||
| Encoding(Encoding) {} | ||
| ~DIStringType() = default; | ||
|
|
||
|
|
@@ -1016,7 +1038,7 @@ class DIDerivedType : public DIType { | |
| std::optional<PtrAuthData> PtrAuthData, DIFlags Flags, | ||
| ArrayRef<Metadata *> Ops) | ||
| : DIType(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits, | ||
| AlignInBits, OffsetInBits, Flags, Ops), | ||
| AlignInBits, OffsetInBits, 0, Flags, Ops), | ||
| DWARFAddressSpace(DWARFAddressSpace) { | ||
| if (PtrAuthData) | ||
| SubclassData32 = PtrAuthData->RawData; | ||
|
|
@@ -1157,39 +1179,43 @@ class DICompositeType : public DIType { | |
|
|
||
| DICompositeType(LLVMContext &C, StorageType Storage, unsigned Tag, | ||
| unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits, | ||
| uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, | ||
| uint32_t AlignInBits, uint64_t OffsetInBits, | ||
| uint32_t NumExtraInhabitants, DIFlags Flags, | ||
| ArrayRef<Metadata *> Ops) | ||
| : DIType(C, DICompositeTypeKind, Storage, Tag, Line, SizeInBits, | ||
| AlignInBits, OffsetInBits, Flags, Ops), | ||
| AlignInBits, OffsetInBits, NumExtraInhabitants, Flags, Ops), | ||
| RuntimeLang(RuntimeLang) {} | ||
| ~DICompositeType() = default; | ||
|
|
||
| /// Change fields in place. | ||
| void mutate(unsigned Tag, unsigned Line, unsigned RuntimeLang, | ||
| uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, | ||
| DIFlags Flags) { | ||
| uint32_t NumExtraInhabitants, DIFlags Flags) { | ||
| assert(isDistinct() && "Only distinct nodes can mutate"); | ||
| assert(getRawIdentifier() && "Only ODR-uniqued nodes should mutate"); | ||
| this->RuntimeLang = RuntimeLang; | ||
| DIType::mutate(Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags); | ||
| DIType::mutate(Tag, Line, SizeInBits, AlignInBits, OffsetInBits, | ||
| NumExtraInhabitants, Flags); | ||
| } | ||
|
|
||
| static DICompositeType * | ||
| getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, Metadata *File, | ||
| unsigned Line, DIScope *Scope, DIType *BaseType, uint64_t SizeInBits, | ||
| uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, | ||
| DINodeArray Elements, unsigned RuntimeLang, DIType *VTableHolder, | ||
| uint32_t AlignInBits, uint64_t OffsetInBits, | ||
| uint32_t NumExtraInhabitants, DIFlags Flags, DINodeArray Elements, | ||
| unsigned RuntimeLang, DIType *VTableHolder, | ||
| DITemplateParameterArray TemplateParams, StringRef Identifier, | ||
| DIDerivedType *Discriminator, Metadata *DataLocation, | ||
| Metadata *Associated, Metadata *Allocated, Metadata *Rank, | ||
| DINodeArray Annotations, StorageType Storage, | ||
| bool ShouldCreate = true) { | ||
| return getImpl( | ||
| Context, Tag, getCanonicalMDString(Context, Name), File, Line, Scope, | ||
| BaseType, SizeInBits, AlignInBits, OffsetInBits, Flags, Elements.get(), | ||
| RuntimeLang, VTableHolder, TemplateParams.get(), | ||
| getCanonicalMDString(Context, Identifier), Discriminator, DataLocation, | ||
| Associated, Allocated, Rank, Annotations.get(), Storage, ShouldCreate); | ||
| return getImpl(Context, Tag, getCanonicalMDString(Context, Name), File, | ||
| Line, Scope, BaseType, SizeInBits, AlignInBits, OffsetInBits, | ||
| Flags, Elements.get(), RuntimeLang, VTableHolder, | ||
| TemplateParams.get(), | ||
| getCanonicalMDString(Context, Identifier), Discriminator, | ||
| DataLocation, Associated, Allocated, Rank, Annotations.get(), | ||
| NumExtraInhabitants, Storage, ShouldCreate); | ||
| } | ||
| static DICompositeType * | ||
| getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File, | ||
|
|
@@ -1199,7 +1225,8 @@ class DICompositeType : public DIType { | |
| Metadata *VTableHolder, Metadata *TemplateParams, | ||
| MDString *Identifier, Metadata *Discriminator, Metadata *DataLocation, | ||
| Metadata *Associated, Metadata *Allocated, Metadata *Rank, | ||
| Metadata *Annotations, StorageType Storage, bool ShouldCreate = true); | ||
| Metadata *Annotations, uint32_t NumExtraInhabitants, | ||
| StorageType Storage, bool ShouldCreate = true); | ||
|
|
||
| TempDICompositeType cloneImpl() const { | ||
| return getTemporary( | ||
|
|
@@ -1208,7 +1235,7 @@ class DICompositeType : public DIType { | |
| getFlags(), getElements(), getRuntimeLang(), getVTableHolder(), | ||
| getTemplateParams(), getIdentifier(), getDiscriminator(), | ||
| getRawDataLocation(), getRawAssociated(), getRawAllocated(), | ||
| getRawRank(), getAnnotations()); | ||
| getRawRank(), getAnnotations(), getNumExtraInhabitants()); | ||
| } | ||
|
|
||
| public: | ||
|
|
@@ -1222,11 +1249,11 @@ class DICompositeType : public DIType { | |
| StringRef Identifier = "", DIDerivedType *Discriminator = nullptr, | ||
| Metadata *DataLocation = nullptr, Metadata *Associated = nullptr, | ||
| Metadata *Allocated = nullptr, Metadata *Rank = nullptr, | ||
| DINodeArray Annotations = nullptr), | ||
| DINodeArray Annotations = nullptr, uint32_t NumExtraInhabitants = 0), | ||
| (Tag, Name, File, Line, Scope, BaseType, SizeInBits, AlignInBits, | ||
| OffsetInBits, Flags, Elements, RuntimeLang, VTableHolder, TemplateParams, | ||
| Identifier, Discriminator, DataLocation, Associated, Allocated, Rank, | ||
| Annotations)) | ||
| OffsetInBits, NumExtraInhabitants, Flags, Elements, RuntimeLang, | ||
| VTableHolder, TemplateParams, Identifier, Discriminator, DataLocation, | ||
| Associated, Allocated, Rank, Annotations)) | ||
| DEFINE_MDNODE_GET( | ||
| DICompositeType, | ||
| (unsigned Tag, MDString *Name, Metadata *File, unsigned Line, | ||
|
|
@@ -1236,11 +1263,12 @@ class DICompositeType : public DIType { | |
| Metadata *TemplateParams = nullptr, MDString *Identifier = nullptr, | ||
| Metadata *Discriminator = nullptr, Metadata *DataLocation = nullptr, | ||
| Metadata *Associated = nullptr, Metadata *Allocated = nullptr, | ||
| Metadata *Rank = nullptr, Metadata *Annotations = nullptr), | ||
| Metadata *Rank = nullptr, Metadata *Annotations = nullptr, | ||
| uint32_t NumExtraInhabitants = 0), | ||
| (Tag, Name, File, Line, Scope, BaseType, SizeInBits, AlignInBits, | ||
| OffsetInBits, Flags, Elements, RuntimeLang, VTableHolder, TemplateParams, | ||
| Identifier, Discriminator, DataLocation, Associated, Allocated, Rank, | ||
| Annotations)) | ||
| Annotations, NumExtraInhabitants)) | ||
|
|
||
| TempDICompositeType clone() const { return cloneImpl(); } | ||
|
|
||
|
|
@@ -1255,8 +1283,8 @@ class DICompositeType : public DIType { | |
| getODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag, | ||
| MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, | ||
| Metadata *BaseType, uint64_t SizeInBits, uint32_t AlignInBits, | ||
| uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, | ||
| unsigned RuntimeLang, Metadata *VTableHolder, | ||
| uint64_t OffsetInBits, uint32_t NumExtraInhabitants, DIFlags Flags, | ||
| Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, | ||
| Metadata *TemplateParams, Metadata *Discriminator, | ||
| Metadata *DataLocation, Metadata *Associated, Metadata *Allocated, | ||
| Metadata *Rank, Metadata *Annotations); | ||
|
|
@@ -1272,15 +1300,14 @@ class DICompositeType : public DIType { | |
| /// | ||
| /// If not \a LLVMContext::isODRUniquingDebugTypes(), this function returns | ||
| /// nullptr. | ||
| static DICompositeType * | ||
| buildODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag, | ||
| MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, | ||
| Metadata *BaseType, uint64_t SizeInBits, uint32_t AlignInBits, | ||
| uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, | ||
| unsigned RuntimeLang, Metadata *VTableHolder, | ||
| Metadata *TemplateParams, Metadata *Discriminator, | ||
| Metadata *DataLocation, Metadata *Associated, | ||
| Metadata *Allocated, Metadata *Rank, Metadata *Annotations); | ||
| static DICompositeType *buildODRType( | ||
| LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name, | ||
| Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, | ||
| uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, | ||
| uint32_t NumExtraInhabitants, DIFlags Flags, Metadata *Elements, | ||
| unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams, | ||
| Metadata *Discriminator, Metadata *DataLocation, Metadata *Associated, | ||
| Metadata *Allocated, Metadata *Rank, Metadata *Annotations); | ||
|
|
||
| DIType *getBaseType() const { return cast_or_null<DIType>(getRawBaseType()); } | ||
| DINodeArray getElements() const { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.