Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.

llvm-svn: 261356
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index 7b58bf9..b12992f 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -9,11 +9,10 @@
 
 // C Includes
 // C++ Includes
-
-
+// Other libraries and framework includes
+// Project includes
 #include "CommandObjectBreakpointCommand.h"
 #include "CommandObjectBreakpoint.h"
-
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
@@ -32,19 +31,17 @@
 // CommandObjectBreakpointCommandAdd
 //-------------------------------------------------------------------------
 
-
 class CommandObjectBreakpointCommandAdd :
     public CommandObjectParsed,
     public IOHandlerDelegateMultiline
 {
 public:
-
     CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "add",
-                             "Add a set of commands to a breakpoint, to be executed whenever the breakpoint is hit."
-                             "  If no breakpoint is specified, adds the commands to the last created breakpoint.",
-                             NULL),
+        CommandObjectParsed(interpreter,
+                            "add",
+                            "Add a set of commands to a breakpoint, to be executed whenever the breakpoint is hit."
+                            "  If no breakpoint is specified, adds the commands to the last created breakpoint.",
+                            nullptr),
         IOHandlerDelegateMultiline ("DONE", IOHandlerDelegate::Completion::LLDBCommand),
         m_options (interpreter)
     {
@@ -178,7 +175,7 @@
         m_arguments.push_back (arg);
     }
 
-    ~CommandObjectBreakpointCommandAdd () override {}
+    ~CommandObjectBreakpointCommandAdd() override = default;
 
     Options *
     GetOptions () override
@@ -196,8 +193,7 @@
             output_sp->Flush();
         }
     }
-    
-    
+
     void
     IOHandlerInputComplete (IOHandler &io_handler, std::string &line) override
     {
@@ -210,7 +206,7 @@
                 continue;
                     
             std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
-            if (data_ap.get())
+            if (data_ap)
             {
                 data_ap->user_source.SplitIntoLines (line.c_str(), line.size());
                 BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
@@ -248,7 +244,6 @@
             BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
             bp_options->SetCallback (BreakpointOptionsCallbackFunction, baton_sp);
         }
-        return;
     }
     
     static bool
@@ -258,10 +253,9 @@
                                        lldb::user_id_t break_loc_id)
     {
         bool ret_value = true;
-        if (baton == NULL)
+        if (baton == nullptr)
             return true;
-        
-        
+
         BreakpointOptions::CommandData *data = (BreakpointOptions::CommandData *) baton;
         StringList &commands = data->user_source;
         
@@ -302,7 +296,6 @@
     class CommandOptions : public Options
     {
     public:
-
         CommandOptions (CommandInterpreter &interpreter) :
             Options (interpreter),
             m_use_commands (false),
@@ -314,7 +307,7 @@
         {
         }
 
-        ~CommandOptions () override {}
+        ~CommandOptions() override = default;
 
         Error
         SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -355,11 +348,9 @@
                 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;
 
             case 'D':
@@ -371,6 +362,7 @@
             }
             return error;
         }
+
         void
         OptionParsingStarting () override
         {
@@ -415,7 +407,7 @@
     {
         Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
 
-        if (target == NULL)
+        if (target == nullptr)
         {
             result.AppendError ("There is not a current executable; there are no breakpoints to which to add commands");
             result.SetStatus (eReturnStatusFailed);
@@ -432,7 +424,7 @@
             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 breakpoint command");
             result.SetStatus (eReturnStatusFailed);
@@ -454,7 +446,7 @@
                 if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
                 {
                     Breakpoint *bp = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-                    BreakpointOptions *bp_options = NULL;
+                    BreakpointOptions *bp_options = nullptr;
                     if (cur_bp_id.GetLocationID() == LLDB_INVALID_BREAK_ID)
                     {
                         // This breakpoint does not have an associated location.
@@ -485,7 +477,7 @@
                     script_interp->SetBreakpointCommandCallback (m_bp_options_vec,
                                                                  m_options.m_one_liner.c_str());
                 }
-                else if (m_options.m_function_name.size())
+                else if (!m_options.m_function_name.empty())
                 {
                     script_interp->SetBreakpointCommandCallbackFunction (m_bp_options_vec,
                                                                          m_options.m_function_name.c_str());
@@ -506,7 +498,6 @@
                     CollectDataForBreakpointCommandCallback (m_bp_options_vec,
                                                              result);
             }
-
         }
 
         return result.Succeeded();
@@ -526,7 +517,6 @@
                                                         // so it isn't worthwhile to come up with a more complex mechanism
                                                         // to address this particular weakness right now.
     static const char *g_reader_instructions;
-
 };
 
 const char *
@@ -541,28 +531,28 @@
     { 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
 CommandObjectBreakpointCommandAdd::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 breakpoint 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 breakpoint 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 breakpoint. Be sure to give a module name if appropriate."},
     
-    { LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
+    { LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
         "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
 
-    { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+    { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
 };
 
 //-------------------------------------------------------------------------
@@ -573,10 +563,10 @@
 {
 public:
     CommandObjectBreakpointCommandDelete (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter, 
-                             "delete",
-                             "Delete the set of commands from a breakpoint.",
-                             NULL),
+        CommandObjectParsed(interpreter,
+                            "delete",
+                            "Delete the set of commands from a breakpoint.",
+                            nullptr),
         m_options (interpreter)
     {
         CommandArgumentEntry arg;
@@ -593,8 +583,7 @@
         m_arguments.push_back (arg);
     }
 
-
-    ~CommandObjectBreakpointCommandDelete () override {}
+    ~CommandObjectBreakpointCommandDelete() override = default;
 
     Options *
     GetOptions () override
@@ -605,14 +594,13 @@
     class CommandOptions : public Options
     {
     public:
-
         CommandOptions (CommandInterpreter &interpreter) :
             Options (interpreter),
             m_use_dummy (false)
         {
         }
 
-        ~CommandOptions () override {}
+        ~CommandOptions() override = default;
 
         Error
         SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -660,7 +648,7 @@
     {
         Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
 
-        if (target == NULL)
+        if (target == nullptr)
         {
             result.AppendError ("There is not a current executable; there are no breakpoints from which to delete commands");
             result.SetStatus (eReturnStatusFailed);
@@ -719,6 +707,7 @@
         }
         return result.Succeeded();
     }
+
 private:
     CommandOptions m_options;
 };
@@ -726,13 +715,12 @@
 OptionDefinition
 CommandObjectBreakpointCommandDelete::CommandOptions::g_option_table[] =
 {
-    { LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
+    { LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
         "Delete commands from Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
 
-    { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+    { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
 };
 
-
 //-------------------------------------------------------------------------
 // CommandObjectBreakpointCommandList
 //-------------------------------------------------------------------------
@@ -741,10 +729,10 @@
 {
 public:
     CommandObjectBreakpointCommandList (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "list",
-                             "List the script or set of commands to be executed when the breakpoint is hit.",
-                              NULL)
+        CommandObjectParsed(interpreter,
+                            "list",
+                            "List the script or set of commands to be executed when the breakpoint is hit.",
+                            nullptr)
     {
         CommandArgumentEntry arg;
         CommandArgumentData bp_id_arg;
@@ -760,7 +748,7 @@
         m_arguments.push_back (arg);
     }
 
-    ~CommandObjectBreakpointCommandList () override {}
+    ~CommandObjectBreakpointCommandList() override = default;
 
 protected:
     bool
@@ -769,7 +757,7 @@
     {
         Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
 
-        if (target == NULL)
+        if (target == nullptr)
         {
             result.AppendError ("There is not a current executable; there are no breakpoints for which to list commands");
             result.SetStatus (eReturnStatusFailed);
@@ -808,7 +796,7 @@
                     
                     if (bp)
                     {
-                        const BreakpointOptions *bp_options = NULL;
+                        const BreakpointOptions *bp_options = nullptr;
                         if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID)
                         {
                             BreakpointLocationSP bp_loc_sp(bp->FindLocationByID (cur_bp_id.GetLocationID()));
@@ -855,7 +843,6 @@
                         result.AppendErrorWithFormat("Invalid breakpoint ID: %u.\n", cur_bp_id.GetBreakpointID());
                         result.SetStatus (eReturnStatusFailed);
                     }
-
                 }
             }
         }
@@ -887,8 +874,4 @@
     LoadSubCommand ("list",   list_command_object);
 }
 
-CommandObjectBreakpointCommand::~CommandObjectBreakpointCommand ()
-{
-}
-
-
+CommandObjectBreakpointCommand::~CommandObjectBreakpointCommand() = default;