[llvm] r327681 - Use standard `print(dbgs())` pattern to implement DebugLoc::dump

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 15 15:51:56 PDT 2018


Author: silvas
Date: Thu Mar 15 15:51:55 2018
New Revision: 327681

URL: http://llvm.org/viewvc/llvm-project?rev=327681&view=rev
Log:
Use standard `print(dbgs())` pattern to implement DebugLoc::dump

The open-coded implementation had a bug. It didn't print filenames.

Modified:
    llvm/trunk/lib/IR/DebugLoc.cpp

Modified: llvm/trunk/lib/IR/DebugLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugLoc.cpp?rev=327681&r1=327680&r2=327681&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugLoc.cpp (original)
+++ llvm/trunk/lib/IR/DebugLoc.cpp Thu Mar 15 15:51:55 2018
@@ -99,19 +99,7 @@ DebugLoc DebugLoc::appendInlinedAt(Debug
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void DebugLoc::dump() const {
-  if (!Loc)
-    return;
-
-  dbgs() << getLine();
-  if (getCol() != 0)
-    dbgs() << ',' << getCol();
-  if (DebugLoc InlinedAtDL = DebugLoc(getInlinedAt())) {
-    dbgs() << " @ ";
-    InlinedAtDL.dump();
-  } else
-    dbgs() << "\n";
-}
+LLVM_DUMP_METHOD void DebugLoc::dump() const { print(dbgs()); }
 #endif
 
 void DebugLoc::print(raw_ostream &OS) const {




More information about the llvm-commits mailing list