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

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 1 07:25:40 PDT 2026


Author: Charles Zablit
Date: 2026-06-01T15:25:34+01:00
New Revision: 6a80387760c17b7e72e77b1b24ac1808bdf0929e

URL: https://github.com/llvm/llvm-project/commit/6a80387760c17b7e72e77b1b24ac1808bdf0929e
DIFF: https://github.com/llvm/llvm-project/commit/6a80387760c17b7e72e77b1b24ac1808bdf0929e.diff

LOG: [NFC][lldb][windows] Simplify PlatformWindows::ConnectRemote (#200823)

Added: 
    

Modified: 
    lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index 94e4dd0f40bf5..22387e04921df 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