[Lldb-commits] [lldb] [NFC][lldb][windows] Simplify PlatformWindows::ConnectRemote (PR #200823)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 1 06:56:19 PDT 2026


https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/200823

None

>From 256f6dda92c16d06b108dbc50da72f432763643d Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Mon, 1 Jun 2026 14:55:08 +0100
Subject: [PATCH] [NFC][lldb][windows] Simplify PlatformWindows::ConnectRemote

---
 .../Platform/Windows/PlatformWindows.cpp      | 38 +++++++------------
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index eecbe53d46c24..d107d9f65d374 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -131,33 +131,23 @@ PlatformWindows::PlatformWindows(bool is_host) : RemoteAwarePlatform(is_host) {
 }
 
 Status PlatformWindows::ConnectRemote(Args &args) {
-  Status error;
-  if (IsHost()) {
-    error = Status::FromErrorStringWithFormatv(
+  if (IsHost())
+    return Status::FromErrorStringWithFormatv(
         "can't connect to the host platform '{0}', always connected",
         GetPluginName());
-  } else {
-    if (!m_remote_platform_sp)
-      m_remote_platform_sp =
-          platform_gdb_server::PlatformRemoteGDBServer::CreateInstance(
-              /*force=*/true, nullptr);
-
-    if (m_remote_platform_sp) {
-      if (error.Success()) {
-        if (m_remote_platform_sp) {
-          error = m_remote_platform_sp->ConnectRemote(args);
-        } else {
-          error = Status::FromErrorString(
-              "\"platform connect\" takes a single argument: <connect-url>");
-        }
-      }
-    } else
-      error = Status::FromErrorString(
-          "failed to create a 'remote-gdb-server' platform");
 
-    if (error.Fail())
-      m_remote_platform_sp.reset();
-  }
+  if (!m_remote_platform_sp)
+    m_remote_platform_sp =
+        platform_gdb_server::PlatformRemoteGDBServer::CreateInstance(
+            /*force=*/true, nullptr);
+
+  if (!m_remote_platform_sp)
+    return Status::FromErrorString(
+        "failed to create a 'remote-gdb-server' platform");
+
+  Status error = m_remote_platform_sp->ConnectRemote(args);
+  if (error.Fail())
+    m_remote_platform_sp.reset();
 
   return error;
 }



More information about the lldb-commits mailing list