gdb: move cmd_list_element::prefixname to cli/cli-decode.c
[binutils-gdb.git] / gdb / cli / cli-decode.c
index 32edb526c8755fd7de7e7561338af27457262f6e..a3b153f06e4877b2fe38be1e2ddab05b423e8474 100644 (file)
@@ -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