[Lldb-commits] [lldb] [lldb-dap] Refactoring IOStream into Transport handler. (PR #130026)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 11 01:30:05 PDT 2025


================
@@ -315,23 +316,19 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name,
                                           &dap_sessions_mutex, &dap_sessions,
                                           &clientCount](
                                              std::unique_ptr<Socket> sock) {
-    std::string name = llvm::formatv("client_{0}", clientCount++).str();
-    if (log) {
-      auto now = std::chrono::duration<double>(
-          std::chrono::system_clock::now().time_since_epoch());
-      *log << llvm::formatv("{0:f9}", now.count()).str()
-           << " client connected: " << name << "\n";
-    }
+    std::string client_name = llvm::formatv("client_{0}", clientCount++).str();
+    DAP_LOG(log, "({0}) client connected", client_name);
 
     lldb::IOObjectSP io(std::move(sock));
 
     // Move the client into a background thread to unblock accepting the next
     // client.
     std::thread client([=, &dap_sessions_condition, &dap_sessions_mutex,
                         &dap_sessions]() {
-      llvm::set_thread_name(name + ".runloop");
-      DAP dap = DAP(name, program_path, log, io, io, default_repl_mode,
-                    pre_init_commands);
+      llvm::set_thread_name(client_name + ".runloop");
+      Transport transport{client_name, log, io, io};
+      DAP dap = DAP(program_path, log, default_repl_mode, pre_init_commands,
----------------
labath wrote:

This mixing two initialization styles, neither of which is particularly common in our code base (I think the most common is the c++11 basic `Foo foo(arg1, arg2);` style). Can you make these consistent at least?

https://github.com/llvm/llvm-project/pull/130026


More information about the lldb-commits mailing list