summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-13 23:13:18 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-13 23:13:18 +0000
commit56b1d0048456f18cbc51ebe6040d6687eb1096a1 (patch)
tree1007af2e483e0419b463597e883741d6958b3afa /llvm
parentb2d227693ff492efacaace465f8d4fe0f1141e3e (diff)
downloadbcm5719-llvm-56b1d0048456f18cbc51ebe6040d6687eb1096a1.tar.gz
bcm5719-llvm-56b1d0048456f18cbc51ebe6040d6687eb1096a1.zip
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. llvm-svn: 234812
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/IR/DebugInfo.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h
index ab9c853a476..1f515324757 100644
--- a/llvm/include/llvm/IR/DebugInfo.h
+++ b/llvm/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<MDDerivedType>(get()))
- return dyn_cast_or_null<MDNode>(N->getExtraData());
- return nullptr;
+ MDObjCProperty *getObjCProperty() const {
+ return dyn_cast_or_null<MDObjCProperty>(
+ cast<MDDerivedType>(get())->getExtraData());
}
DITypeRef getClassType() const {
assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
- if (auto *N = dyn_cast<MDDerivedType>(get()))
- return MDTypeRef(N->getExtraData());
- return MDTypeRef();
+ return MDTypeRef(cast<MDDerivedType>(get())->getExtraData());
}
Constant *getConstant() const {
- assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
- if (auto *N = dyn_cast<MDDerivedType>(get()))
- if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(N->getExtraData()))
- return C->getValue();
+ assert(getTag() == dwarf::DW_TAG_member && isStaticMember());
+ if (auto *C = cast_or_null<ConstantAsMetadata>(
+ cast<MDDerivedType>(get())->getExtraData()))
+ return C->getValue();
return nullptr;
}
OpenPOWER on IntegriCloud