diff options
| author | Devang Patel <dpatel@apple.com> | 2011-07-14 21:50:04 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2011-07-14 21:50:04 +0000 |
| commit | 4db3844e8b14e597b105e3da2dded15c8e98d15e (patch) | |
| tree | 260ea606793de9558097cc2375aad211094f9b20 | |
| parent | 3ceac21d376dafbecefaec75c84ba18906cb7fc5 (diff) | |
| download | bcm5719-llvm-4db3844e8b14e597b105e3da2dded15c8e98d15e.tar.gz bcm5719-llvm-4db3844e8b14e597b105e3da2dded15c8e98d15e.zip | |
Add dump()
llvm-svn: 135200
| -rw-r--r-- | llvm/include/llvm/Support/DebugLoc.h | 2 | ||||
| -rw-r--r-- | llvm/lib/VMCore/DebugLoc.cpp | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/DebugLoc.h b/llvm/include/llvm/Support/DebugLoc.h index c90915f41a1..2ee9f876c36 100644 --- a/llvm/include/llvm/Support/DebugLoc.h +++ b/llvm/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/llvm/lib/VMCore/DebugLoc.cpp b/llvm/lib/VMCore/DebugLoc.cpp index 92ab4396fa1..4ff6b2cd80e 100644 --- a/llvm/lib/VMCore/DebugLoc.cpp +++ b/llvm/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 //===----------------------------------------------------------------------===// |

