diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-17 14:01:20 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-17 14:01:20 -0400 |
commit | 1be99b11f8d1a8fd4049fee1c0eeaef73b3e6d1d (patch) | |
tree | 01897c887dc34c9be242b85d95adce5a5787a96e /gdb/cli/cli-decode.h | |
parent | 9985872497e2b8c86424fcb97cd9a065f406a5c5 (diff) | |
download | binutils-1be99b11f8d1a8fd4049fee1c0eeaef73b3e6d1d.zip binutils-1be99b11f8d1a8fd4049fee1c0eeaef73b3e6d1d.tar.gz binutils-1be99b11f8d1a8fd4049fee1c0eeaef73b3e6d1d.tar.bz2 |
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
Diffstat (limited to 'gdb/cli/cli-decode.h')
-rw-r--r-- | gdb/cli/cli-decode.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 68a9b85..8caf602 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -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; |