diff options
author | Timur Iskhodzhanov <timurrrr@google.com> | 2014-01-28 21:33:27 +0000 |
---|---|---|
committer | Timur Iskhodzhanov <timurrrr@google.com> | 2014-01-28 21:33:27 +0000 |
commit | 2c659648b38c66f97bcfe5ae642c685f6eb4d2b7 (patch) | |
tree | 973cddc4966ccac5db76a5cd37c51b9dc72413ea /llvm/lib/IR/DebugLoc.cpp | |
parent | 33fa96244135d64e13d964401f3089c251a4aa0b (diff) | |
download | bcm5719-llvm-2c659648b38c66f97bcfe5ae642c685f6eb4d2b7.tar.gz bcm5719-llvm-2c659648b38c66f97bcfe5ae642c685f6eb4d2b7.zip |
Add line table debug info to COFF files when using a win32 triple.
Reviewed at http://llvm-reviews.chandlerc.com/D2232
llvm-svn: 200340
Diffstat (limited to 'llvm/lib/IR/DebugLoc.cpp')
-rw-r--r-- | llvm/lib/IR/DebugLoc.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugLoc.cpp b/llvm/lib/IR/DebugLoc.cpp index c57b5a30530..fcb6f4194ea 100644 --- a/llvm/lib/IR/DebugLoc.cpp +++ b/llvm/lib/IR/DebugLoc.cpp @@ -70,6 +70,26 @@ void DebugLoc::getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA, IA = Ctx.pImpl->ScopeInlinedAtRecords[-ScopeIdx-1].second.get(); } +MDNode *DebugLoc::getScopeNode(const LLVMContext &Ctx) const { + if (MDNode *InlinedAt = getInlinedAt(Ctx)) + return DebugLoc::getFromDILocation(InlinedAt).getScopeNode(Ctx); + return getScope(Ctx); +} + +DebugLoc DebugLoc::getFnDebugLoc(const LLVMContext &Ctx) { + const MDNode *Scope = getScopeNode(Ctx); + DISubprogram SP = getDISubprogram(Scope); + if (SP.isSubprogram()) { + // Check for number of operands since the compatibility is + // cheap here. FIXME: Name the magic constant. + if (SP->getNumOperands() > 19) + return DebugLoc::get(SP.getScopeLineNumber(), 0, SP); + else + return DebugLoc::get(SP.getLineNumber(), 0, SP); + } + + return DebugLoc(); +} DebugLoc DebugLoc::get(unsigned Line, unsigned Col, MDNode *Scope, MDNode *InlinedAt) { |