summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DebugLoc.cpp
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2014-01-30 01:39:17 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2014-01-30 01:39:17 +0000
commitf166f6c8d0393eeb10c5531ddf3e1bdcc9aa1f92 (patch)
tree2026e16ddc831f0077907af71def06280c1e18e4 /llvm/lib/IR/DebugLoc.cpp
parent3aa05e40cfa7256e367bb46437ce5488842298f5 (diff)
downloadbcm5719-llvm-f166f6c8d0393eeb10c5531ddf3e1bdcc9aa1f92.tar.gz
bcm5719-llvm-f166f6c8d0393eeb10c5531ddf3e1bdcc9aa1f92.zip
Reland r200340 - 'Add line table debug info to COFF files when using a win32 triple'
This incorporates a couple of fixes reviewed at http://llvm-reviews.chandlerc.com/D2651 llvm-svn: 200440
Diffstat (limited to 'llvm/lib/IR/DebugLoc.cpp')
-rw-r--r--llvm/lib/IR/DebugLoc.cpp20
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) {
OpenPOWER on IntegriCloud