[Lldb-commits] [lldb] r261602 - Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.
Eugene Zelenko via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 22 17:43:44 PST 2016
Author: eugenezelenko
Date: Mon Feb 22 19:43:44 2016
New Revision: 261602
URL: http://llvm.org/viewvc/llvm-project?rev=261602&view=rev
Log:
Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.
Modified:
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectRegister.cpp
lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=261602&r1=261601&r2=261602&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Mon Feb 22 19:43:44 2016
@@ -7,12 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#include "CommandObjectProcess.h"
-
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "CommandObjectProcess.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/BreakpointSite.h"
@@ -46,8 +45,9 @@ public:
const char *new_process_action) :
CommandObjectParsed (interpreter, name, help, syntax, flags),
m_new_process_action (new_process_action) {}
-
- ~CommandObjectProcessLaunchOrAttach () override {}
+
+ ~CommandObjectProcessLaunchOrAttach() override = default;
+
protected:
bool
StopProcessIfNecessary (Process *process, StateType &state, CommandReturnObject &result)
@@ -81,7 +81,7 @@ protected:
if (detach_error.Success())
{
result.SetStatus (eReturnStatusSuccessFinishResult);
- process = NULL;
+ process = nullptr;
}
else
{
@@ -95,7 +95,7 @@ protected:
if (destroy_error.Success())
{
result.SetStatus (eReturnStatusSuccessFinishResult);
- process = NULL;
+ process = nullptr;
}
else
{
@@ -108,8 +108,10 @@ protected:
}
return result.Succeeded();
}
+
std::string m_new_process_action;
};
+
//-------------------------------------------------------------------------
// CommandObjectProcessLaunch
//-------------------------------------------------------------------------
@@ -117,14 +119,13 @@ protected:
class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach
{
public:
-
CommandObjectProcessLaunch (CommandInterpreter &interpreter) :
- CommandObjectProcessLaunchOrAttach (interpreter,
- "process launch",
- "Launch the executable in the debugger.",
- NULL,
- eCommandRequiresTarget,
- "restart"),
+ CommandObjectProcessLaunchOrAttach(interpreter,
+ "process launch",
+ "Launch the executable in the debugger.",
+ nullptr,
+ eCommandRequiresTarget,
+ "restart"),
m_options (interpreter)
{
CommandArgumentEntry arg;
@@ -141,10 +142,7 @@ public:
m_arguments.push_back (arg);
}
-
- ~CommandObjectProcessLaunch () override
- {
- }
+ ~CommandObjectProcessLaunch() override = default;
int
HandleArgumentCompletion (Args &input,
@@ -159,14 +157,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();
}
@@ -189,10 +187,10 @@ protected:
{
Debugger &debugger = m_interpreter.GetDebugger();
Target *target = debugger.GetSelectedTarget().get();
- // If our listener is NULL, users aren't allows to launch
+ // If our listener is nullptr, users aren't allows to launch
ModuleSP exe_module_sp = target->GetExecutableModule();
- if (exe_module_sp == NULL)
+ if (exe_module_sp == nullptr)
{
result.AppendError ("no file in target, create a debug target using the 'target create' command");
result.SetStatus (eReturnStatusFailed);
@@ -305,15 +303,15 @@ protected:
//OptionDefinition
//CommandObjectProcessLaunch::CommandOptions::g_option_table[] =
//{
-//{ SET1 | SET2 | SET3, false, "stop-at-entry", 's', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Stop at the entry point of the program when launching a process."},
-//{ SET1 , false, "stdin", 'i', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Redirect stdin for the process to <path>."},
-//{ SET1 , false, "stdout", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Redirect stdout for the process to <path>."},
-//{ SET1 , false, "stderr", 'e', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Redirect stderr for the process to <path>."},
-//{ SET1 | SET2 | SET3, false, "plugin", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
-//{ SET2 , false, "tty", 't', OptionParser::eOptionalArgument, NULL, 0, eArgTypeDirectoryName, "Start the process in a terminal. If <path> is specified, look for a terminal whose name contains <path>, else start the process in a new terminal."},
-//{ SET3, false, "no-stdio", 'n', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Do not set up for terminal I/O to go to running process."},
-//{ SET1 | SET2 | SET3, false, "working-dir", 'w', OptionParser::eRequiredArgument, NULL, 0, eArgTypeDirectoryName, "Set the current working directory to <path> when running the inferior."},
-//{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
+//{ SET1 | SET2 | SET3, false, "stop-at-entry", 's', OptionParser::eNoArgument, nullptr, 0, eArgTypeNone, "Stop at the entry point of the program when launching a process."},
+//{ SET1 , false, "stdin", 'i', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Redirect stdin for the process to <path>."},
+//{ SET1 , false, "stdout", 'o', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Redirect stdout for the process to <path>."},
+//{ SET1 , false, "stderr", 'e', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Redirect stderr for the process to <path>."},
+//{ SET1 | SET2 | SET3, false, "plugin", 'p', OptionParser::eRequiredArgument, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
+//{ SET2 , false, "tty", 't', OptionParser::eOptionalArgument, nullptr, 0, eArgTypeDirectoryName, "Start the process in a terminal. If <path> is specified, look for a terminal whose name contains <path>, else start the process in a new terminal."},
+//{ SET3, false, "no-stdio", 'n', OptionParser::eNoArgument, nullptr, 0, eArgTypeNone, "Do not set up for terminal I/O to go to running process."},
+//{ SET1 | SET2 | SET3, false, "working-dir", 'w', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Set the current working directory to <path> when running the inferior."},
+//{ 0, false, nullptr, 0, 0, nullptr, 0, eArgTypeNone, nullptr }
//};
//
//#undef SET1
@@ -327,11 +325,9 @@ protected:
class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach
{
public:
-
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
{
@@ -339,9 +335,7 @@ public:
OptionParsingStarting ();
}
- ~CommandOptions () override
- {
- }
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -428,7 +422,7 @@ public:
// Look to see if there is a -P argument provided, and if so use that plugin, otherwise
// use the default plugin.
- const char *partial_name = NULL;
+ const char *partial_name = nullptr;
partial_name = input.GetArgumentAtIndex(opt_arg_pos);
PlatformSP platform_sp (m_interpreter.GetPlatform (true));
@@ -445,7 +439,7 @@ public:
const size_t num_matches = process_infos.GetSize();
if (num_matches > 0)
{
- for (size_t i=0; i<num_matches; ++i)
+ for (size_t i = 0; i < num_matches; ++i)
{
matches.AppendString (process_infos.GetProcessNameAtIndex(i),
process_infos.GetProcessNameLengthAtIndex(i));
@@ -477,9 +471,7 @@ public:
{
}
- ~CommandObjectProcessAttach () override
- {
- }
+ ~CommandObjectProcessAttach() override = default;
Options *
GetOptions () override
@@ -504,20 +496,20 @@ protected:
if (!StopProcessIfNecessary (process, state, result))
return false;
- if (target == NULL)
+ if (target == nullptr)
{
// If there isn't a current target create one.
TargetSP new_target_sp;
Error error;
- error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(),
- NULL,
- NULL,
- false,
- NULL, // No platform options
- new_target_sp);
+ error = m_interpreter.GetDebugger().GetTargetList().CreateTarget(m_interpreter.GetDebugger(),
+ nullptr,
+ nullptr,
+ false,
+ nullptr, // No platform options
+ new_target_sp);
target = new_target_sp.get();
- if (target == NULL || error.Fail())
+ if (target == nullptr || error.Fail())
{
result.AppendError(error.AsCString("Error creating target"));
return false;
@@ -611,17 +603,16 @@ protected:
CommandOptions m_options;
};
-
OptionDefinition
CommandObjectProcessAttach::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "continue",'c', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Immediately continue the process once attached."},
-{ LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
-{ LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."},
-{ LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."},
-{ LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Include existing processes when doing attach -w."},
-{ LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."},
-{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_ALL, false, "continue",'c', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Immediately continue the process once attached."},
+{ LLDB_OPT_SET_ALL, false, "plugin", 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
+{ LLDB_OPT_SET_1, false, "pid", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid, "The process ID of an existing process to attach to."},
+{ LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "The name of the process to attach to."},
+{ LLDB_OPT_SET_2, false, "include-existing", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Include existing processes when doing attach -w."},
+{ LLDB_OPT_SET_2, false, "waitfor", 'w', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Wait for the process with <process-name> to launch."},
+{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
//-------------------------------------------------------------------------
@@ -632,7 +623,6 @@ CommandObjectProcessAttach::CommandOptio
class CommandObjectProcessContinue : public CommandObjectParsed
{
public:
-
CommandObjectProcessContinue (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"process continue",
@@ -646,17 +636,12 @@ public:
{
}
-
- ~CommandObjectProcessContinue () override
- {
- }
+ ~CommandObjectProcessContinue() override = default;
protected:
-
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
{
@@ -664,9 +649,7 @@ protected:
OptionParsingStarting ();
}
- ~CommandOptions () override
- {
- }
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -814,15 +797,14 @@ protected:
}
CommandOptions m_options;
-
};
OptionDefinition
CommandObjectProcessContinue::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeUnsignedInteger,
+{ LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger,
"Ignore <N> crossings of the breakpoint (if it exists) for the currently selected thread."},
-{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
//-------------------------------------------------------------------------
@@ -836,16 +818,13 @@ public:
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
{
OptionParsingStarting ();
}
- ~CommandOptions () override
- {
- }
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -908,9 +887,7 @@ public:
{
}
- ~CommandObjectProcessDetach () override
- {
- }
+ ~CommandObjectProcessDetach() override = default;
Options *
GetOptions () override
@@ -918,7 +895,6 @@ public:
return &m_options;
}
-
protected:
bool
DoExecute (Args& command, CommandReturnObject &result) override
@@ -929,10 +905,7 @@ protected:
if (m_options.m_keep_stopped == eLazyBoolCalculate)
{
// Check the process default:
- if (process->GetDetachKeepsStopped())
- keep_stopped = true;
- else
- keep_stopped = false;
+ keep_stopped = process->GetDetachKeepsStopped();
}
else if (m_options.m_keep_stopped == eLazyBoolYes)
keep_stopped = true;
@@ -959,8 +932,8 @@ protected:
OptionDefinition
CommandObjectProcessDetach::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)." },
-{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)." },
+{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
//-------------------------------------------------------------------------
@@ -971,22 +944,18 @@ CommandObjectProcessDetach::CommandOptio
class CommandObjectProcessConnect : public CommandObjectParsed
{
public:
-
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
}
-
- ~CommandOptions () override
- {
- }
-
+
+ ~CommandOptions() override = default;
+
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
{
@@ -1036,12 +1005,9 @@ public:
m_options (interpreter)
{
}
-
- ~CommandObjectProcessConnect () override
- {
- }
-
+ ~CommandObjectProcessConnect() override = default;
+
Options *
GetOptions () override
{
@@ -1061,7 +1027,6 @@ protected:
return false;
}
-
Process *process = m_exe_ctx.GetProcessPtr();
if (process && process->IsAlive())
{
@@ -1098,8 +1063,8 @@ protected:
OptionDefinition
CommandObjectProcessConnect::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
- { 0, false, NULL, 0 , 0, NULL, NULL, 0, eArgTypeNone, NULL }
+ { LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
+ { 0, false, nullptr, 0 , 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
//-------------------------------------------------------------------------
@@ -1110,7 +1075,6 @@ CommandObjectProcessConnect::CommandOpti
class CommandObjectProcessPlugin : public CommandObjectProxy
{
public:
-
CommandObjectProcessPlugin (CommandInterpreter &interpreter) :
CommandObjectProxy (interpreter,
"process plugin",
@@ -1119,10 +1083,8 @@ public:
0)
{
}
-
- ~CommandObjectProcessPlugin () override
- {
- }
+
+ ~CommandObjectProcessPlugin() override = default;
CommandObject *
GetProxyCommandObject() override
@@ -1130,11 +1092,10 @@ public:
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process)
return process->GetPluginCommandObject();
- return NULL;
+ return nullptr;
}
};
-
//-------------------------------------------------------------------------
// CommandObjectProcessLoad
//-------------------------------------------------------------------------
@@ -1153,7 +1114,7 @@ public:
OptionParsingStarting ();
}
- ~CommandOptions () override = default;
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -1208,7 +1169,7 @@ public:
{
}
- ~CommandObjectProcessLoad () override = default;
+ ~CommandObjectProcessLoad() override = default;
Options *
GetOptions () override
@@ -1223,7 +1184,7 @@ protected:
Process *process = m_exe_ctx.GetProcessPtr();
const size_t argc = command.GetArgumentCount();
- for (uint32_t i=0; i<argc; ++i)
+ for (uint32_t i = 0; i < argc; ++i)
{
Error error;
PlatformSP platform = process->GetTarget().GetPlatform();
@@ -1293,9 +1254,7 @@ public:
{
}
- ~CommandObjectProcessUnload () override
- {
- }
+ ~CommandObjectProcessUnload() override = default;
protected:
bool
@@ -1305,7 +1264,7 @@ protected:
const size_t argc = command.GetArgumentCount();
- for (uint32_t i=0; i<argc; ++i)
+ for (uint32_t i = 0; i < argc; ++i)
{
const char *image_token_cstr = command.GetArgumentAtIndex(i);
uint32_t image_token = StringConvert::ToUInt32(image_token_cstr, LLDB_INVALID_IMAGE_TOKEN, 0);
@@ -1343,13 +1302,12 @@ protected:
class CommandObjectProcessSignal : public CommandObjectParsed
{
public:
-
CommandObjectProcessSignal (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "process signal",
- "Send a UNIX signal to the current process being debugged.",
- NULL,
- eCommandRequiresProcess | eCommandTryTargetAPILock)
+ CommandObjectParsed(interpreter,
+ "process signal",
+ "Send a UNIX signal to the current process being debugged.",
+ nullptr,
+ eCommandRequiresProcess | eCommandTryTargetAPILock)
{
CommandArgumentEntry arg;
CommandArgumentData signal_arg;
@@ -1365,9 +1323,7 @@ public:
m_arguments.push_back (arg);
}
- ~CommandObjectProcessSignal () override
- {
- }
+ ~CommandObjectProcessSignal() override = default;
protected:
bool
@@ -1414,7 +1370,6 @@ protected:
}
};
-
//-------------------------------------------------------------------------
// CommandObjectProcessInterrupt
//-------------------------------------------------------------------------
@@ -1423,8 +1378,6 @@ protected:
class CommandObjectProcessInterrupt : public CommandObjectParsed
{
public:
-
-
CommandObjectProcessInterrupt (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"process interrupt",
@@ -1436,16 +1389,14 @@ public:
{
}
- ~CommandObjectProcessInterrupt () override
- {
- }
+ ~CommandObjectProcessInterrupt() override = default;
protected:
bool
DoExecute (Args& command, CommandReturnObject &result) override
{
Process *process = m_exe_ctx.GetProcessPtr();
- if (process == NULL)
+ if (process == nullptr)
{
result.AppendError ("no process to halt");
result.SetStatus (eReturnStatusFailed);
@@ -1485,7 +1436,6 @@ protected:
class CommandObjectProcessKill : public CommandObjectParsed
{
public:
-
CommandObjectProcessKill (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"process kill",
@@ -1497,16 +1447,14 @@ public:
{
}
- ~CommandObjectProcessKill () override
- {
- }
+ ~CommandObjectProcessKill() override = default;
protected:
bool
DoExecute (Args& command, CommandReturnObject &result) override
{
Process *process = m_exe_ctx.GetProcessPtr();
- if (process == NULL)
+ if (process == nullptr)
{
result.AppendError ("no process to kill");
result.SetStatus (eReturnStatusFailed);
@@ -1545,7 +1493,6 @@ protected:
class CommandObjectProcessSaveCore : public CommandObjectParsed
{
public:
-
CommandObjectProcessSaveCore (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"process save-core",
@@ -1556,11 +1503,9 @@ public:
eCommandProcessMustBeLaunched)
{
}
-
- ~CommandObjectProcessSaveCore () override
- {
- }
-
+
+ ~CommandObjectProcessSaveCore() override = default;
+
protected:
bool
DoExecute (Args& command,
@@ -1619,10 +1564,7 @@ public:
{
}
- ~CommandObjectProcessStatus() override
- {
- }
-
+ ~CommandObjectProcessStatus() override = default;
bool
DoExecute (Args& command, CommandReturnObject &result) override
@@ -1653,20 +1595,16 @@ public:
class CommandObjectProcessHandle : public CommandObjectParsed
{
public:
-
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
{
OptionParsingStarting ();
}
- ~CommandOptions () override
- {
- }
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -1717,12 +1655,11 @@ public:
std::string pass;
};
-
CommandObjectProcessHandle (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "process handle",
- "Show or update what the process and debugger should do with various signals received from the OS.",
- NULL),
+ CommandObjectParsed(interpreter,
+ "process handle",
+ "Show or update what the process and debugger should do with various signals received from the OS.",
+ nullptr),
m_options (interpreter)
{
SetHelpLong ("\nIf no signals are specified, update them all. If no update "
@@ -1738,9 +1675,7 @@ public:
m_arguments.push_back (arg);
}
- ~CommandObjectProcessHandle () override
- {
- }
+ ~CommandObjectProcessHandle() override = default;
Options *
GetOptions () override
@@ -1752,7 +1687,6 @@ public:
VerifyCommandOptionValue (const std::string &option, int &real_value)
{
bool okay = true;
-
bool success = false;
bool tmp_value = Args::StringToBoolean (option.c_str(), false, &success);
@@ -1945,10 +1879,10 @@ protected:
OptionDefinition
CommandObjectProcessHandle::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received." },
-{ LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received." },
-{ LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." },
-{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+{ LLDB_OPT_SET_1, false, "stop", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received." },
+{ LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received." },
+{ LLDB_OPT_SET_1, false, "pass", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process." },
+{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
//-------------------------------------------------------------------------
@@ -1977,7 +1911,4 @@ CommandObjectMultiwordProcess::CommandOb
LoadSubCommand ("save-core", CommandObjectSP (new CommandObjectProcessSaveCore (interpreter)));
}
-CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess ()
-{
-}
-
+CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess() = default;
Modified: lldb/trunk/source/Commands/CommandObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.cpp?rev=261602&r1=261601&r2=261602&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRegister.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectRegister.cpp Mon Feb 22 19:43:44 2016
@@ -7,12 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#include "CommandObjectRegister.h"
-
// C Includes
// C++ Includes
// Other libraries and framework includes
+#include "llvm/ADT/STLExtras.h"
+
// Project includes
+#include "CommandObjectRegister.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/Scalar.h"
@@ -30,7 +31,6 @@
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Thread.h"
-#include "llvm/ADT/STLExtras.h"
using namespace lldb;
using namespace lldb_private;
@@ -42,14 +42,14 @@ class CommandObjectRegisterRead : public
{
public:
CommandObjectRegisterRead (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "register read",
- "Dump the contents of one or more register values from the current frame. If no register is specified, dumps them all.",
- NULL,
- eCommandRequiresFrame |
- eCommandRequiresRegContext |
- eCommandProcessMustBeLaunched |
- eCommandProcessMustBePaused ),
+ CommandObjectParsed(interpreter,
+ "register read",
+ "Dump the contents of one or more register values from the current frame. If no register is specified, dumps them all.",
+ nullptr,
+ eCommandRequiresFrame |
+ eCommandRequiresRegContext |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused ),
m_option_group (interpreter),
m_format_options (eFormatDefault),
m_command_options ()
@@ -71,12 +71,9 @@ public:
m_option_group.Append (&m_format_options, OptionGroupFormat::OPTION_GROUP_FORMAT | OptionGroupFormat::OPTION_GROUP_GDB_FMT, LLDB_OPT_SET_ALL);
m_option_group.Append (&m_command_options);
m_option_group.Finalize();
-
}
- ~CommandObjectRegisterRead () override
- {
- }
+ ~CommandObjectRegisterRead() override = default;
Options *
GetOptions () override
@@ -175,7 +172,7 @@ protected:
Stream &strm = result.GetOutputStream();
RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext ();
- const RegisterInfo *reg_info = NULL;
+ const RegisterInfo *reg_info = nullptr;
if (command.GetArgumentCount() == 0)
{
size_t set_idx;
@@ -184,9 +181,9 @@ protected:
const size_t set_array_size = m_command_options.set_indexes.GetSize();
if (set_array_size > 0)
{
- for (size_t i=0; i<set_array_size; ++i)
+ for (size_t i = 0; i < set_array_size; ++i)
{
- set_idx = m_command_options.set_indexes[i]->GetUInt64Value (UINT32_MAX, NULL);
+ set_idx = m_command_options.set_indexes[i]->GetUInt64Value(UINT32_MAX, nullptr);
if (set_idx < reg_ctx->GetRegisterSetCount())
{
if (!DumpRegisterSet (m_exe_ctx, strm, reg_ctx, set_idx))
@@ -234,7 +231,7 @@ protected:
else
{
const char *arg_cstr;
- for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
+ for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx)
{
// in most LLDB commands we accept $rbx as the name for register RBX - and here we would
// reject it and non-existant. we should be more consistent towards the user and allow them
@@ -269,12 +266,9 @@ protected:
alternate_name (false, false)
{
}
-
- ~CommandOptions () override
- {
- }
-
-
+
+ ~CommandOptions() override = default;
+
uint32_t
GetNumDefinitions () override;
@@ -350,9 +344,9 @@ protected:
const OptionDefinition
CommandObjectRegisterRead::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_ALL, false, "alternate", 'A', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone , "Display register names using the alternate register name if there is one."},
- { LLDB_OPT_SET_1 , false, "set" , 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeIndex , "Specify which register sets to dump by index."},
- { LLDB_OPT_SET_2 , false, "all" , 'a', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone , "Show all register sets."},
+ { LLDB_OPT_SET_ALL, false, "alternate", 'A', OptionParser::eNoArgument , nullptr, nullptr, 0, eArgTypeNone , "Display register names using the alternate register name if there is one."},
+ { LLDB_OPT_SET_1 , false, "set" , 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex , "Specify which register sets to dump by index."},
+ { LLDB_OPT_SET_2 , false, "all" , 'a', OptionParser::eNoArgument , nullptr, nullptr, 0, eArgTypeNone , "Show all register sets."},
};
uint32_t
@@ -361,7 +355,6 @@ CommandObjectRegisterRead::CommandOption
return llvm::array_lengthof(g_option_table);
}
-
//----------------------------------------------------------------------
// "register write"
//----------------------------------------------------------------------
@@ -369,14 +362,14 @@ class CommandObjectRegisterWrite : publi
{
public:
CommandObjectRegisterWrite (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "register write",
- "Modify a single register value.",
- NULL,
- eCommandRequiresFrame |
- eCommandRequiresRegContext |
- eCommandProcessMustBeLaunched |
- eCommandProcessMustBePaused)
+ CommandObjectParsed(interpreter,
+ "register write",
+ "Modify a single register value.",
+ nullptr,
+ eCommandRequiresFrame |
+ eCommandRequiresRegContext |
+ eCommandProcessMustBeLaunched |
+ eCommandProcessMustBePaused)
{
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
@@ -402,9 +395,7 @@ public:
m_arguments.push_back (arg2);
}
- ~CommandObjectRegisterWrite () override
- {
- }
+ ~CommandObjectRegisterWrite() override = default;
protected:
bool
@@ -422,8 +413,7 @@ protected:
{
const char *reg_name = command.GetArgumentAtIndex(0);
const char *value_str = command.GetArgumentAtIndex(1);
-
-
+
// in most LLDB commands we accept $rbx as the name for register RBX - and here we would
// reject it and non-existant. we should be more consistent towards the user and allow them
// to say reg write $rbx - internally, however, we should be strict and not allow ourselves
@@ -474,7 +464,6 @@ protected:
}
};
-
//----------------------------------------------------------------------
// CommandObjectRegister constructor
//----------------------------------------------------------------------
@@ -488,10 +477,4 @@ CommandObjectRegister::CommandObjectRegi
LoadSubCommand ("write", CommandObjectSP (new CommandObjectRegisterWrite (interpreter)));
}
-
-//----------------------------------------------------------------------
-// Destructor
-//----------------------------------------------------------------------
-CommandObjectRegister::~CommandObjectRegister()
-{
-}
+CommandObjectRegister::~CommandObjectRegister() = default;
Modified: lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp?rev=261602&r1=261601&r2=261602&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp Mon Feb 22 19:43:44 2016
@@ -9,11 +9,12 @@
// C Includes
// C++ Includes
+#include <vector>
-
+// Other libraries and framework includes
+// Project includes
#include "CommandObjectWatchpointCommand.h"
#include "CommandObjectWatchpoint.h"
-
#include "lldb/Core/IOHandler.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -23,8 +24,6 @@
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/State.h"
-#include <vector>
-
using namespace lldb;
using namespace lldb_private;
@@ -32,18 +31,16 @@ using namespace lldb_private;
// CommandObjectWatchpointCommandAdd
//-------------------------------------------------------------------------
-
class CommandObjectWatchpointCommandAdd :
public CommandObjectParsed,
public IOHandlerDelegateMultiline
{
public:
-
CommandObjectWatchpointCommandAdd (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "add",
- "Add a set of commands to a watchpoint, to be executed whenever the watchpoint is hit.",
- NULL),
+ CommandObjectParsed(interpreter,
+ "add",
+ "Add a set of commands to a watchpoint, to be executed whenever the watchpoint is hit.",
+ nullptr),
IOHandlerDelegateMultiline("DONE", IOHandlerDelegate::Completion::LLDBCommand),
m_options (interpreter)
{
@@ -169,7 +166,7 @@ are no syntax errors may indicate that a
m_arguments.push_back (arg);
}
- ~CommandObjectWatchpointCommandAdd () override {}
+ ~CommandObjectWatchpointCommandAdd() override = default;
Options *
GetOptions () override
@@ -187,8 +184,7 @@ are no syntax errors may indicate that a
output_sp->Flush();
}
}
-
-
+
void
IOHandlerInputComplete (IOHandler &io_handler, std::string &line) override
{
@@ -199,7 +195,7 @@ are no syntax errors may indicate that a
if (wp_options)
{
std::unique_ptr<WatchpointOptions::CommandData> data_ap(new WatchpointOptions::CommandData());
- if (data_ap.get())
+ if (data_ap)
{
data_ap->user_source.SplitIntoLines(line);
BatonSP baton_sp (new WatchpointOptions::CommandBaton (data_ap.release()));
@@ -234,8 +230,6 @@ are no syntax errors may indicate that a
BatonSP baton_sp (new WatchpointOptions::CommandBaton (data_ap.release()));
wp_options->SetCallback (WatchpointOptionsCallbackFunction, baton_sp);
-
- return;
}
static bool
@@ -244,10 +238,9 @@ are no syntax errors may indicate that a
lldb::user_id_t watch_id)
{
bool ret_value = true;
- if (baton == NULL)
+ if (baton == nullptr)
return true;
-
-
+
WatchpointOptions::CommandData *data = (WatchpointOptions::CommandData *) baton;
StringList &commands = data->user_source;
@@ -288,7 +281,6 @@ are no syntax errors may indicate that a
class CommandOptions : public Options
{
public:
-
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_use_commands (false),
@@ -300,7 +292,7 @@ are no syntax errors may indicate that a
{
}
- ~CommandOptions () override {}
+ ~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -321,14 +313,8 @@ are no syntax errors may indicate that a
eScriptLanguageNone,
error);
- if (m_script_language == eScriptLanguagePython || m_script_language == eScriptLanguageDefault)
- {
- m_use_script_language = true;
- }
- else
- {
- m_use_script_language = false;
- }
+ m_use_script_language =
+ (m_script_language == eScriptLanguagePython || m_script_language == eScriptLanguageDefault);
break;
case 'e':
@@ -341,11 +327,9 @@ are no syntax errors may indicate that a
break;
case 'F':
- {
- m_use_one_liner = false;
- m_use_script_language = true;
- m_function_name.assign(option_arg);
- }
+ m_use_one_liner = false;
+ m_use_script_language = true;
+ m_function_name.assign(option_arg);
break;
default:
@@ -353,6 +337,7 @@ are no syntax errors may indicate that a
}
return error;
}
+
void
OptionParsingStarting () override
{
@@ -395,7 +380,7 @@ protected:
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
- if (target == NULL)
+ if (target == nullptr)
{
result.AppendError ("There is not a current executable; there are no watchpoints to which to add commands");
result.SetStatus (eReturnStatusFailed);
@@ -412,7 +397,7 @@ protected:
return false;
}
- if (m_options.m_use_script_language == false && m_options.m_function_name.size())
+ if (!m_options.m_use_script_language && !m_options.m_function_name.empty())
{
result.AppendError ("need to enable scripting to have a function run as a watchpoint command");
result.SetStatus (eReturnStatusFailed);
@@ -436,11 +421,11 @@ protected:
{
Watchpoint *wp = target->GetWatchpointList().FindByID (cur_wp_id).get();
// Sanity check wp first.
- if (wp == NULL) continue;
+ if (wp == nullptr) continue;
WatchpointOptions *wp_options = wp->GetOptions();
// Skip this watchpoint if wp_options is not good.
- if (wp_options == NULL) continue;
+ if (wp_options == nullptr) continue;
// If we are using script language, get the script interpreter
// in order to set or collect command callback. Otherwise, call
@@ -456,7 +441,7 @@ protected:
// Special handling for using a Python function by name
// instead of extending the watchpoint callback data structures, we just automatize
// what the user would do manually: make their watchpoint command be a function call
- else if (m_options.m_function_name.size())
+ else if (!m_options.m_function_name.empty())
{
std::string oneliner(m_options.m_function_name);
oneliner += "(frame, wp, internal_dict)";
@@ -489,7 +474,6 @@ private:
CommandOptions m_options;
};
-
// FIXME: "script-type" needs to have its contents determined dynamically, so somebody can add a new scripting
// language to lldb and have it pickable here without having to change this enumeration by hand and rebuild lldb proper.
@@ -499,25 +483,25 @@ g_script_option_enumeration[4] =
{ eScriptLanguageNone, "command", "Commands are in the lldb command interpreter language"},
{ eScriptLanguagePython, "python", "Commands are in the Python language."},
{ eSortOrderByName, "default-script", "Commands are in the default scripting language."},
- { 0, NULL, NULL }
+ { 0, nullptr, nullptr }
};
OptionDefinition
CommandObjectWatchpointCommandAdd::CommandOptions::g_option_table[] =
{
- { LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeOneLiner,
+ { LLDB_OPT_SET_1, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOneLiner,
"Specify a one-line watchpoint command inline. Be sure to surround it with quotes." },
- { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean,
+ { LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
"Specify whether watchpoint command execution should terminate on error." },
- { LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, NULL, g_script_option_enumeration, 0, eArgTypeNone,
+ { LLDB_OPT_SET_ALL, false, "script-type", 's', OptionParser::eRequiredArgument, nullptr, g_script_option_enumeration, 0, eArgTypeNone,
"Specify the language for the commands - if none is specified, the lldb command interpreter will be used."},
- { LLDB_OPT_SET_2, false, "python-function", 'F', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePythonFunction,
+ { LLDB_OPT_SET_2, false, "python-function", 'F', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePythonFunction,
"Give the name of a Python function to run as command for this watchpoint. Be sure to give a module name if appropriate."},
- { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+ { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
};
//-------------------------------------------------------------------------
@@ -528,10 +512,10 @@ class CommandObjectWatchpointCommandDele
{
public:
CommandObjectWatchpointCommandDelete (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "delete",
- "Delete the set of commands from a watchpoint.",
- NULL)
+ CommandObjectParsed(interpreter,
+ "delete",
+ "Delete the set of commands from a watchpoint.",
+ nullptr)
{
CommandArgumentEntry arg;
CommandArgumentData wp_id_arg;
@@ -547,8 +531,7 @@ public:
m_arguments.push_back (arg);
}
-
- ~CommandObjectWatchpointCommandDelete () override {}
+ ~CommandObjectWatchpointCommandDelete() override = default;
protected:
bool
@@ -556,7 +539,7 @@ protected:
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
- if (target == NULL)
+ if (target == nullptr)
{
result.AppendError ("There is not a current executable; there are no watchpoints from which to delete commands");
result.SetStatus (eReturnStatusFailed);
@@ -619,10 +602,10 @@ class CommandObjectWatchpointCommandList
{
public:
CommandObjectWatchpointCommandList (CommandInterpreter &interpreter) :
- CommandObjectParsed (interpreter,
- "list",
- "List the script or set of commands to be executed when the watchpoint is hit.",
- NULL)
+ CommandObjectParsed(interpreter,
+ "list",
+ "List the script or set of commands to be executed when the watchpoint is hit.",
+ nullptr)
{
CommandArgumentEntry arg;
CommandArgumentData wp_id_arg;
@@ -638,7 +621,7 @@ public:
m_arguments.push_back (arg);
}
- ~CommandObjectWatchpointCommandList () override {}
+ ~CommandObjectWatchpointCommandList() override = default;
protected:
bool
@@ -646,7 +629,7 @@ protected:
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
- if (target == NULL)
+ if (target == nullptr)
{
result.AppendError ("There is not a current executable; there are no watchpoints for which to list commands");
result.SetStatus (eReturnStatusFailed);
@@ -744,8 +727,4 @@ CommandObjectWatchpointCommand::CommandO
LoadSubCommand ("list", list_command_object);
}
-CommandObjectWatchpointCommand::~CommandObjectWatchpointCommand ()
-{
-}
-
-
+CommandObjectWatchpointCommand::~CommandObjectWatchpointCommand() = default;
More information about the lldb-commits
mailing list