summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/DebugLoc.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-07-14 01:14:57 +0000
committerDevang Patel <dpatel@apple.com>2011-07-14 01:14:57 +0000
commit07d61edc301316bbfb0b02dec4e36f10b82ca2d1 (patch)
treeac281472190cf96f59dbf3553e1a0f25ab199428 /llvm/lib/VMCore/DebugLoc.cpp
parentd6300d29567d5d035478c4d67f97c828e1076b8e (diff)
downloadbcm5719-llvm-07d61edc301316bbfb0b02dec4e36f10b82ca2d1.tar.gz
bcm5719-llvm-07d61edc301316bbfb0b02dec4e36f10b82ca2d1.zip
Simplify and delay extracting DebugLoc elements, scope and InlinedAt, as much as possible.
llvm-svn: 135124
Diffstat (limited to 'llvm/lib/VMCore/DebugLoc.cpp')
-rw-r--r--llvm/lib/VMCore/DebugLoc.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/DebugLoc.cpp b/llvm/lib/VMCore/DebugLoc.cpp
index 520333cbbcf..92ab4396fa1 100644
--- a/llvm/lib/VMCore/DebugLoc.cpp
+++ b/llvm/lib/VMCore/DebugLoc.cpp
@@ -128,6 +128,22 @@ DebugLoc DebugLoc::getFromDILocation(MDNode *N) {
return get(LineNo, ColNo, Scope, dyn_cast_or_null<MDNode>(N->getOperand(3)));
}
+/// getFromDILexicalBlock - Translate the DILexicalBlock into a DebugLoc.
+DebugLoc DebugLoc::getFromDILexicalBlock(MDNode *N) {
+ if (N == 0 || N->getNumOperands() < 3) return DebugLoc();
+
+ MDNode *Scope = dyn_cast_or_null<MDNode>(N->getOperand(1));
+ if (Scope == 0) return DebugLoc();
+
+ unsigned LineNo = 0, ColNo = 0;
+ if (ConstantInt *Line = dyn_cast_or_null<ConstantInt>(N->getOperand(2)))
+ LineNo = Line->getZExtValue();
+ if (ConstantInt *Col = dyn_cast_or_null<ConstantInt>(N->getOperand(3)))
+ ColNo = Col->getZExtValue();
+
+ return get(LineNo, ColNo, Scope, NULL);
+}
+
//===----------------------------------------------------------------------===//
// DenseMap specialization
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud