Do not ignore InlinedAt while walking up scope chain to find subprogram node.
authorDevang Patel <dpatel@apple.com>
Mon, 9 May 2011 22:14:49 +0000 (22:14 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 9 May 2011 22:14:49 +0000 (22:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131106 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index ed545d3d16d1a8e48ae3b366c4e20480c72f3dd3..8e0ace3abb4691bc4796c170b22eada689b52ff0 100644 (file)
@@ -1815,6 +1815,13 @@ static DebugLoc FindFirstDebugLoc(const MachineFunction *MF) {
   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 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
   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);