From f3fbd1c0586ff6ec7895991e6c28f61a503c36a8 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 23 Jul 2016 20:50:09 +0000 Subject: Vendor import of lldb release_39 branch r276489: https://llvm.org/svn/llvm-project/lldb/branches/release_39@276489 --- source/Commands/CommandObjectSettings.cpp | 306 ++++++++++++++---------------- 1 file changed, 142 insertions(+), 164 deletions(-) (limited to 'source/Commands/CommandObjectSettings.cpp') diff --git a/source/Commands/CommandObjectSettings.cpp b/source/Commands/CommandObjectSettings.cpp index 890d77028a99..b76af2075255 100644 --- a/source/Commands/CommandObjectSettings.cpp +++ b/source/Commands/CommandObjectSettings.cpp @@ -12,6 +12,8 @@ // C Includes // C++ Includes // Other libraries and framework includes +#include "llvm/ADT/StringRef.h" + // Project includes #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" @@ -20,7 +22,6 @@ using namespace lldb; using namespace lldb_private; -#include "llvm/ADT/StringRef.h" //------------------------------------------------------------------------- // CommandObjectSettingsSet @@ -29,12 +30,9 @@ using namespace lldb_private; class CommandObjectSettingsSet : public CommandObjectRaw { public: - CommandObjectSettingsSet (CommandInterpreter &interpreter) : - CommandObjectRaw (interpreter, - "settings set", - "Set or change the value of a single debugger setting variable.", - NULL), - m_options (interpreter) + CommandObjectSettingsSet(CommandInterpreter &interpreter) + : CommandObjectRaw(interpreter, "settings set", "Set the value of the specified debugger setting.", nullptr), + m_options(interpreter) { CommandArgumentEntry arg1; CommandArgumentEntry arg2; @@ -82,8 +80,7 @@ insert-before or insert-after." } - - ~CommandObjectSettingsSet () override {} + ~CommandObjectSettingsSet() override = default; // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. bool @@ -98,14 +95,13 @@ insert-before or insert-after." class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options (interpreter), m_global (false) { } - ~CommandOptions () override {} + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -160,7 +156,7 @@ insert-before or insert-after." std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); const size_t argc = input.GetArgumentCount(); - const char *arg = NULL; + const char *arg = nullptr; int setting_var_idx; for (setting_var_idx = 1; setting_var_idx < static_cast(argc); ++setting_var_idx) @@ -172,14 +168,14 @@ insert-before or insert-after." if (cursor_index == setting_var_idx) { // Attempting to complete setting variable name - CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, - CommandCompletions::eSettingsNameCompletion, - completion_str.c_str(), - match_start_point, - max_return_elements, - NULL, - word_complete, - matches); + CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::eSettingsNameCompletion, + completion_str.c_str(), + match_start_point, + max_return_elements, + nullptr, + word_complete, + matches); } else { @@ -231,7 +227,7 @@ protected: } const char *var_name = cmd_args.GetArgumentAtIndex (0); - if ((var_name == NULL) || (var_name[0] == '\0')) + if ((var_name == nullptr) || (var_name[0] == '\0')) { result.AppendError ("'settings set' command requires a valid variable name"); result.SetStatus (eReturnStatusFailed); @@ -246,10 +242,10 @@ protected: Error error; if (m_options.m_global) { - error = m_interpreter.GetDebugger().SetPropertyValue (NULL, - eVarSetOperationAssign, - var_name, - var_value_cstr); + error = m_interpreter.GetDebugger().SetPropertyValue(nullptr, + eVarSetOperationAssign, + var_name, + var_value_cstr); } if (error.Success()) @@ -280,6 +276,7 @@ protected: return result.Succeeded(); } + private: CommandOptions m_options; }; @@ -287,11 +284,10 @@ private: OptionDefinition CommandObjectSettingsSet::CommandOptions::g_option_table[] = { - { LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Apply the new value to the global default value." }, - { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } + { LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Apply the new value to the global default value." }, + { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; - //------------------------------------------------------------------------- // CommandObjectSettingsShow -- Show current values //------------------------------------------------------------------------- @@ -299,11 +295,10 @@ CommandObjectSettingsSet::CommandOptions::g_option_table[] = class CommandObjectSettingsShow : public CommandObjectParsed { public: - CommandObjectSettingsShow (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "settings show", - "Show the specified internal debugger setting variable and its value, or show all the currently set variables and their values, if nothing is specified.", - NULL) + CommandObjectSettingsShow(CommandInterpreter &interpreter) + : CommandObjectParsed( + interpreter, "settings show", + "Show matching debugger settings and their current values. Defaults to showing all settings.", nullptr) { CommandArgumentEntry arg1; CommandArgumentData var_name_arg; @@ -319,8 +314,7 @@ public: m_arguments.push_back (arg1); } - ~CommandObjectSettingsShow () override {} - + ~CommandObjectSettingsShow() override = default; int HandleArgumentCompletion (Args &input, @@ -334,14 +328,14 @@ public: { std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); - CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, - CommandCompletions::eSettingsNameCompletion, - completion_str.c_str(), - match_start_point, - max_return_elements, - NULL, - word_complete, - matches); + CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::eSettingsNameCompletion, + completion_str.c_str(), + match_start_point, + max_return_elements, + nullptr, + word_complete, + matches); return matches.GetSize(); } @@ -354,7 +348,7 @@ protected: const size_t argc = args.GetArgumentCount (); if (argc > 0) { - for (size_t i=0; i []") +CommandObjectMultiwordSettings::CommandObjectMultiwordSettings(CommandInterpreter &interpreter) + : CommandObjectMultiword(interpreter, "settings", "Commands for managing LLDB settings.", + "settings []") { LoadSubCommand ("set", CommandObjectSP (new CommandObjectSettingsSet (interpreter))); LoadSubCommand ("show", CommandObjectSP (new CommandObjectSettingsShow (interpreter))); @@ -1194,6 +1174,4 @@ CommandObjectMultiwordSettings::CommandObjectMultiwordSettings (CommandInterpret LoadSubCommand ("clear", CommandObjectSP (new CommandObjectSettingsClear (interpreter))); } -CommandObjectMultiwordSettings::~CommandObjectMultiwordSettings () -{ -} +CommandObjectMultiwordSettings::~CommandObjectMultiwordSettings() = default; -- cgit v1.2.3