From: Duncan P. N. Exon Smith Date: Mon, 13 Apr 2015 23:36:36 +0000 (+0000) Subject: DebugInfo: Move DIDerivedType accessors to MDDerivedType, NFC X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=8ae5482d490af742ff34eb897d2d1752814bcb9a;p=oota-llvm.git 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 --- diff --git a/include/llvm/IR/DebugInfo.h b/include/llvm/IR/DebugInfo.h index 1f515324757..dfeaee8b303 100644 --- a/include/llvm/IR/DebugInfo.h +++ b/include/llvm/IR/DebugInfo.h @@ -315,22 +315,15 @@ public: /// \brief Return property node, if this ivar is associated with one. MDObjCProperty *getObjCProperty() const { - return dyn_cast_or_null( - cast(get())->getExtraData()); + return cast(get())->getObjCProperty(); } DITypeRef getClassType() const { - assert(getTag() == dwarf::DW_TAG_ptr_to_member_type); - return MDTypeRef(cast(get())->getExtraData()); + return cast(get())->getClassType(); } Constant *getConstant() const { - assert(getTag() == dwarf::DW_TAG_member && isStaticMember()); - if (auto *C = cast_or_null( - cast(get())->getExtraData())) - return C->getValue(); - - return nullptr; + return cast(get())->getConstant(); } }; diff --git a/include/llvm/IR/DebugInfoMetadata.h b/include/llvm/IR/DebugInfoMetadata.h index 3d2ae12f9be..f7b092f4e6e 100644 --- a/include/llvm/IR/DebugInfoMetadata.h +++ b/include/llvm/IR/DebugInfoMetadata.h @@ -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(getExtraData()); + } + Constant *getConstant() const { + assert(getTag() == dwarf::DW_TAG_member && isStaticMember()); + if (auto *C = cast_or_null(getExtraData())) + return C->getValue(); + return nullptr; + } + /// @} + static bool classof(const Metadata *MD) { return MD->getMetadataID() == MDDerivedTypeKind; }