labath added inline comments.

================
Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:3562-3567
+        (process_features & NativeProcessProtocol::Extension::fork) ==
+            NativeProcessProtocol::Extension::fork)
+      m_fork_events_supported = true;
+    else if (x == "vfork-events+" &&
+             (process_features & NativeProcessProtocol::Extension::vfork) ==
+                 NativeProcessProtocol::Extension::vfork)
----------------
mgorny wrote:
> mgorny wrote:
> > labath wrote:
> > > Maybe drop the `== Extension::[v]fork` part?
> > Can't do that, `enum class` doesn't convert to `bool`. In fact, I tried a 
> > few more or less crazy ideas to make this work, and none worked ;-).
> The next best thing I was able to do is check `!= 
> NativeProcessProtocol::Extension()` which is a little bit shorter. Maybe I 
> could try adding `operator==` and `!=` against, say, `nullptr` or some 
> special constant?
An explicit bool cast works though, and is less fancy. Maybe if we combine this 
the `m_enabled_extensions` idea, we could do something like:
```
using Extension = NativeProcessProtocol::Extension;
Extension client_extensions{};
for (StringRef x : client_features)
  client_extensions |= llvm::StringSwitch<Extension>(x).Case("fork-events+", 
Extension::fork).Case("vfork-events+", Extension::vfork).Default({});
m_enabled_extensions = client_extensions & 
m_process_factory.GetSupportedExtensions();
if (bool(m_enabled_extensions & Extension::fork))
  ret.push_back("fork-events+");
if (bool(m_enabled_extensions & Extension::vfork))
  ret.push_back("vfork-events+");
```


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

https://reviews.llvm.org/D100153

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to