aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-07-14 21:50:04 +0000
committerDevang Patel <dpatel@apple.com>2011-07-14 21:50:04 +0000
commit3dcb4ef757127d69c3748dec92787520e039bd53 (patch)
tree15db8cb53c0beb2ea380a6acceab7d4020172c48
parent151bd17a8fb540c84c3c297d27cedf0512ce02d3 (diff)
downloadexternal_llvm-3dcb4ef757127d69c3748dec92787520e039bd53.zip
external_llvm-3dcb4ef757127d69c3748dec92787520e039bd53.tar.gz
external_llvm-3dcb4ef757127d69c3748dec92787520e039bd53.tar.bz2
Add dump()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135200 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/DebugLoc.h2
-rw-r--r--lib/VMCore/DebugLoc.cpp16
2 files changed, 18 insertions, 0 deletions
diff --git a/include/llvm/Support/DebugLoc.h b/include/llvm/Support/DebugLoc.h
index c90915f..2ee9f87 100644
--- a/include/llvm/Support/DebugLoc.h
+++ b/include/llvm/Support/DebugLoc.h
@@ -97,6 +97,8 @@ namespace llvm {
return LineCol == DL.LineCol && ScopeIdx == DL.ScopeIdx;
}
bool operator!=(const DebugLoc &DL) const { return !(*this == DL); }
+
+ void dump(const LLVMContext &Ctx) const;
};
template <>
diff --git a/lib/VMCore/DebugLoc.cpp b/lib/VMCore/DebugLoc.cpp
index 92ab439..4ff6b2c 100644
--- a/lib/VMCore/DebugLoc.cpp
+++ b/lib/VMCore/DebugLoc.cpp
@@ -144,6 +144,22 @@ DebugLoc DebugLoc::getFromDILexicalBlock(MDNode *N) {
return get(LineNo, ColNo, Scope, NULL);
}
+void DebugLoc::dump(const LLVMContext &Ctx) const {
+#ifndef NDEBUG
+ if (!isUnknown()) {
+ dbgs() << getLine();
+ if (getCol() != 0)
+ dbgs() << ',' << getCol();
+ DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(getInlinedAt(Ctx));
+ if (!InlinedAtDL.isUnknown()) {
+ dbgs() << " @ ";
+ InlinedAtDL.dump(Ctx);
+ } else
+ dbgs() << "\n";
+ }
+#endif
+}
+
//===----------------------------------------------------------------------===//
// DenseMap specialization
//===----------------------------------------------------------------------===//