From: Devang Patel Date: Mon, 9 May 2011 22:14:49 +0000 (+0000) Subject: Do not ignore InlinedAt while walking up scope chain to find subprogram node. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a3f486762f943136da84bfe590e7153fd434c7ad;p=oota-llvm.git 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 ed545d3d16d..8e0ace3abb4 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -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);