[Lldb-commits] [lldb] r366440 - [lldb][NFC] Tablegenify alias/regex/history/source/script

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 18 07:10:50 PDT 2019


Author: teemperor
Date: Thu Jul 18 07:10:49 2019
New Revision: 366440

URL: http://llvm.org/viewvc/llvm-project?rev=366440&view=rev
Log:
[lldb][NFC] Tablegenify alias/regex/history/source/script

(Converting these commands together as they are all simple commands
that share the same file).

Modified:
    lldb/trunk/source/Commands/CommandObjectCommands.cpp
    lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=366440&r1=366439&r2=366440&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Thu Jul 18 07:10:49 2019
@@ -32,12 +32,8 @@ using namespace lldb_private;
 // CommandObjectCommandsSource
 
 static constexpr OptionDefinition g_history_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_1, false, "count",       'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "How many history commands to print." },
-  { LLDB_OPT_SET_1, false, "start-index", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "Index at which to start printing history commands (or end to mean tail mode)." },
-  { LLDB_OPT_SET_1, false, "end-index",   'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands." },
-  { LLDB_OPT_SET_2, false, "clear",       'C', OptionParser::eNoArgument,       nullptr, {}, 0, eArgTypeBoolean,         "Clears the current command history." },
-    // clang-format on
+#define LLDB_OPTIONS_history
+#include "CommandOptions.inc"
 };
 
 class CommandObjectCommandsHistory : public CommandObjectParsed {
@@ -189,11 +185,8 @@ protected:
 // CommandObjectCommandsSource
 
 static constexpr OptionDefinition g_source_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_ALL, false, "stop-on-error",    'e', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true, stop executing commands on error." },
-  { LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true, stop executing commands on continue." },
-  { LLDB_OPT_SET_ALL, false, "silent-run",       's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true don't echo commands while executing." },
-    // clang-format on
+#define LLDB_OPTIONS_source
+#include "CommandOptions.inc"
 };
 
 class CommandObjectCommandsSource : public CommandObjectParsed {
@@ -344,10 +337,8 @@ protected:
 // CommandObjectCommandsAlias
 
 static constexpr OptionDefinition g_alias_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_ALL, false, "help",      'h', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeHelpText, "Help text for this command" },
-  { LLDB_OPT_SET_ALL, false, "long-help", 'H', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeHelpText, "Long help text for this command" },
-    // clang-format on
+#define LLDB_OPTIONS_alias
+#include "CommandOptions.inc"
 };
 
 static const char *g_python_command_instructions =
@@ -912,10 +903,8 @@ protected:
 // CommandObjectCommandsAddRegex
 
 static constexpr OptionDefinition g_regex_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_1, false, "help"  , 'h', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNone, "The help text to display for this command." },
-  { LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNone, "A syntax string showing the typical usage syntax." },
-    // clang-format on
+#define LLDB_OPTIONS_regex
+#include "CommandOptions.inc"
 };
 
 #pragma mark CommandObjectCommandsAddRegex
@@ -1387,9 +1376,8 @@ private:
 // CommandObjectCommandsScriptImport
 
 static constexpr OptionDefinition g_script_import_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Allow the script to be loaded even if it was already loaded before. This argument exists for backwards compatibility, but reloading is always allowed, whether you specify it or not." },
-    // clang-format on
+#define LLDB_OPTIONS_script_import
+#include "CommandOptions.inc"
 };
 
 class CommandObjectCommandsScriptImport : public CommandObjectParsed {
@@ -1521,12 +1509,8 @@ static constexpr OptionEnumValues Script
 }
 
 static constexpr OptionDefinition g_script_add_options[] = {
-    // clang-format off
-  { LLDB_OPT_SET_1,   false, "function",      'f', OptionParser::eRequiredArgument, nullptr, {},                  0, eArgTypePythonFunction,               "Name of the Python function to bind to this command name." },
-  { LLDB_OPT_SET_2,   false, "class",         'c', OptionParser::eRequiredArgument, nullptr, {},                  0, eArgTypePythonClass,                  "Name of the Python class to bind to this command name." },
-  { LLDB_OPT_SET_1,   false, "help"  ,        'h', OptionParser::eRequiredArgument, nullptr, {},                  0, eArgTypeHelpText,                     "The help text to display for this command." },
-  { LLDB_OPT_SET_ALL, false, "synchronicity", 's', OptionParser::eRequiredArgument, nullptr, ScriptSynchroType(), 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system." },
-    // clang-format on
+#define LLDB_OPTIONS_script_add
+#include "CommandOptions.inc"
 };
 
 class CommandObjectCommandsScriptAdd : public CommandObjectParsed,

Modified: lldb/trunk/source/Commands/Options.td
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/Options.td?rev=366440&r1=366439&r2=366440&view=diff
==============================================================================
--- lldb/trunk/source/Commands/Options.td (original)
+++ lldb/trunk/source/Commands/Options.td Thu Jul 18 07:10:49 2019
@@ -52,6 +52,63 @@ let Command = "breakpoint list" in {
     "provided, which prime new targets.">;
 }
 
+let Command = "history" in {
+  def history_count : Option<"count", "c">, Group<1>, Arg<"UnsignedInteger">,
+    Desc<"How many history commands to print.">;
+  def history_start_index : Option<"start-index", "s">, Group<1>,
+    Arg<"UnsignedInteger">, Desc<"Index at which to start printing history "
+    "commands (or end to mean tail mode).">;
+  def history_end_index : Option<"end-index", "e">, Group<1>,
+    Arg<"UnsignedInteger">,
+    Desc<"Index at which to stop printing history commands.">;
+  def history_clear : Option<"clear", "C">, Group<2>,
+    Desc<"Clears the current command history.">;
+}
+
+let Command = "source" in {
+  def source_stop_on_error : Option<"stop-on-error", "e">, Arg<"Boolean">,
+    Desc<"If true, stop executing commands on error.">;
+  def source_stop_on_continue : Option<"stop-on-continue", "c">, Arg<"Boolean">,
+    Desc<"If true, stop executing commands on continue.">;
+  def source_silent_run : Option<"silent-run", "s">, Arg<"Boolean">,
+    Desc<"If true don't echo commands while executing.">;
+}
+
+let Command = "alias" in {
+  def alias_help : Option<"help", "h">, Arg<"HelpText">,
+    Desc<"Help text for this command">;
+  def alias_long_help : Option<"long-help", "H">, Arg<"HelpText">,
+    Desc<"Long help text for this command">;
+}
+
+let Command = "regex" in {
+  def regex_help : Option<"help", "h">, Group<1>, Arg<"None">,
+    Desc<"The help text to display for this command.">;
+  def regex_syntax : Option<"syntax", "s">, Group<1>, Arg<"None">,
+    Desc<"A syntax string showing the typical usage syntax.">;
+}
+
+let Command = "script import" in {
+  def script_import_allow_reload : Option<"allow-reload", "r">, Group<1>,
+    Desc<"Allow the script to be loaded even if it was already loaded before. "
+    "This argument exists for backwards compatibility, but reloading is always "
+    "allowed, whether you specify it or not.">;
+}
+
+let Command = "script add" in {
+  def script_add_function : Option<"function", "f">, Group<1>,
+    Arg<"PythonFunction">,
+    Desc<"Name of the Python function to bind to this command name.">;
+  def script_add_class : Option<"class", "c">, Group<2>, Arg<"PythonClass">,
+  Desc<"Name of the Python class to bind to this command name.">;
+  def script_add_help : Option<"help", "h">, Group<1>, Arg<"HelpText">,
+  Desc<"The help text to display for this command.">;
+  def script_add_synchronicity : Option<"synchronicity", "s">,
+    EnumArg<"ScriptedCommandSynchronicity", "ScriptSynchroType()">,
+    Desc<"Set the synchronicity of this command's executions with regard to "
+    "LLDB event system.">;
+}
+
 let Command = "thread backtrace" in {
   def thread_backtrace_count : Option<"count", "c">, Group<1>, Arg<"Count">,
   Desc<"How many frames to display (-1 for all)">;




More information about the lldb-commits mailing list