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
This commit is contained in:
Devang Patel 2011-05-09 22:14:49 +00:00
parent f5bf3cf7e2
commit a3f486762f

View 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);