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

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


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp (+14-24) 


``````````diff
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;
 }

``````````

</details>


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


More information about the lldb-commits mailing list