[Lldb-commits] [lldb] r319048 - Remove custom TimePoint-formatting code

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 27 09:06:42 PST 2017


Author: labath
Date: Mon Nov 27 09:06:42 2017
New Revision: 319048

URL: http://llvm.org/viewvc/llvm-project?rev=319048&view=rev
Log:
Remove custom TimePoint-formatting code

This was a temporary thing, until llvm has proper support for formatting
time. That time has come, so we can remove the relevant code. There
should be no change in the format of the time.

Modified:
    lldb/trunk/source/Commands/CommandObjectTarget.cpp

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=319048&r1=319047&r2=319048&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Mon Nov 27 09:06:42 2017
@@ -52,6 +52,7 @@
 #include "lldb/Utility/Timer.h"
 
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormatAdapters.h"
 
 // C Includes
 // C++ Includes
@@ -135,25 +136,6 @@ static uint32_t DumpTargetList(TargetLis
   return num_targets;
 }
 
-// TODO: Remove this once llvm can pretty-print time points
-static void DumpTimePoint(llvm::sys::TimePoint<> tp, Stream &s, uint32_t width) {
-#ifndef LLDB_DISABLE_POSIX
-  char time_buf[32];
-  time_t time = llvm::sys::toTimeT(tp);
-  char *time_cstr = ::ctime_r(&time, time_buf);
-  if (time_cstr) {
-    char *newline = ::strpbrk(time_cstr, "\n\r");
-    if (newline)
-      *newline = '\0';
-    if (width > 0)
-      s.Printf("%-*s", width, time_cstr);
-    else
-      s.PutCString(time_cstr);
-  } else if (width > 0)
-    s.Printf("%-*s", width, "");
-#endif
-}
-
 #pragma mark CommandObjectTargetCreate
 
 //-------------------------------------------------------------------------
@@ -3176,7 +3158,8 @@ protected:
       } break;
 
       case 'm':
-        DumpTimePoint(module->GetModificationTime(), strm, width);
+        strm.Format("{0:%c}", llvm::fmt_align(module->GetModificationTime(),
+                                              llvm::AlignStyle::Left, width));
         break;
 
       case 'p':




More information about the lldb-commits mailing list