Add dump()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2011-07-14 21:50:04 +00:00
parent 151bd17a8f
commit 3dcb4ef757
2 changed files with 18 additions and 0 deletions

View File

@ -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 <>

View File

@ -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
//===----------------------------------------------------------------------===//