[llvm-commits] [llvm] r135200 - in /llvm/trunk: include/llvm/Support/DebugLoc.h lib/VMCore/DebugLoc.cpp

Devang Patel dpatel at apple.com
Thu Jul 14 14:50:04 PDT 2011


Author: dpatel
Date: Thu Jul 14 16:50:04 2011
New Revision: 135200

URL: http://llvm.org/viewvc/llvm-project?rev=135200&view=rev
Log:
Add dump()

Modified:
    llvm/trunk/include/llvm/Support/DebugLoc.h
    llvm/trunk/lib/VMCore/DebugLoc.cpp

Modified: llvm/trunk/include/llvm/Support/DebugLoc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DebugLoc.h?rev=135200&r1=135199&r2=135200&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/DebugLoc.h (original)
+++ llvm/trunk/include/llvm/Support/DebugLoc.h Thu Jul 14 16:50:04 2011
@@ -97,6 +97,8 @@
       return LineCol == DL.LineCol && ScopeIdx == DL.ScopeIdx;
     }
     bool operator!=(const DebugLoc &DL) const { return !(*this == DL); }
+
+    void dump(const LLVMContext &Ctx) const;
   };
 
   template <>

Modified: llvm/trunk/lib/VMCore/DebugLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/DebugLoc.cpp?rev=135200&r1=135199&r2=135200&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/DebugLoc.cpp (original)
+++ llvm/trunk/lib/VMCore/DebugLoc.cpp Thu Jul 14 16:50:04 2011
@@ -144,6 +144,22 @@
   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
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list