[Lldb-commits] [lldb] r263523 - Workaround the fact that "b" is now a separate command object from "_regexp-break", and thus "help b" doesn't show the possible syntaxes

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 14 18:57:10 PDT 2016


Author: enrico
Date: Mon Mar 14 20:57:10 2016
New Revision: 263523

URL: http://llvm.org/viewvc/llvm-project?rev=263523&view=rev
Log:
Workaround the fact that "b" is now a separate command object from "_regexp-break", and thus "help b" doesn't show the possible syntaxes

It would be nice to have a longer-term plan for how to handle help for regular expression commands, since their syntax is highly irregular. I can see a few options (*), but for now this is a reasonable stop-gag measure for the most blatant regression.

(*) the simplest is, of course, to detect a regex command and inherit the syntax for any aliases thereof; it would be nice if this also didn't show the underlying regex command name when the alias is used


Modified:
    lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=263523&r1=263522&r2=263523&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Mon Mar 14 20:57:10 2016
@@ -278,7 +278,7 @@ public:
     bool
     UserCommandExists (const char *cmd);
 
-    bool
+    CommandAlias*
     AddAlias (const char *alias_name,
               lldb::CommandObjectSP& command_obj_sp,
               const char *args_string = nullptr);

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=263523&r1=263522&r2=263523&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Mar 14 20:57:10 2016
@@ -217,7 +217,7 @@ CommandInterpreter::Initialize ()
 
     cmd_obj_sp = GetCommandSPExact ("_regexp-break",false);
     if (cmd_obj_sp)
-        AddAlias ("b", cmd_obj_sp);
+        AddAlias ("b", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
     cmd_obj_sp = GetCommandSPExact ("_regexp-tbreak",false);
     if (cmd_obj_sp)
@@ -1049,7 +1049,7 @@ CommandInterpreter::UserCommandExists (c
     return m_user_dict.find(cmd) != m_user_dict.end();
 }
 
-bool
+CommandAlias*
 CommandInterpreter::AddAlias (const char *alias_name,
                               lldb::CommandObjectSP& command_obj_sp,
                               const char *args_string)
@@ -1064,11 +1064,11 @@ CommandInterpreter::AddAlias (const char
     
     if (command_alias_up && command_alias_up->IsValid())
     {
-        m_alias_dict[alias_name] = CommandObjectSP(command_alias_up.release());
-        return true;
+        m_alias_dict[alias_name] = CommandObjectSP(command_alias_up.get());
+        return command_alias_up.release();
     }
     
-    return false;
+    return nullptr;
 }
 
 bool




More information about the lldb-commits mailing list