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:
> kastiglione wrote:
> > 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);
> > ```
> The LLVM Coding Standards have a section on `auto`:
> https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable.
>
>
> If it were any other type, I might agree with your argument, but we have a
> bunch of "string" types (`std::string`, `llvm::StringRef` and
> `lldb_private::ConstString` being the usual suspects) making it non-obvious.
from the doc:
> or other places where the type is already obvious from the context.
I find this leaves a lot of room for interpretation, ideally it would be more
precise. In the mean time I will switch to string but I bet this isn't our last
conversation.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116491/new/
https://reviews.llvm.org/D116491
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits