diff options
author | Zinovy Nis <zinovy.nis@gmail.com> | 2014-05-07 09:51:22 +0000 |
---|---|---|
committer | Zinovy Nis <zinovy.nis@gmail.com> | 2014-05-07 09:51:22 +0000 |
commit | da925c0d7c7a4e3857d29efda9579c16f67098ab (patch) | |
tree | eb04fa79507bddd706c60ab4a1b2ec781a6ff7fa /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | 79dffb412840c1487396be5fa07e8cfb8ac0d07d (diff) | |
download | llvm-da925c0d7c7a4e3857d29efda9579c16f67098ab.zip llvm-da925c0d7c7a4e3857d29efda9579c16f67098ab.tar.gz llvm-da925c0d7c7a4e3857d29efda9579c16f67098ab.tar.bz2 |
[BUG][REFACTOR]
1) Fix for printing debug locations for absolute paths.
2) Location printing is moved into public method DebugLoc::print() to avoid re-inventing the wheel.
Differential Revision: http://reviews.llvm.org/D3513
llvm-svn: 208177
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index f477e91..5122165 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1453,25 +1453,7 @@ void MachineInstr::dump() const { static void printDebugLoc(DebugLoc DL, const MachineFunction *MF, raw_ostream &CommentOS) { const LLVMContext &Ctx = MF->getFunction()->getContext(); - if (!DL.isUnknown()) { // Print source line info. - DIScope Scope(DL.getScope(Ctx)); - assert((!Scope || Scope.isScope()) && - "Scope of a DebugLoc should be null or a DIScope."); - // Omit the directory, because it's likely to be long and uninteresting. - if (Scope) - CommentOS << Scope.getFilename(); - else - CommentOS << "<unknown>"; - CommentOS << ':' << DL.getLine(); - if (DL.getCol() != 0) - CommentOS << ':' << DL.getCol(); - DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(DL.getInlinedAt(Ctx)); - if (!InlinedAtDL.isUnknown()) { - CommentOS << " @[ "; - printDebugLoc(InlinedAtDL, MF, CommentOS); - CommentOS << " ]"; - } - } + DL.print(Ctx, CommentOS); } void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM, @@ -1684,7 +1666,7 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM, OS << " line no:" << DV.getLineNumber(); if (MDNode *InlinedAt = DV.getInlinedAt()) { DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(InlinedAt); - if (!InlinedAtDL.isUnknown()) { + if (!InlinedAtDL.isUnknown() && MF) { OS << " inlined @[ "; printDebugLoc(InlinedAtDL, MF, OS); OS << " ]"; |