diff options
| author | Eric Christopher <echristo@apple.com> | 2012-04-03 00:43:49 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@apple.com> | 2012-04-03 00:43:49 +0000 |
| commit | 34164196af54ffa242e0c92af1031af079709439 (patch) | |
| tree | 97f75c2f45baf1af86aa5ac41c1f62e5d63cf82b /llvm/lib/CodeGen | |
| parent | 1b8af411168bd0f0374f346b5ac55718fbe58448 (diff) | |
| download | bcm5719-llvm-34164196af54ffa242e0c92af1031af079709439.tar.gz bcm5719-llvm-34164196af54ffa242e0c92af1031af079709439.zip | |
Add a line number for the scope of the function (starting at the first
brace) so that we get more accurate line number information about the
declaration of a given function and the line where the function
first starts.
Part of rdar://11026482
llvm-svn: 153916
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 2490172bd2f..420f2cdcb2f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1193,12 +1193,19 @@ static MDNode *getScopeNode(DebugLoc DL, const LLVMContext &Ctx) { } /// getFnDebugLoc - Walk up the scope chain of given debug loc and find -/// line number info for the function. +/// line number info for the function. static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext &Ctx) { const MDNode *Scope = getScopeNode(DL, Ctx); DISubprogram SP = getDISubprogram(Scope); - if (SP.Verify()) - return DebugLoc::get(SP.getLineNumber(), 0, SP); + if (SP.Verify()) { + // Check for number of operands since the compatibility is + // cheap here. + if (Scope->getNumOperands() > 19) + return DebugLoc::get(SP.getScopeLineNumber(), 0, SP); + else + return DebugLoc::get(SP.getLineNumber(), 0, SP); + } + return DebugLoc(); } |

