Do not ignore InlinedAt while walking up scope chain to find subprogram node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131106 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index ed545d3..8e0ace3 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1815,6 +1815,13 @@
return DebugLoc();
}
+/// getScopeNode - Get MDNode for DebugLoc's scope.
+static MDNode *getScopeNode(DebugLoc DL, const LLVMContext &Ctx) {
+ if (MDNode *InlinedAt = DL.getInlinedAt(Ctx))
+ return getScopeNode(DebugLoc::getFromDILocation(InlinedAt), Ctx);
+ return DL.getScope(Ctx);
+}
+
/// beginFunction - Gather pre-function debug information. Assumes being
/// emitted immediately after the function entry point.
void DwarfDebug::beginFunction(const MachineFunction *MF) {
@@ -1831,7 +1838,7 @@
DebugLoc FDL = FindFirstDebugLoc(MF);
if (FDL.isUnknown()) return;
- const MDNode *Scope = FDL.getScope(MF->getFunction()->getContext());
+ const MDNode *Scope = getScopeNode(FDL, MF->getFunction()->getContext());
const MDNode *TheScope = 0;
DISubprogram SP = getDISubprogram(Scope);