[Lldb-commits] [PATCH] D111321: [lldb] [ConnectionFileDescriptorPosix] Refactor scheme matching

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 8 01:27:16 PDT 2021


labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

thanks



================
Comment at: lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp:142-143
+      auto method =
+          llvm::StringSwitch<std::function<ConnectionStatus(
+              ConnectionFileDescriptor &, llvm::StringRef, Status *)>>(scheme)
+              .Case("listen", &ConnectionFileDescriptor::SocketListenAndAccept)
----------------
Maybe just drop std::function?


================
Comment at: lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp:164-171
     if (error_ptr)
       error_ptr->SetErrorStringWithFormat("unsupported connection URL: '%s'",
                                           path.str().c_str());
     return eConnectionStatusError;
   }
   if (error_ptr)
     error_ptr->SetErrorString("invalid connect arguments");
----------------
Could you also please convert this to early returns, while you're inside. I spent 10 minutes looking at this, and I'm still not sure whether the error strings are correctly related to the individual checks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111321/new/

https://reviews.llvm.org/D111321



More information about the lldb-commits mailing list