diff options
| -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 //===----------------------------------------------------------------------===// |

