From 1be99b11f8d1a8fd4049fee1c0eeaef73b3e6d1d Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 17 May 2021 14:01:20 -0400 Subject: 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) : New, use it. Change-Id: I26ed56f99ee47fe884fdfedf87016501631693ce --- gdb/cli/cli-decode.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gdb/cli/cli-decode.h') 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; -- cgit v1.1