mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-02 04:27:46 +08:00
gdb: move cmd_list_element::prefixname to cli/cli-decode.c
I don't think this method really benefits from being implemented in the header file, especially because it's recursive, it can't be inlined. Move it to the source file, so it's no re-compiled by every CU including cli/cli-decode.h. I also noticed this method could be const, make it so. gdb/ChangeLog: * cli/cli-decode.h (prefixname): Make const, move implementation to cli/cli-decode.c. * cli/cli-decode.c (cmd_list_element::prefixname): New. Change-Id: I1597cace98d9a4ba71f51f1f495e73cc07b5dcf3
This commit is contained in:
@ -160,6 +160,23 @@ set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd,
|
||||
cmd->completer_handle_brkchars = func;
|
||||
}
|
||||
|
||||
std::string
|
||||
cmd_list_element::prefixname () const
|
||||
{
|
||||
if (this->prefixlist == nullptr)
|
||||
/* Not a prefix command. */
|
||||
return "";
|
||||
|
||||
std::string prefixname;
|
||||
if (this->prefix != nullptr)
|
||||
prefixname = this->prefix->prefixname ();
|
||||
|
||||
prefixname += this->name;
|
||||
prefixname += " ";
|
||||
|
||||
return prefixname;
|
||||
}
|
||||
|
||||
/* Add element named NAME.
|
||||
Space for NAME and DOC must be allocated by the caller.
|
||||
CLASS is the top level category into which commands are broken down
|
||||
|
Reference in New Issue
Block a user