diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
| -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();  }  | 

