DebugInfo: Assume a valid pointer for DISubprogram::getFunction()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 11 Apr 2015 18:15:48 +0000 (18:15 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 11 Apr 2015 18:15:48 +0000 (18:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234693 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/DebugInfo.cpp

index 6845827fc242f5f6d49da3e03f6c1320cda558fd..c8ae26391619b0e2895ed1abef8801824ab2abd7 100644 (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;
 }