DebugInfo: Move DIDerivedType accessors to MDDerivedType, NFC

Add accessors in `MDDerivedType` to downcast `getExtraData()`, matching
those in `DIDerivedType`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234816 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-04-13 23:36:36 +00:00
parent f265d42389
commit 8ae5482d49
2 changed files with 20 additions and 10 deletions

View File

@ -315,22 +315,15 @@ public:
/// \brief Return property node, if this ivar is associated with one.
MDObjCProperty *getObjCProperty() const {
return dyn_cast_or_null<MDObjCProperty>(
cast<MDDerivedType>(get())->getExtraData());
return cast<MDDerivedType>(get())->getObjCProperty();
}
DITypeRef getClassType() const {
assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
return MDTypeRef(cast<MDDerivedType>(get())->getExtraData());
return cast<MDDerivedType>(get())->getClassType();
}
Constant *getConstant() const {
assert(getTag() == dwarf::DW_TAG_member && isStaticMember());
if (auto *C = cast_or_null<ConstantAsMetadata>(
cast<MDDerivedType>(get())->getExtraData()))
return C->getValue();
return nullptr;
return cast<MDDerivedType>(get())->getConstant();
}
};

View File

@ -746,6 +746,23 @@ public:
Metadata *getExtraData() const { return getRawExtraData(); }
Metadata *getRawExtraData() const { return getOperand(4); }
/// \brief Get casted version of extra data.
/// @{
MDTypeRef getClassType() const {
assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
return MDTypeRef(getExtraData());
}
MDObjCProperty *getObjCProperty() const {
return dyn_cast_or_null<MDObjCProperty>(getExtraData());
}
Constant *getConstant() const {
assert(getTag() == dwarf::DW_TAG_member && isStaticMember());
if (auto *C = cast_or_null<ConstantAsMetadata>(getExtraData()))
return C->getValue();
return nullptr;
}
/// @}
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == MDDerivedTypeKind;
}