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/unittests/command-def-selftests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/unittests') diff --git a/gdb/unittests/command-def-selftests.c b/gdb/unittests/command-def-selftests.c index 123667d..4a6b678 100644 --- a/gdb/unittests/command-def-selftests.c +++ b/gdb/unittests/command-def-selftests.c @@ -155,7 +155,7 @@ traverse_command_structure (struct cmd_list_element **list, { /* If this command has subcommands and is not an alias, traverse the subcommands. */ - if (c->subcommands != NULL && c->alias_target == nullptr) + if (c->subcommands != NULL && !c->is_alias ()) { /* Recursively call ourselves on the subcommand list, passing the right prefix in. */ -- cgit v1.1