gdb: add cmd_list_element::is_alias

Add the cmd_list_element::is_alias helper to check whether a command is
an alias.  I find it easier to understand the intention in:

  if (c->is_alias ())

than

  if (c->alias_target != nullptr)

Change all the spots that are reading alias_target just to compare it to
NULL/nullptr to use is_alias instead.

gdb/ChangeLog:

	* cli/cli-decode.h (cmd_list_element) <is_alias>: New, use it.

Change-Id: I26ed56f99ee47fe884fdfedf87016501631693ce
This commit is contained in:
Simon Marchi
2021-05-17 14:01:20 -04:00
parent 9985872497
commit 1be99b11f8
5 changed files with 20 additions and 12 deletions

View File

@ -79,6 +79,10 @@ struct cmd_list_element
For non-prefix commands, return an empty string. */
std::string prefixname () const;
/* Return true if this command is an alias of another command. */
bool is_alias () const
{ return this->alias_target != nullptr; }
/* Points to next command in this list. */
struct cmd_list_element *next = nullptr;