Skip to content

Conversation

@ashgti
Copy link
Contributor

@ashgti ashgti commented Apr 25, 2025

Updated the format to use llvm::formatv instead of printf style format.

@llvmbot
Copy link
Member

llvmbot commented Apr 25, 2025

@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)

Changes

Updated the format to use llvm::formatv instead of printf style format.


Full diff: https://github.com/llvm/llvm-project/pull/137371.diff

1 Files Affected:

  • (modified) lldb/tools/lldb-dap/DAP.cpp (+5-2)
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 185b475cfcad6..c21dbbdc6e8ab 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -35,6 +35,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/Support/Chrono.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormatVariadic.h"
@@ -968,8 +969,10 @@ lldb::SBError DAP::WaitForProcessToStop(std::chrono::seconds seconds) {
     }
     std::this_thread::sleep_for(std::chrono::microseconds(250));
   }
-  error.SetErrorStringWithFormat("process failed to stop within %lld seconds",
-                                 seconds.count());
+  error.SetErrorString(
+      llvm::formatv("process failed to stop within {0}", seconds)
+          .str()
+          .c_str());
   return error;
 }
 

@ashgti ashgti changed the title [lldb-dap] Fix formatting chrono::seconds. [lldb-dap] Fix formatting chrono::seconds warning. Apr 25, 2025
@ashgti
Copy link
Contributor Author

ashgti commented Apr 25, 2025

Looks like c4b7bd9 already fixed this with a static cast.

@ashgti ashgti closed this Apr 25, 2025
@ashgti ashgti deleted the lldb-dap-fix-format branch April 25, 2025 17:41
@JDevlieghere
Copy link
Member

FWIW I (also) prefer the formatv approach.

@ashgti ashgti restored the lldb-dap-fix-format branch April 25, 2025 18:08
@ashgti ashgti reopened this Apr 25, 2025
@ashgti ashgti merged commit 9f7a587 into llvm:main Apr 25, 2025
8 of 10 checks passed
@ashgti ashgti deleted the lldb-dap-fix-format branch April 25, 2025 20:34
@DavidSpickett
Copy link
Collaborator

👍

IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Updated the format to use `llvm::formatv` instead of printf style
format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants