[Lldb-commits] [lldb] 03e4070 - [lldb] Silence warning when building with Clang ToT

Alexandre Ganea via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 25 06:34:38 PST 2024


Author: Alexandre Ganea
Date: 2024-01-25T09:34:18-05:00
New Revision: 03e4070ce1f834eb426aa8f8622838c40ff5c710

URL: https://github.com/llvm/llvm-project/commit/03e4070ce1f834eb426aa8f8622838c40ff5c710
DIFF: https://github.com/llvm/llvm-project/commit/03e4070ce1f834eb426aa8f8622838c40ff5c710.diff

LOG: [lldb] Silence warning when building with Clang ToT

This fixes:
```
[6331/7452] Building CXX object tools\lldb\source\Plugins\Language\CPlusPlus\CMakeFiles\lldbPluginCPlusPlusLanguage.dir\LibCxx.cpp.obj
C:\git\llvm-project\lldb\source\Plugins\Language\CPlusPlus\LibCxx.cpp(1108,38): warning: format specifies type 'long' but the argument has type 'std::time_t' (aka 'long long') [-Wformat]
 1108 |     stream.Printf("timestamp=%ld s", seconds);
      |                              ~~~     ^~~~~~~
      |                              %lld
C:\git\llvm-project\lldb\source\Plugins\Language\CPlusPlus\LibCxx.cpp(1116,63): warning: format specifies type 'long' but the argument has type 'std::time_t' (aka 'long long') [-Wformat]
 1116 |     stream.Printf("date/time=%s timestamp=%ld s", str.data(), seconds);
      |                                           ~~~                 ^~~~~~~
      |                                           %lld
2 warnings generated.
```

Added: 
    

Modified: 
    lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index 060324e2fcfe26..c5bed2cee81507 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -1105,7 +1105,7 @@ bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider(
 
   const std::time_t seconds = ptr_sp->GetValueAsSigned(0);
   if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max)
-    stream.Printf("timestamp=%ld s", seconds);
+    stream.Printf("timestamp=%lld s", seconds);
   else {
     std::array<char, 128> str;
     std::size_t size =
@@ -1113,7 +1113,7 @@ bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider(
     if (size == 0)
       return false;
 
-    stream.Printf("date/time=%s timestamp=%ld s", str.data(), seconds);
+    stream.Printf("date/time=%s timestamp=%lld s", str.data(), seconds);
   }
 
   return true;


        


More information about the lldb-commits mailing list