From 06210ae42d418d50d8d9365d5c9419308ae9e7ee Mon Sep 17 00:00:00 2001 From: dim Date: Mon, 26 Dec 2016 20:36:37 +0000 Subject: MFC r309124: Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0 release, and add lld 3.9.0. Also completely revamp the build system for clang, llvm, lldb and their related tools. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. Release notes for llvm, clang and lld are available here: Thanks to Ed Maste, Bryan Drewery, Andrew Turner, Antoine Brodin and Jan Beich for their help. Relnotes: yes MFC r309147: Pull in r282174 from upstream llvm trunk (by Krzysztof Parzyszek): [PPC] Set SP after loading data from stack frame, if no red zone is present Follow-up to r280705: Make sure that the SP is only restored after all data is loaded from the stack frame, if there is no red zone. This completes the fix for https://llvm.org/bugs/show_bug.cgi?id=26519. Differential Revision: https://reviews.llvm.org/D24466 Reported by: Mark Millard PR: 214433 MFC r309149: Pull in r283060 from upstream llvm trunk (by Hal Finkel): [PowerPC] Refactor soft-float support, and enable PPC64 soft float This change enables soft-float for PowerPC64, and also makes soft-float disable all vector instruction sets for both 32-bit and 64-bit modes. This latter part is necessary because the PPC backend canonicalizes many Altivec vector types to floating-point types, and so soft-float breaks scalarization support for many operations. Both for embedded targets and for operating-system kernels desiring soft-float support, it seems reasonable that disabling hardware floating-point also disables vector instructions (embedded targets without hardware floating point support are unlikely to have Altivec, etc. and operating system kernels desiring not to use floating-point registers to lower syscall cost are unlikely to want to use vector registers either). If someone needs this to work, we'll need to change the fact that we promote many Altivec operations to act on v4f32. To make it possible to disable Altivec when soft-float is enabled, hardware floating-point support needs to be expressed as a positive feature, like the others, and not a negative feature, because target features cannot have dependencies on the disabling of some other feature. So +soft-float has now become -hard-float. Fixes PR26970. Pull in r283061 from upstream clang trunk (by Hal Finkel): [PowerPC] Enable soft-float for PPC64, and +soft-float -> -hard-float Enable soft-float support on PPC64, as the backend now supports it. Also, the backend now uses -hard-float instead of +soft-float, so set the target features accordingly. Fixes PR26970. Reported by: Mark Millard PR: 214433 MFC r309212: Add a few missed clang 3.9.0 files to OptionalObsoleteFiles. MFC r309262: Fix packaging for clang, lldb and lld 3.9.0 During the upgrade of clang/llvm etc to 3.9.0 in r309124, the PACKAGE directive in the usr.bin/clang/*.mk files got dropped accidentally. Restore it, with a few minor changes and additions: * Correct license in clang.ucl to NCSA * Add PACKAGE=clang for clang and most of the "ll" tools * Put lldb in its own package * Put lld in its own package Reviewed by: gjb, jmallett Differential Revision: https://reviews.freebsd.org/D8666 MFC r309656: During the bootstrap phase, when building the minimal llvm library on PowerPC, add lib/Support/Atomic.cpp. This is needed because upstream llvm revision r271821 disabled the use of std::call_once, which causes some fallback functions from Atomic.cpp to be used instead. Reported by: Mark Millard PR: 214902 MFC r309835: Tentatively apply https://reviews.llvm.org/D18730 to work around gcc PR 70528 (bogus error: constructor required before non-static data member). This should fix buildworld with the external gcc package. Reported by: https://jenkins.freebsd.org/job/FreeBSD_HEAD_amd64_gcc/ MFC r310194: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 3.9.1 release. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. Release notes for llvm, clang and lld will be available here: Relnotes: yes --- .../lldb/source/Commands/CommandObjectCommands.cpp | 755 +++++++++++---------- 1 file changed, 411 insertions(+), 344 deletions(-) (limited to 'contrib/llvm/tools/lldb/source/Commands/CommandObjectCommands.cpp') diff --git a/contrib/llvm/tools/lldb/source/Commands/CommandObjectCommands.cpp b/contrib/llvm/tools/lldb/source/Commands/CommandObjectCommands.cpp index e859b5d..dd2fd9a 100644 --- a/contrib/llvm/tools/lldb/source/Commands/CommandObjectCommands.cpp +++ b/contrib/llvm/tools/lldb/source/Commands/CommandObjectCommands.cpp @@ -7,14 +7,14 @@ // //===----------------------------------------------------------------------===// -#include "CommandObjectCommands.h" - // C Includes // C++ Includes // Other libraries and framework includes #include "llvm/ADT/StringRef.h" // Project includes +#include "CommandObjectCommands.h" +#include "CommandObjectHelp.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/IOHandler.h" #include "lldb/Core/StringList.h" @@ -24,6 +24,7 @@ #include "lldb/Interpreter/CommandObjectRegexCommand.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionValueBoolean.h" +#include "lldb/Interpreter/OptionValueString.h" #include "lldb/Interpreter/OptionValueUInt64.h" #include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/ScriptInterpreter.h" @@ -39,15 +40,15 @@ class CommandObjectCommandsHistory : public CommandObjectParsed { public: CommandObjectCommandsHistory(CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command history", - "Dump the history of commands in this session.", - NULL), + CommandObjectParsed(interpreter, + "command history", + "Dump the history of commands in this session.", + nullptr), m_options (interpreter) { } - ~CommandObjectCommandsHistory () override {} + ~CommandObjectCommandsHistory() override = default; Options * GetOptions () override @@ -56,11 +57,9 @@ public: } protected: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options (interpreter), m_start_idx(0), @@ -70,7 +69,7 @@ protected: { } - ~CommandOptions () override {} + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -222,14 +221,13 @@ protected: OptionDefinition CommandObjectCommandsHistory::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeUnsignedInteger, "How many history commands to print."}, -{ LLDB_OPT_SET_1, false, "start-index", 's', OptionParser::eRequiredArgument, NULL, NULL, 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, NULL, NULL, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands."}, -{ LLDB_OPT_SET_2, false, "clear", 'C', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeBoolean, "Clears the current command history."}, -{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } +{ LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "How many history commands to print."}, +{ LLDB_OPT_SET_1, false, "start-index", 's', OptionParser::eRequiredArgument, nullptr, 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, nullptr, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands."}, +{ LLDB_OPT_SET_2, false, "clear", 'C', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Clears the current command history."}, +{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; - //------------------------------------------------------------------------- // CommandObjectCommandsSource //------------------------------------------------------------------------- @@ -237,12 +235,10 @@ CommandObjectCommandsHistory::CommandOptions::g_option_table[] = class CommandObjectCommandsSource : public CommandObjectParsed { public: - CommandObjectCommandsSource(CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command source", - "Read in debugger commands from the file and execute them.", - NULL), - m_options (interpreter) + CommandObjectCommandsSource(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "command source", "Read and execute LLDB commands from the file .", + nullptr), + m_options(interpreter) { CommandArgumentEntry arg; CommandArgumentData file_arg; @@ -258,7 +254,7 @@ public: m_arguments.push_back (arg); } - ~CommandObjectCommandsSource () override {} + ~CommandObjectCommandsSource() override = default; const char* GetRepeatCommand (Args ¤t_command_args, uint32_t index) override @@ -279,14 +275,14 @@ public: std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, - CommandCompletions::eDiskFileCompletion, - completion_str.c_str(), - match_start_point, - max_return_elements, - NULL, - word_complete, - matches); + CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::eDiskFileCompletion, + completion_str.c_str(), + match_start_point, + max_return_elements, + nullptr, + word_complete, + matches); return matches.GetSize(); } @@ -297,11 +293,9 @@ public: } protected: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options (interpreter), m_stop_on_error (true), @@ -310,7 +304,7 @@ protected: { } - ~CommandOptions () override {} + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -374,7 +368,7 @@ protected: const char *filename = command.GetArgumentAtIndex(0); FileSpec cmd_file (filename, true); - ExecutionContext *exe_ctx = NULL; // Just use the default context. + ExecutionContext *exe_ctx = nullptr; // Just use the default context. // If any options were set, then use them if (m_options.m_stop_on_error.OptionWasSet() || @@ -392,7 +386,6 @@ protected: exe_ctx, options, result); - } else { @@ -403,7 +396,6 @@ protected: exe_ctx, options, result); - } } else @@ -412,18 +404,18 @@ protected: result.SetStatus (eReturnStatusFailed); } return result.Succeeded(); - } + CommandOptions m_options; }; OptionDefinition CommandObjectCommandsSource::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "If true, stop executing commands on error."}, -{ LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "If true, stop executing commands on continue."}, -{ LLDB_OPT_SET_ALL, false, "silent-run", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "If true don't echo commands while executing."}, -{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } +{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on error."}, +{ LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on continue."}, +{ LLDB_OPT_SET_ALL, false, "silent-run", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true don't echo commands while executing."}, +{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; #pragma mark CommandObjectCommandsAlias @@ -435,18 +427,94 @@ static const char *g_python_command_instructions = "Enter your Python command( "You must define a Python function with this signature:\n" "def my_command_impl(debugger, args, result, internal_dict):\n"; - class CommandObjectCommandsAlias : public CommandObjectRaw { - +protected: + class CommandOptions : public OptionGroup + { + public: + CommandOptions () : + OptionGroup(), + m_help(), + m_long_help() + {} + + ~CommandOptions() override = default; + + uint32_t + GetNumDefinitions () override + { + return 3; + } + + const OptionDefinition* + GetDefinitions () override + { + return g_option_table; + } + + Error + SetOptionValue (CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override + { + Error error; + + const int short_option = g_option_table[option_idx].short_option; + + switch (short_option) + { + case 'h': + m_help.SetCurrentValue(option_value); + m_help.SetOptionWasSet(); + break; + + case 'H': + m_long_help.SetCurrentValue(option_value); + m_long_help.SetOptionWasSet(); + break; + + default: + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); + break; + } + + return error; + } + + void + OptionParsingStarting (CommandInterpreter &interpreter) override + { + m_help.Clear(); + m_long_help.Clear(); + } + + // Options table: Required for subclasses of Options. + + static OptionDefinition g_option_table[]; + OptionValueString m_help; + OptionValueString m_long_help; + }; + + OptionGroupOptions m_option_group; + CommandOptions m_command_options; public: - CommandObjectCommandsAlias (CommandInterpreter &interpreter) : - CommandObjectRaw (interpreter, - "command alias", - "Allow users to define their own debugger command abbreviations.", - NULL) + Options * + GetOptions () override + { + return &m_option_group; + } + + CommandObjectCommandsAlias(CommandInterpreter &interpreter) + : CommandObjectRaw(interpreter, "command alias", "Define a custom command in terms of an existing command.", + nullptr), + m_option_group(interpreter), + m_command_options() { + m_option_group.Append(&m_command_options); + m_option_group.Finalize(); + SetHelpLong( "'alias' allows the user to create a short-cut or abbreviation for long \ commands, multi-word commands, and commands that take particular options. \ @@ -551,22 +619,70 @@ rather than using a positional placeholder:" R"( m_arguments.push_back (arg3); } - ~CommandObjectCommandsAlias () override - { - } + ~CommandObjectCommandsAlias() override = default; protected: bool DoExecute (const char *raw_command_line, CommandReturnObject &result) override { - Args args (raw_command_line); - std::string raw_command_string (raw_command_line); + if (!raw_command_line || !raw_command_line[0]) + { + result.AppendError ("'command alias' requires at least two arguments"); + return false; + } + + m_option_group.NotifyOptionParsingStarting(); + + const char * remainder = nullptr; + + if (raw_command_line[0] == '-') + { + // We have some options and these options MUST end with --. + const char *end_options = nullptr; + const char *s = raw_command_line; + while (s && s[0]) + { + end_options = ::strstr (s, "--"); + if (end_options) + { + end_options += 2; // Get past the "--" + if (::isspace (end_options[0])) + { + remainder = end_options; + while (::isspace (*remainder)) + ++remainder; + break; + } + } + s = end_options; + } + + if (end_options) + { + Args args (llvm::StringRef(raw_command_line, end_options - raw_command_line)); + if (!ParseOptions (args, result)) + return false; + + Error error (m_option_group.NotifyOptionParsingFinished()); + if (error.Fail()) + { + result.AppendError (error.AsCString()); + result.SetStatus (eReturnStatusFailed); + return false; + } + } + } + if (nullptr == remainder) + remainder = raw_command_line; + + std::string raw_command_string (remainder); + Args args (raw_command_string.c_str()); size_t argc = args.GetArgumentCount(); if (argc < 2) { - result.AppendError ("'alias' requires at least two arguments"); + result.AppendError ("'command alias' requires at least two arguments"); result.SetStatus (eReturnStatusFailed); return false; } @@ -574,6 +690,17 @@ protected: // Get the alias command. const std::string alias_command = args.GetArgumentAtIndex (0); + if (alias_command.size() > 1 && + alias_command[0] == '-') + { + result.AppendError("aliases starting with a dash are not supported"); + if (alias_command == "--help" || alias_command == "--long-help") + { + result.AppendWarning("if trying to pass options to 'command alias' add a -- at the end of the options"); + } + result.SetStatus (eReturnStatusFailed); + return false; + } // Strip the new alias name off 'raw_command_string' (leave it on args, which gets passed to 'Execute', which // does the stripping itself. @@ -604,12 +731,13 @@ protected: // Get CommandObject that is being aliased. The command name is read from the front of raw_command_string. // raw_command_string is returned with the name of the command object stripped off the front. + std::string original_raw_command_string(raw_command_string); CommandObject *cmd_obj = m_interpreter.GetCommandObjectForCommand (raw_command_string); if (!cmd_obj) { - result.AppendErrorWithFormat ("invalid command given to 'alias'. '%s' does not begin with a valid command." - " No alias created.", raw_command_string.c_str()); + result.AppendErrorWithFormat ("invalid command given to 'command alias'. '%s' does not begin with a valid command." + " No alias created.", original_raw_command_string.c_str()); result.SetStatus (eReturnStatusFailed); return false; } @@ -632,43 +760,36 @@ protected: // Verify & handle any options/arguments passed to the alias command OptionArgVectorSP option_arg_vector_sp = OptionArgVectorSP (new OptionArgVector); - OptionArgVector *option_arg_vector = option_arg_vector_sp.get(); - - CommandObjectSP cmd_obj_sp = m_interpreter.GetCommandSPExact (cmd_obj.GetCommandName(), false); - - if (!m_interpreter.ProcessAliasOptionsArgs (cmd_obj_sp, raw_command_string.c_str(), option_arg_vector_sp)) - { - result.AppendError ("Unable to create requested alias.\n"); - result.SetStatus (eReturnStatusFailed); - return false; - } - - // Create the alias - if (m_interpreter.AliasExists (alias_command.c_str()) - || m_interpreter.UserCommandExists (alias_command.c_str())) + + if (CommandObjectSP cmd_obj_sp = m_interpreter.GetCommandSPExact (cmd_obj.GetCommandName(), false)) { - OptionArgVectorSP temp_option_arg_sp (m_interpreter.GetAliasOptions (alias_command.c_str())); - if (temp_option_arg_sp.get()) + if (m_interpreter.AliasExists (alias_command.c_str()) + || m_interpreter.UserCommandExists (alias_command.c_str())) { - if (option_arg_vector->size() == 0) - m_interpreter.RemoveAliasOptions (alias_command.c_str()); + result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", + alias_command.c_str()); } - result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", - alias_command.c_str()); - } - - if (cmd_obj_sp) - { - m_interpreter.AddAlias (alias_command.c_str(), cmd_obj_sp); - if (option_arg_vector->size() > 0) - m_interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp); - result.SetStatus (eReturnStatusSuccessFinishNoResult); + if (CommandAlias *alias = m_interpreter.AddAlias (alias_command.c_str(), cmd_obj_sp, raw_command_string.c_str())) + { + if (m_command_options.m_help.OptionWasSet()) + alias->SetHelp(m_command_options.m_help.GetCurrentValue()); + if (m_command_options.m_long_help.OptionWasSet()) + alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue()); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } + else + { + result.AppendError ("Unable to create requested alias.\n"); + result.SetStatus (eReturnStatusFailed); + } + } else { result.AppendError ("Unable to create requested alias.\n"); result.SetStatus (eReturnStatusFailed); } + return result.Succeeded (); } @@ -679,7 +800,7 @@ protected: if (argc < 2) { - result.AppendError ("'alias' requires at least two arguments"); + result.AppendError ("'command alias' requires at least two arguments"); result.SetStatus (eReturnStatusFailed); return false; } @@ -703,12 +824,11 @@ protected: CommandObjectSP command_obj_sp(m_interpreter.GetCommandSPExact (actual_command.c_str(), true)); CommandObjectSP subcommand_obj_sp; bool use_subcommand = false; - if (command_obj_sp.get()) + if (command_obj_sp) { CommandObject *cmd_obj = command_obj_sp.get(); - CommandObject *sub_cmd_obj = NULL; + CommandObject *sub_cmd_obj = nullptr; OptionArgVectorSP option_arg_vector_sp = OptionArgVectorSP (new OptionArgVector); - OptionArgVector *option_arg_vector = option_arg_vector_sp.get(); while (cmd_obj->IsMultiwordObject() && args.GetArgumentCount() > 0) { @@ -717,7 +837,7 @@ protected: const std::string sub_command = args.GetArgumentAtIndex(0); assert (sub_command.length() != 0); subcommand_obj_sp = cmd_obj->GetSubcommandSP (sub_command.c_str()); - if (subcommand_obj_sp.get()) + if (subcommand_obj_sp) { sub_cmd_obj = subcommand_obj_sp.get(); use_subcommand = true; @@ -737,45 +857,40 @@ protected: // Verify & handle any options/arguments passed to the alias command + std::string args_string; + if (args.GetArgumentCount () > 0) { CommandObjectSP tmp_sp = m_interpreter.GetCommandSPExact (cmd_obj->GetCommandName(), false); if (use_subcommand) tmp_sp = m_interpreter.GetCommandSPExact (sub_cmd_obj->GetCommandName(), false); - std::string args_string; args.GetCommandString (args_string); - - if (!m_interpreter.ProcessAliasOptionsArgs (tmp_sp, args_string.c_str(), option_arg_vector_sp)) - { - result.AppendError ("Unable to create requested alias.\n"); - result.SetStatus (eReturnStatusFailed); - return false; - } } - - // Create the alias. - + if (m_interpreter.AliasExists (alias_command.c_str()) || m_interpreter.UserCommandExists (alias_command.c_str())) { - OptionArgVectorSP tmp_option_arg_sp (m_interpreter.GetAliasOptions (alias_command.c_str())); - if (tmp_option_arg_sp.get()) - { - if (option_arg_vector->size() == 0) - m_interpreter.RemoveAliasOptions (alias_command.c_str()); - } - result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", + result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", alias_command.c_str()); } - - if (use_subcommand) - m_interpreter.AddAlias (alias_command.c_str(), subcommand_obj_sp); + + if (CommandAlias *alias = m_interpreter.AddAlias(alias_command.c_str(), + use_subcommand ? subcommand_obj_sp : command_obj_sp, + args_string.c_str())) + { + if (m_command_options.m_help.OptionWasSet()) + alias->SetHelp(m_command_options.m_help.GetCurrentValue()); + if (m_command_options.m_long_help.OptionWasSet()) + alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue()); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } else - m_interpreter.AddAlias (alias_command.c_str(), command_obj_sp); - if (option_arg_vector->size() > 0) - m_interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp); - result.SetStatus (eReturnStatusSuccessFinishNoResult); + { + result.AppendError ("Unable to create requested alias.\n"); + result.SetStatus (eReturnStatusFailed); + return false; + } } else { @@ -787,7 +902,14 @@ protected: return result.Succeeded(); } - +}; + +OptionDefinition +CommandObjectCommandsAlias::CommandOptions::g_option_table[] = +{ + { LLDB_OPT_SET_ALL, false, "help", 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "Help text for this command"}, + { LLDB_OPT_SET_ALL, false, "long-help", 'H', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "Long help text for this command"}, + { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; #pragma mark CommandObjectCommandsUnalias @@ -798,11 +920,9 @@ protected: class CommandObjectCommandsUnalias : public CommandObjectParsed { public: - CommandObjectCommandsUnalias (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command unalias", - "Allow the user to remove/delete a user-defined command abbreviation.", - NULL) + CommandObjectCommandsUnalias(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "command unalias", + "Delete one or more custom commands defined by 'command alias'.", nullptr) { CommandArgumentEntry arg; CommandArgumentData alias_arg; @@ -818,9 +938,7 @@ public: m_arguments.push_back (arg); } - ~CommandObjectCommandsUnalias() override - { - } + ~CommandObjectCommandsUnalias() override = default; protected: bool @@ -851,8 +969,7 @@ protected: } else { - - if (m_interpreter.RemoveAlias (command_name) == false) + if (!m_interpreter.RemoveAlias(command_name)) { if (m_interpreter.AliasExists (command_name)) result.AppendErrorWithFormat ("Error occurred while attempting to unalias '%s'.\n", @@ -891,11 +1008,9 @@ protected: class CommandObjectCommandsDelete : public CommandObjectParsed { public: - CommandObjectCommandsDelete (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command delete", - "Allow the user to delete user-defined regular expression, python or multi-word commands.", - NULL) + CommandObjectCommandsDelete(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "command delete", + "Delete one or more custom commands defined by 'command regex'.", nullptr) { CommandArgumentEntry arg; CommandArgumentData alias_arg; @@ -911,9 +1026,7 @@ public: m_arguments.push_back (arg); } - ~CommandObjectCommandsDelete() override - { - } + ~CommandObjectCommandsDelete() override = default; protected: bool @@ -939,14 +1052,24 @@ protected: } else { - result.AppendErrorWithFormat ("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n", - command_name); + StreamString error_msg_stream; + const bool generate_apropos = true; + const bool generate_type_lookup = false; + CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(&error_msg_stream, + command_name, + nullptr, + nullptr, + generate_apropos, + generate_type_lookup); + result.AppendErrorWithFormat ("%s", error_msg_stream.GetData()); result.SetStatus (eReturnStatusFailed); } } else { - result.AppendErrorWithFormat ("must call '%s' with one or more valid user defined regular expression, python or multi-word command names", GetCommandName ()); + result.AppendErrorWithFormat( + "must call '%s' with one or more valid user defined regular expression command names", + GetCommandName()); result.SetStatus (eReturnStatusFailed); } @@ -964,13 +1087,12 @@ class CommandObjectCommandsAddRegex : public IOHandlerDelegateMultiline { public: - CommandObjectCommandsAddRegex (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command regex", - "Allow the user to create a regular expression command.", - "command regex [s/// ...]"), - IOHandlerDelegateMultiline ("", IOHandlerDelegate::Completion::LLDBCommand), - m_options (interpreter) + CommandObjectCommandsAddRegex(CommandInterpreter &interpreter) + : CommandObjectParsed(interpreter, "command regex", + "Define a custom command in terms of existing commands by matching regular expressions.", + "command regex [s/// ...]"), + IOHandlerDelegateMultiline("", IOHandlerDelegate::Completion::LLDBCommand), + m_options(interpreter) { SetHelpLong(R"( )" "This command allows the user to create powerful regular expression commands \ @@ -997,14 +1119,10 @@ a number follows 'f':" R"( (lldb) command regex f s/^$/finish/ 's/([0-9]+)/frame select %1/')" ); } - - ~CommandObjectCommandsAddRegex() override - { - } - - + + ~CommandObjectCommandsAddRegex() override = default; + protected: - void IOHandlerActivated (IOHandler &io_handler) override { @@ -1020,7 +1138,7 @@ protected: IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override { io_handler.SetIsDone(true); - if (m_regex_cmd_ap.get()) + if (m_regex_cmd_ap) { StringList lines; if (lines.SplitIntoLines (data)) @@ -1075,15 +1193,15 @@ protected: Debugger &debugger = m_interpreter.GetDebugger(); bool color_prompt = debugger.GetUseColor(); const bool multiple_lines = true; // Get multiple lines - IOHandlerSP io_handler_sp (new IOHandlerEditline (debugger, - IOHandler::Type::Other, - "lldb-regex", // Name of input reader for history - "> ", // Prompt - NULL, // Continuation prompt - multiple_lines, - color_prompt, - 0, // Don't show line numbers - *this)); + IOHandlerSP io_handler_sp(new IOHandlerEditline(debugger, + IOHandler::Type::Other, + "lldb-regex", // Name of input reader for history + "> ", // Prompt + nullptr, // Continuation prompt + multiple_lines, + color_prompt, + 0, // Don't show line numbers + *this)); if (io_handler_sp) { @@ -1122,7 +1240,7 @@ protected: { Error error; - if (m_regex_cmd_ap.get() == NULL) + if (!m_regex_cmd_ap) { error.SetErrorStringWithFormat("invalid regular expression command object for: '%.*s'", (int)regex_sed.size(), @@ -1190,7 +1308,6 @@ protected: regex_sed.data() + (third_separator_char_pos + 1)); return error; } - } else if (first_separator_char_pos + 1 == second_separator_char_pos) { @@ -1213,7 +1330,7 @@ protected: return error; } - if (check_only == false) + if (!check_only) { std::string regex(regex_sed.substr(first_separator_char_pos + 1, second_separator_char_pos - first_separator_char_pos - 1)); std::string subst(regex_sed.substr(second_separator_char_pos + 1, third_separator_char_pos - second_separator_char_pos - 1)); @@ -1226,7 +1343,7 @@ protected: void AddRegexCommandToInterpreter() { - if (m_regex_cmd_ap.get()) + if (m_regex_cmd_ap) { if (m_regex_cmd_ap->HasRegexEntries()) { @@ -1242,14 +1359,13 @@ private: class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options (interpreter) { } - - ~CommandOptions () override {} - + + ~CommandOptions() override = default; + Error SetOptionValue (uint32_t option_idx, const char *option_arg) override { @@ -1264,7 +1380,6 @@ private: case 's': m_syntax.assign (option_arg); break; - default: error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; @@ -1291,21 +1406,20 @@ private: static OptionDefinition g_option_table[]; const char * - GetHelp () + GetHelp() { - if (m_help.empty()) - return NULL; - return m_help.c_str(); + return (m_help.empty() ? nullptr : m_help.c_str()); } + const char * GetSyntax () { - if (m_syntax.empty()) - return NULL; - return m_syntax.c_str(); + return (m_syntax.empty() ? nullptr : m_syntax.c_str()); } - // Instance variables to hold the values for command options. + protected: + // Instance variables to hold the values for command options. + std::string m_help; std::string m_syntax; }; @@ -1322,30 +1436,23 @@ private: OptionDefinition CommandObjectCommandsAddRegex::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeNone, "The help text to display for this command."}, -{ LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeNone, "A syntax string showing the typical usage syntax."}, -{ 0 , false, NULL , 0 , 0 , NULL, NULL, 0, eArgTypeNone, NULL } +{ LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone, "The help text to display for this command."}, +{ LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone, "A syntax string showing the typical usage syntax."}, +{ 0 , false, nullptr , 0 , 0 , nullptr, nullptr, 0, eArgTypeNone, nullptr } }; - class CommandObjectPythonFunction : public CommandObjectRaw { -private: - std::string m_function_name; - ScriptedCommandSynchronicity m_synchro; - bool m_fetched_help_long; - public: - CommandObjectPythonFunction (CommandInterpreter &interpreter, std::string name, std::string funct, std::string help, ScriptedCommandSynchronicity synch) : - CommandObjectRaw (interpreter, - name.c_str(), - NULL, - NULL), + CommandObjectRaw(interpreter, + name.c_str(), + nullptr, + nullptr), m_function_name(funct), m_synchro(synch), m_fetched_help_long(false) @@ -1359,11 +1466,9 @@ public: SetHelp(stream.GetData()); } } - - ~CommandObjectPythonFunction () override - { - } - + + ~CommandObjectPythonFunction() override = default; + bool IsRemovable () const override { @@ -1393,7 +1498,7 @@ public: std::string docstring; m_fetched_help_long = scripter->GetDocumentationForItem(m_function_name.c_str(),docstring); if (!docstring.empty()) - SetHelpLong(docstring); + SetHelpLong(docstring.c_str()); } } return CommandObjectRaw::GetHelpLong(); @@ -1409,12 +1514,12 @@ protected: result.SetStatus(eReturnStatusInvalid); - if (!scripter || scripter->RunScriptBasedCommand(m_function_name.c_str(), - raw_command_line, - m_synchro, - result, - error, - m_exe_ctx) == false) + if (!scripter || !scripter->RunScriptBasedCommand(m_function_name.c_str(), + raw_command_line, + m_synchro, + result, + error, + m_exe_ctx)) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -1424,7 +1529,7 @@ protected: // Don't change the status if the command already set it... if (result.GetStatus() == eReturnStatusInvalid) { - if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0') + if (result.GetOutputData() == nullptr || result.GetOutputData()[0] == '\0') result.SetStatus(eReturnStatusSuccessFinishNoResult); else result.SetStatus(eReturnStatusSuccessFinishResult); @@ -1433,31 +1538,28 @@ protected: return result.Succeeded(); } - + +private: + std::string m_function_name; + ScriptedCommandSynchronicity m_synchro; + bool m_fetched_help_long; }; class CommandObjectScriptingObject : public CommandObjectRaw { -private: - StructuredData::GenericSP m_cmd_obj_sp; - ScriptedCommandSynchronicity m_synchro; - bool m_fetched_help_short:1; - bool m_fetched_help_long:1; - public: - CommandObjectScriptingObject (CommandInterpreter &interpreter, std::string name, StructuredData::GenericSP cmd_obj_sp, ScriptedCommandSynchronicity synch) : - CommandObjectRaw (interpreter, - name.c_str(), - NULL, - NULL), - m_cmd_obj_sp(cmd_obj_sp), - m_synchro(synch), - m_fetched_help_short(false), - m_fetched_help_long(false) + CommandObjectRaw(interpreter, + name.c_str(), + nullptr, + nullptr), + m_cmd_obj_sp(cmd_obj_sp), + m_synchro(synch), + m_fetched_help_short(false), + m_fetched_help_long(false) { StreamString stream; stream.Printf("For more information run 'help %s'",name.c_str()); @@ -1465,11 +1567,9 @@ public: if (ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter()) GetFlags().Set(scripter->GetFlagsForCommandObject(cmd_obj_sp)); } - - ~CommandObjectScriptingObject () override - { - } - + + ~CommandObjectScriptingObject() override = default; + bool IsRemovable () const override { @@ -1499,7 +1599,7 @@ public: std::string docstring; m_fetched_help_short = scripter->GetShortHelpForCommandObject(m_cmd_obj_sp,docstring); if (!docstring.empty()) - SetHelp(docstring); + SetHelp(docstring.c_str()); } } return CommandObjectRaw::GetHelp(); @@ -1516,7 +1616,7 @@ public: std::string docstring; m_fetched_help_long = scripter->GetLongHelpForCommandObject(m_cmd_obj_sp,docstring); if (!docstring.empty()) - SetHelpLong(docstring); + SetHelpLong(docstring.c_str()); } } return CommandObjectRaw::GetHelpLong(); @@ -1532,12 +1632,12 @@ protected: result.SetStatus(eReturnStatusInvalid); - if (!scripter || scripter->RunScriptBasedCommand(m_cmd_obj_sp, - raw_command_line, - m_synchro, - result, - error, - m_exe_ctx) == false) + if (!scripter || !scripter->RunScriptBasedCommand(m_cmd_obj_sp, + raw_command_line, + m_synchro, + result, + error, + m_exe_ctx)) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -1547,7 +1647,7 @@ protected: // Don't change the status if the command already set it... if (result.GetStatus() == eReturnStatusInvalid) { - if (result.GetOutputData() == NULL || result.GetOutputData()[0] == '\0') + if (result.GetOutputData() == nullptr || result.GetOutputData()[0] == '\0') result.SetStatus(eReturnStatusSuccessFinishNoResult); else result.SetStatus(eReturnStatusSuccessFinishResult); @@ -1556,7 +1656,12 @@ protected: return result.Succeeded(); } - + +private: + StructuredData::GenericSP m_cmd_obj_sp; + ScriptedCommandSynchronicity m_synchro; + bool m_fetched_help_short: 1; + bool m_fetched_help_long: 1; }; //------------------------------------------------------------------------- @@ -1567,10 +1672,10 @@ class CommandObjectCommandsScriptImport : public CommandObjectParsed { public: CommandObjectCommandsScriptImport (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command script import", - "Import a scripting module in LLDB.", - NULL), + CommandObjectParsed(interpreter, + "command script import", + "Import a scripting module in LLDB.", + nullptr), m_options(interpreter) { CommandArgumentEntry arg1; @@ -1586,11 +1691,9 @@ public: // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg1); } - - ~CommandObjectCommandsScriptImport () override - { - } - + + ~CommandObjectCommandsScriptImport() override = default; + int HandleArgumentCompletion (Args &input, int &cursor_index, @@ -1604,14 +1707,14 @@ public: std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, - CommandCompletions::eDiskFileCompletion, - completion_str.c_str(), - match_start_point, - max_return_elements, - NULL, - word_complete, - matches); + CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::eDiskFileCompletion, + completion_str.c_str(), + match_start_point, + max_return_elements, + nullptr, + word_complete, + matches); return matches.GetSize(); } @@ -1622,18 +1725,16 @@ public: } protected: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options (interpreter) { } - - ~CommandOptions () override {} - + + ~CommandOptions() override = default; + Error SetOptionValue (uint32_t option_idx, const char *option_arg) override { @@ -1730,11 +1831,10 @@ protected: OptionDefinition CommandObjectCommandsScriptImport::CommandOptions::g_option_table[] = { - { LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, NULL, NULL, 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."}, - { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } + { LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, nullptr, 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."}, + { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; - //------------------------------------------------------------------------- // CommandObjectCommandsScriptAdd //------------------------------------------------------------------------- @@ -1745,10 +1845,10 @@ class CommandObjectCommandsScriptAdd : { public: CommandObjectCommandsScriptAdd(CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command script add", - "Add a scripted function as an LLDB command.", - NULL), + CommandObjectParsed(interpreter, + "command script add", + "Add a scripted function as an LLDB command.", + nullptr), IOHandlerDelegateMultiline ("DONE"), m_options (interpreter) { @@ -1765,11 +1865,9 @@ public: // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg1); } - - ~CommandObjectCommandsScriptAdd () override - { - } - + + ~CommandObjectCommandsScriptAdd() override = default; + Options * GetOptions () override { @@ -1777,11 +1875,9 @@ public: } protected: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options (interpreter), m_class_name(), @@ -1790,9 +1886,9 @@ protected: m_synchronicity(eScriptedCommandSynchronicitySynchronous) { } - - ~CommandOptions () override {} - + + ~CommandOptions() override = default; + Error SetOptionValue (uint32_t option_idx, const char *option_arg) override { @@ -1922,15 +2018,12 @@ protected: } io_handler.SetIsDone(true); - - } protected: bool DoExecute (Args& command, CommandReturnObject &result) override { - if (m_interpreter.GetDebugger().GetScriptLanguage() != lldb::eScriptLanguagePython) { result.AppendError ("only scripting language supported for scripted commands is currently Python"); @@ -1956,10 +2049,10 @@ protected: { if (m_options.m_funct_name.empty()) { - m_interpreter.GetPythonCommandsFromIOHandler (" ", // Prompt - *this, // IOHandlerDelegate - true, // Run IOHandler in async mode - NULL); // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions + m_interpreter.GetPythonCommandsFromIOHandler(" ", // Prompt + *this, // IOHandlerDelegate + true, // Run IOHandler in async mode + nullptr); // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions } else { @@ -2013,7 +2106,6 @@ protected: } return result.Succeeded(); - } CommandOptions m_options; @@ -2027,17 +2119,17 @@ static OptionEnumValueElement g_script_synchro_type[] = { eScriptedCommandSynchronicitySynchronous, "synchronous", "Run synchronous"}, { eScriptedCommandSynchronicityAsynchronous, "asynchronous", "Run asynchronous"}, { eScriptedCommandSynchronicityCurrentValue, "current", "Do not alter current setting"}, - { 0, NULL, NULL } + { 0, nullptr, nullptr } }; OptionDefinition CommandObjectCommandsScriptAdd::CommandOptions::g_option_table[] = { - { LLDB_OPT_SET_1, false, "function", 'f', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name."}, - { LLDB_OPT_SET_2, false, "class", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePythonClass, "Name of the Python class to bind to this command name."}, - { LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeHelpText, "The help text to display for this command."}, - { LLDB_OPT_SET_ALL, false, "synchronicity", 's', OptionParser::eRequiredArgument, NULL, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system."}, - { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } + { LLDB_OPT_SET_1, false, "function", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonFunction, "Name of the Python function to bind to this command name."}, + { LLDB_OPT_SET_2, false, "class", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonClass, "Name of the Python class to bind to this command name."}, + { LLDB_OPT_SET_1, false, "help" , 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "The help text to display for this command."}, + { LLDB_OPT_SET_ALL, false, "synchronicity", 's', OptionParser::eRequiredArgument, nullptr, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system."}, + { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; //------------------------------------------------------------------------- @@ -2046,33 +2138,26 @@ CommandObjectCommandsScriptAdd::CommandOptions::g_option_table[] = class CommandObjectCommandsScriptList : public CommandObjectParsed { -private: - public: CommandObjectCommandsScriptList(CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command script list", - "List defined scripted commands.", - NULL) + CommandObjectParsed(interpreter, + "command script list", + "List defined scripted commands.", + nullptr) { } - - ~CommandObjectCommandsScriptList () override - { - } - + + ~CommandObjectCommandsScriptList() override = default; + bool DoExecute (Args& command, CommandReturnObject &result) override { - m_interpreter.GetHelp(result, CommandInterpreter::eCommandTypesUserDef); result.SetStatus (eReturnStatusSuccessFinishResult); return true; - - } }; @@ -2082,26 +2167,21 @@ public: class CommandObjectCommandsScriptClear : public CommandObjectParsed { -private: - public: CommandObjectCommandsScriptClear(CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command script clear", - "Delete all scripted commands.", - NULL) - { - } - - ~CommandObjectCommandsScriptClear () override + CommandObjectParsed(interpreter, + "command script clear", + "Delete all scripted commands.", + nullptr) { } - + + ~CommandObjectCommandsScriptClear() override = default; + protected: bool DoExecute (Args& command, CommandReturnObject &result) override { - m_interpreter.RemoveAllUser(); result.SetStatus (eReturnStatusSuccessFinishResult); @@ -2118,10 +2198,10 @@ class CommandObjectCommandsScriptDelete : public CommandObjectParsed { public: CommandObjectCommandsScriptDelete(CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "command script delete", - "Delete a scripted command.", - NULL) + CommandObjectParsed(interpreter, + "command script delete", + "Delete a scripted command.", + nullptr) { CommandArgumentEntry arg1; CommandArgumentData cmd_arg; @@ -2136,11 +2216,9 @@ public: // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg1); } - - ~CommandObjectCommandsScriptDelete () override - { - } - + + ~CommandObjectCommandsScriptDelete() override = default; + protected: bool DoExecute (Args& command, CommandReturnObject &result) override @@ -2169,7 +2247,6 @@ protected: } return result.Succeeded(); - } }; @@ -2182,11 +2259,10 @@ protected: class CommandObjectMultiwordCommandsScript : public CommandObjectMultiword { public: - CommandObjectMultiwordCommandsScript (CommandInterpreter &interpreter) : - CommandObjectMultiword (interpreter, - "command script", - "A set of commands for managing or customizing script commands.", - "command script []") + CommandObjectMultiwordCommandsScript(CommandInterpreter &interpreter) + : CommandObjectMultiword(interpreter, "command script", + "Commands for managing custom commands implemented by interpreter scripts.", + "command script []") { LoadSubCommand ("add", CommandObjectSP (new CommandObjectCommandsScriptAdd (interpreter))); LoadSubCommand ("delete", CommandObjectSP (new CommandObjectCommandsScriptDelete (interpreter))); @@ -2195,24 +2271,18 @@ public: LoadSubCommand ("import", CommandObjectSP (new CommandObjectCommandsScriptImport (interpreter))); } - ~CommandObjectMultiwordCommandsScript () override - { - } - + ~CommandObjectMultiwordCommandsScript() override = default; }; - #pragma mark CommandObjectMultiwordCommands //------------------------------------------------------------------------- // CommandObjectMultiwordCommands //------------------------------------------------------------------------- -CommandObjectMultiwordCommands::CommandObjectMultiwordCommands (CommandInterpreter &interpreter) : - CommandObjectMultiword (interpreter, - "command", - "A set of commands for managing or customizing the debugger commands.", - "command []") +CommandObjectMultiwordCommands::CommandObjectMultiwordCommands(CommandInterpreter &interpreter) + : CommandObjectMultiword(interpreter, "command", "Commands for managing custom LLDB commands.", + "command []") { LoadSubCommand ("source", CommandObjectSP (new CommandObjectCommandsSource (interpreter))); LoadSubCommand ("alias", CommandObjectSP (new CommandObjectCommandsAlias (interpreter))); @@ -2223,7 +2293,4 @@ CommandObjectMultiwordCommands::CommandObjectMultiwordCommands (CommandInterpret LoadSubCommand ("script", CommandObjectSP (new CommandObjectMultiwordCommandsScript (interpreter))); } -CommandObjectMultiwordCommands::~CommandObjectMultiwordCommands () -{ -} - +CommandObjectMultiwordCommands::~CommandObjectMultiwordCommands() = default; -- cgit v1.1