[Lldb-commits] [PATCH] D100146: [lldb] [gdb-remote client] Refactor handling qSupported

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 13 01:35:07 PDT 2021

labath added a comment.

In D100146#2685026 <https://reviews.llvm.org/D100146#2685026>, @mgorny wrote:

> In D100146#2684942 <https://reviews.llvm.org/D100146#2684942>, @labath wrote:
>> looks great, just fix the build errors :)
> Yeah, I'm trying to see if I can reproduce them when building with Clang.

I believe StringRef is not implicitly convertible to std::string these days, but all the conversions are in conditionally compiled code. Maybe you don't have any of it enabled?

My guess is it would be sufficient to change `avail_name` to a StringRef (and fix the errors caused by that).

Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:375
+    for (auto x : server_features) {
+      if (x == "qXfer:auxv:read+")
mgorny wrote:
> labath wrote:
> > not a big deal, but this probably shouldn't be auto.
> Could you explain a bit? I thought `auto` is convenient here since the actual type is visible three lines higher.
Well.. my reasoning was something like this:
- llvm guidelines say that auto should be used (only?) when the type is obvious from context
- "context" is not exactly specified, but I would take that to mean the enclosing expression/statement (not the statement two lines up). The use of `cast<Foo>` in the example supports this.
- the actual type is not that complicated (llvm::StringRef), so it e.g. won't cause the line to be split in two
- given the above, and the generally cautious approach to auto in llvm, its better to err on the side of spelling out the type

But like I said, it's not a big deal...

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list