From: Devang Patel Date: Thu, 14 Jul 2011 21:50:04 +0000 (+0000) Subject: Add dump() X-Git-Tag: android-x86-6.0-r1~944^2~71 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3dcb4ef757127d69c3748dec92787520e039bd53;p=android-x86%2Fexternal-llvm.git Add dump() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135200 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/DebugLoc.h b/include/llvm/Support/DebugLoc.h index c90915f41a1..2ee9f876c36 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 92ab4396fa1..4ff6b2cd80e 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 //===----------------------------------------------------------------------===//