[Lldb-commits] [PATCH] D116491: [lldb] Compute fully qualified command names in FindCommandsForApropos

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 5 11:06:58 PST 2022


kastiglione added inline comments.


================
Comment at: lldb/source/Interpreter/CommandInterpreter.cpp:2864
+      for (const auto &subcommand_name : subcommands_found) {
+        auto qualified_name = (command_name + " " + subcommand_name).str();
+        commands_found.AppendString(std::move(qualified_name));
----------------
JDevlieghere wrote:
> It's not obvious what type `qualified_name` is. I would either do:
> 
> ```
>         std::string qualified_name = (command_name + " " + subcommand_name).str();
> ```
> 
> or 
> 
> ```
>         auto qualified_name = std::string(command_name + " " + subcommand_name);
> ```
As you've given feedback on use of `auto` before, should we document some standards around `auto`? It seems to vary in the code, and from person to person. 

I'm cool with explicit `std::string`, but I think a few bits of context here do indicate it's a string type (ex use of `.str()`, use of `+` and a string literal, being passed to `AppendString()`). I'm thinking that some of these could be documented as either sufficient or insufficient for `auto`.

Somewhat separately, what do you think about adding `AppendString(const Twine&)` (D116682) and then making this:

```
commands_found.AppendString(command_name + " " + subcommand_name);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116491



More information about the lldb-commits mailing list