================
@@ -324,6 +335,10 @@ int main_platform(int argc, char *argv[]) {
       // connections while a connection is active.
       acceptor_up.reset();
     }
+
+    GDBRemoteCommunicationServerPlatform::PortMap portmap_for_child;
+    portmap_for_child.AllowPort(*port);
----------------
DavidSpickett wrote:

This will fail at runtime if the optional is empty. Are we 100% sure there is 
no path to get here that leaves the optional empty?

If it is expected that we get here with port empty, the code should be:
```
if (port) // Which means "is the optional empty?", not "is the value in the 
optional true in a boolean sense
  portmap_for_child.AllowPort(*port);
```

Given that we're setting a port for a child I assume we'll always have some 
valid port by this point. Though the code is quite complex, so the free assert 
given by `operator*` on the optional does add some safety.

https://github.com/llvm/llvm-project/pull/88845
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to