From: Duncan P. N. Exon Smith Date: Mon, 13 Apr 2015 23:13:18 +0000 (+0000) Subject: DebugInfo: Make DIDerivedType accessors more strict X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=7ca9328e168cbfa41b0c42eee594c856943b8ff9;p=oota-llvm.git DebugInfo: Make DIDerivedType accessors more strict These accessors in `DIDerivedType` should only be called when `DbgNode` really is a `MDDerivedType`, not just a `MDDerivedTypeBase`. Assume that it is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234812 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/DebugInfo.h b/include/llvm/IR/DebugInfo.h index ab9c853a476..1f515324757 100644 --- a/include/llvm/IR/DebugInfo.h +++ b/include/llvm/IR/DebugInfo.h @@ -314,24 +314,21 @@ public: DITypeRef getTypeDerivedFrom() const { return get()->getBaseType(); } /// \brief Return property node, if this ivar is associated with one. - MDNode *getObjCProperty() const { - if (auto *N = dyn_cast(get())) - return dyn_cast_or_null(N->getExtraData()); - return nullptr; + MDObjCProperty *getObjCProperty() const { + return dyn_cast_or_null( + cast(get())->getExtraData()); } DITypeRef getClassType() const { assert(getTag() == dwarf::DW_TAG_ptr_to_member_type); - if (auto *N = dyn_cast(get())) - return MDTypeRef(N->getExtraData()); - return MDTypeRef(); + return MDTypeRef(cast(get())->getExtraData()); } Constant *getConstant() const { - assert((getTag() == dwarf::DW_TAG_member) && isStaticMember()); - if (auto *N = dyn_cast(get())) - if (auto *C = dyn_cast_or_null(N->getExtraData())) - return C->getValue(); + assert(getTag() == dwarf::DW_TAG_member && isStaticMember()); + if (auto *C = cast_or_null( + cast(get())->getExtraData())) + return C->getValue(); return nullptr; }