mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-04 17:47:58 +00:00
DI: Remove DIDerivedTypeBase
Remove an unnecessary (and confusing) common subclass for `DIDerivedType` and `DICompositeType`. These classes aren't really related, and even in the old debug info hierarchy, there was a long-standing FIXME to separate them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243152 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b2c91c5ecd
commit
7b464ae8b9
@ -647,44 +647,20 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Base class for DIDerivedType and DICompositeType.
|
||||
///
|
||||
/// TODO: Delete; they're not really related.
|
||||
class DIDerivedTypeBase : public DIType {
|
||||
protected:
|
||||
DIDerivedTypeBase(LLVMContext &C, unsigned ID, StorageType Storage,
|
||||
unsigned Tag, unsigned Line, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
|
||||
ArrayRef<Metadata *> Ops)
|
||||
: DIType(C, ID, Storage, Tag, Line, SizeInBits, AlignInBits, OffsetInBits,
|
||||
Flags, Ops) {}
|
||||
~DIDerivedTypeBase() = default;
|
||||
|
||||
public:
|
||||
DITypeRef getBaseType() const { return DITypeRef(getRawBaseType()); }
|
||||
Metadata *getRawBaseType() const { return getOperand(3); }
|
||||
|
||||
static bool classof(const Metadata *MD) {
|
||||
return MD->getMetadataID() == DIDerivedTypeKind ||
|
||||
MD->getMetadataID() == DICompositeTypeKind ||
|
||||
MD->getMetadataID() == DISubroutineTypeKind;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Derived types.
|
||||
///
|
||||
/// This includes qualified types, pointers, references, friends, typedefs, and
|
||||
/// class members.
|
||||
///
|
||||
/// TODO: Split out members (inheritance, fields, methods, etc.).
|
||||
class DIDerivedType : public DIDerivedTypeBase {
|
||||
class DIDerivedType : public DIType {
|
||||
friend class LLVMContextImpl;
|
||||
friend class MDNode;
|
||||
|
||||
DIDerivedType(LLVMContext &C, StorageType Storage, unsigned Tag,
|
||||
unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags, ArrayRef<Metadata *> Ops)
|
||||
: DIDerivedTypeBase(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits,
|
||||
: DIType(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits,
|
||||
AlignInBits, OffsetInBits, Flags, Ops) {}
|
||||
~DIDerivedType() = default;
|
||||
|
||||
@ -733,6 +709,10 @@ public:
|
||||
|
||||
TempDIDerivedType clone() const { return cloneImpl(); }
|
||||
|
||||
//// Get the base type this is derived from.
|
||||
DITypeRef getBaseType() const { return DITypeRef(getRawBaseType()); }
|
||||
Metadata *getRawBaseType() const { return getOperand(3); }
|
||||
|
||||
/// \brief Get extra data associated with this derived type.
|
||||
///
|
||||
/// Class type for pointer-to-members, objective-c property node for ivars,
|
||||
@ -768,7 +748,7 @@ public:
|
||||
/// \brief Base class for DICompositeType and DISubroutineType.
|
||||
///
|
||||
/// TODO: Delete; they're not really related.
|
||||
class DICompositeTypeBase : public DIDerivedTypeBase {
|
||||
class DICompositeTypeBase : public DIType {
|
||||
unsigned RuntimeLang;
|
||||
|
||||
protected:
|
||||
@ -777,12 +757,15 @@ protected:
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
ArrayRef<Metadata *> Ops)
|
||||
: DIDerivedTypeBase(C, ID, Storage, Tag, Line, SizeInBits, AlignInBits,
|
||||
OffsetInBits, Flags, Ops),
|
||||
: DIType(C, ID, Storage, Tag, Line, SizeInBits, AlignInBits, OffsetInBits,
|
||||
Flags, Ops),
|
||||
RuntimeLang(RuntimeLang) {}
|
||||
~DICompositeTypeBase() = default;
|
||||
|
||||
public:
|
||||
//// Get the base type this is derived from, if any.
|
||||
DITypeRef getBaseType() const { return DITypeRef(getRawBaseType()); }
|
||||
|
||||
/// \brief Get the elements of the composite type.
|
||||
///
|
||||
/// \note Calling this is only valid for \a DICompositeType. This assertion
|
||||
@ -799,6 +782,7 @@ public:
|
||||
StringRef getIdentifier() const { return getStringOperand(7); }
|
||||
unsigned getRuntimeLang() const { return RuntimeLang; }
|
||||
|
||||
Metadata *getRawBaseType() const { return getOperand(3); }
|
||||
Metadata *getRawElements() const { return getOperand(4); }
|
||||
Metadata *getRawVTableHolder() const { return getOperand(5); }
|
||||
Metadata *getRawTemplateParams() const { return getOperand(6); }
|
||||
|
@ -69,7 +69,6 @@ HANDLE_SPECIALIZED_MDNODE_LEAF(DIEnumerator)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DIScope)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DIType)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIBasicType)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DIDerivedTypeBase)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIDerivedType)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DICompositeTypeBase)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DICompositeType)
|
||||
|
@ -302,7 +302,6 @@ private:
|
||||
#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) void visit##CLASS(const CLASS &N);
|
||||
#include "llvm/IR/Metadata.def"
|
||||
void visitDIScope(const DIScope &N);
|
||||
void visitDIDerivedTypeBase(const DIDerivedTypeBase &N);
|
||||
void visitDIVariable(const DIVariable &N);
|
||||
void visitDILexicalBlockBase(const DILexicalBlockBase &N);
|
||||
void visitDITemplateParameter(const DITemplateParameter &N);
|
||||
@ -779,19 +778,10 @@ void Verifier::visitDIBasicType(const DIBasicType &N) {
|
||||
"invalid tag", &N);
|
||||
}
|
||||
|
||||
void Verifier::visitDIDerivedTypeBase(const DIDerivedTypeBase &N) {
|
||||
void Verifier::visitDIDerivedType(const DIDerivedType &N) {
|
||||
// Common scope checks.
|
||||
visitDIScope(N);
|
||||
|
||||
Assert(isScopeRef(N, N.getScope()), "invalid scope", &N, N.getScope());
|
||||
Assert(isTypeRef(N, N.getBaseType()), "invalid base type", &N,
|
||||
N.getBaseType());
|
||||
}
|
||||
|
||||
void Verifier::visitDIDerivedType(const DIDerivedType &N) {
|
||||
// Common derived type checks.
|
||||
visitDIDerivedTypeBase(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_typedef ||
|
||||
N.getTag() == dwarf::DW_TAG_pointer_type ||
|
||||
N.getTag() == dwarf::DW_TAG_ptr_to_member_type ||
|
||||
@ -808,6 +798,10 @@ void Verifier::visitDIDerivedType(const DIDerivedType &N) {
|
||||
Assert(isTypeRef(N, N.getExtraData()), "invalid pointer to member type", &N,
|
||||
N.getExtraData());
|
||||
}
|
||||
|
||||
Assert(isScopeRef(N, N.getScope()), "invalid scope", &N, N.getScope());
|
||||
Assert(isTypeRef(N, N.getBaseType()), "invalid base type", &N,
|
||||
N.getBaseType());
|
||||
}
|
||||
|
||||
static bool hasConflictingReferenceFlags(unsigned Flags) {
|
||||
@ -825,8 +819,8 @@ void Verifier::visitTemplateParams(const MDNode &N, const Metadata &RawParams) {
|
||||
}
|
||||
|
||||
void Verifier::visitDICompositeType(const DICompositeType &N) {
|
||||
// Common derived type checks.
|
||||
visitDIDerivedTypeBase(N);
|
||||
// Common scope checks.
|
||||
visitDIScope(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_array_type ||
|
||||
N.getTag() == dwarf::DW_TAG_structure_type ||
|
||||
@ -835,6 +829,10 @@ void Verifier::visitDICompositeType(const DICompositeType &N) {
|
||||
N.getTag() == dwarf::DW_TAG_class_type,
|
||||
"invalid tag", &N);
|
||||
|
||||
Assert(isScopeRef(N, N.getScope()), "invalid scope", &N, N.getScope());
|
||||
Assert(isTypeRef(N, N.getBaseType()), "invalid base type", &N,
|
||||
N.getBaseType());
|
||||
|
||||
Assert(!N.getRawElements() || isa<MDTuple>(N.getRawElements()),
|
||||
"invalid composite elements", &N, N.getRawElements());
|
||||
Assert(isTypeRef(N, N.getRawVTableHolder()), "invalid vtable holder", &N,
|
||||
|
Loading…
x
Reference in New Issue
Block a user