DebugInfo: Assume a valid pointer for DISubprogram::getFunction()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234693 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-04-11 18:15:48 +00:00
parent 38ebdeea7a
commit 7ba137f94b

View File

@ -90,9 +90,8 @@ bool DIVariable::isInlinedFnArgument(const Function *CurFn) {
}
Function *DISubprogram::getFunction() const {
if (auto *N = get())
if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(N->getFunction()))
return dyn_cast<Function>(C->getValue());
if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(get()->getFunction()))
return dyn_cast<Function>(C->getValue());
return nullptr;
}