[Lldb-commits] [lldb] r261716 - 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
Tue Feb 23 18:05:55 PST 2016


Author: eugenezelenko
Date: Tue Feb 23 20:05:55 2016
New Revision: 261716

URL: http://llvm.org/viewvc/llvm-project?rev=261716&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/CommandObjectSettings.cpp
    lldb/trunk/source/Commands/CommandObjectSource.cpp
    lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp

Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=261716&r1=261715&r2=261716&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Tue Feb 23 20:05:55 2016
@@ -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
@@ -30,10 +31,10 @@ class CommandObjectSettingsSet : public
 {
 public:
     CommandObjectSettingsSet (CommandInterpreter &interpreter) :
-        CommandObjectRaw (interpreter,
-                          "settings set",
-                          "Set or change the value of a single debugger setting variable.",
-                          NULL),
+        CommandObjectRaw(interpreter,
+                         "settings set",
+                         "Set or change the value of a single debugger setting variable.",
+                         nullptr),
         m_options (interpreter)
     {
         CommandArgumentEntry arg1;
@@ -82,8 +83,7 @@ insert-before or insert-after."
 
     }
 
-
-    ~CommandObjectSettingsSet () override {}
+    ~CommandObjectSettingsSet() override = default;
 
     // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
     bool
@@ -98,14 +98,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 +159,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<int>(argc);
              ++setting_var_idx)
@@ -172,14 +171,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 +230,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 +245,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 +279,7 @@ protected:
 
         return result.Succeeded();
     }
+
 private:
     CommandOptions m_options;
 };
@@ -287,11 +287,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
 //-------------------------------------------------------------------------
@@ -300,10 +299,10 @@ class CommandObjectSettingsShow : public
 {
 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)
+        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.",
+                            nullptr)
     {
         CommandArgumentEntry arg1;
         CommandArgumentData var_name_arg;
@@ -319,8 +318,7 @@ public:
         m_arguments.push_back (arg1);
     }
 
-    ~CommandObjectSettingsShow () override {}
-
+    ~CommandObjectSettingsShow() override = default;
 
     int
     HandleArgumentCompletion (Args &input,
@@ -334,14 +332,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 +352,7 @@ protected:
         const size_t argc = args.GetArgumentCount ();
         if (argc > 0)
         {
-            for (size_t i=0; i<argc; ++i)
+            for (size_t i = 0; i < argc; ++i)
             {
                 const char *property_path = args.GetArgumentAtIndex (i);
 
@@ -387,10 +385,10 @@ class CommandObjectSettingsList : public
 {
 public: 
     CommandObjectSettingsList (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "settings list",
-                             "List and describe all the internal debugger settings variables that are available to the user to 'set' or 'show', or describe a particular variable or set of variables (by specifying the variable name or a common prefix).",
-                             NULL)
+        CommandObjectParsed(interpreter,
+                            "settings list",
+                            "List and describe all the internal debugger settings variables that are available to the user to 'set' or 'show', or describe a particular variable or set of variables (by specifying the variable name or a common prefix).",
+                            nullptr)
     {
         CommandArgumentEntry arg;
         CommandArgumentData var_name_arg;
@@ -411,7 +409,7 @@ public:
         m_arguments.push_back (arg);
     }
 
-    ~CommandObjectSettingsList () override {}
+    ~CommandObjectSettingsList() override = default;
 
     int
     HandleArgumentCompletion (Args &input,
@@ -425,14 +423,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();
     }
 
@@ -448,7 +446,7 @@ protected:
         {
             const bool dump_qualified_name = true;
 
-            for (size_t i=0; i<argc; ++i)
+            for (size_t i = 0; i < argc; ++i)
             {
                 const char *property_path = args.GetArgumentAtIndex (i);
                 
@@ -482,10 +480,10 @@ class CommandObjectSettingsRemove : publ
 {
 public:
     CommandObjectSettingsRemove (CommandInterpreter &interpreter) :
-        CommandObjectRaw (interpreter,
-                          "settings remove",
-                          "Remove the specified element from an array or dictionary settings variable.",
-                          NULL)
+        CommandObjectRaw(interpreter,
+                         "settings remove",
+                         "Remove the specified element from an array or dictionary settings variable.",
+                         nullptr)
     {
         CommandArgumentEntry arg1;
         CommandArgumentEntry arg2;
@@ -517,7 +515,7 @@ public:
         m_arguments.push_back (arg2);
     }
 
-    ~CommandObjectSettingsRemove () override {}
+    ~CommandObjectSettingsRemove() override = default;
 
     int
     HandleArgumentCompletion (Args &input,
@@ -533,14 +531,14 @@ public:
 
         // Attempting to complete variable name
         if (cursor_index < 2)
-            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();
     }
@@ -566,7 +564,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);
@@ -601,10 +599,10 @@ class CommandObjectSettingsReplace : pub
 {
 public:
     CommandObjectSettingsReplace (CommandInterpreter &interpreter) :
-        CommandObjectRaw (interpreter,
-                          "settings replace",
-                          "Replace the specified element from an internal debugger settings array or dictionary variable with the specified new value.",
-                          NULL)
+        CommandObjectRaw(interpreter,
+                         "settings replace",
+                         "Replace the specified element from an internal debugger settings array or dictionary variable with the specified new value.",
+                         nullptr)
     {
         CommandArgumentEntry arg1;
         CommandArgumentEntry arg2;
@@ -646,8 +644,7 @@ public:
         m_arguments.push_back (arg3);
     }
 
-
-    ~CommandObjectSettingsReplace () override {}
+    ~CommandObjectSettingsReplace() override = default;
 
     // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
     bool
@@ -667,14 +664,14 @@ public:
 
         // Attempting to complete variable name
         if (cursor_index < 2)
-            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();
     }
@@ -687,14 +684,13 @@ protected:
 
         Args cmd_args(command);
         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 replace' command requires a valid variable name; No value supplied");
             result.SetStatus (eReturnStatusFailed);
             return false;
         }
 
-
         // Split the raw command into var_name, index_value, and value triple.
         llvm::StringRef raw_str(command);
         std::string var_value_string = raw_str.split(var_name).second.str();
@@ -728,10 +724,10 @@ class CommandObjectSettingsInsertBefore
 {
 public:
     CommandObjectSettingsInsertBefore (CommandInterpreter &interpreter) :
-        CommandObjectRaw (interpreter,
-                          "settings insert-before",
-                          "Insert value(s) into an internal debugger settings array variable, immediately before the specified element.",
-                          NULL)
+        CommandObjectRaw(interpreter,
+                         "settings insert-before",
+                         "Insert value(s) into an internal debugger settings array variable, immediately before the specified element.",
+                         nullptr)
     {
         CommandArgumentEntry arg1;
         CommandArgumentEntry arg2;
@@ -767,7 +763,7 @@ public:
         m_arguments.push_back (arg3);
     }
 
-    ~CommandObjectSettingsInsertBefore () override {}
+    ~CommandObjectSettingsInsertBefore() override = default;
 
     // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
     bool
@@ -787,14 +783,14 @@ public:
 
         // Attempting to complete variable name
         if (cursor_index < 2)
-            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();
     }
@@ -816,7 +812,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 insert-before' command requires a valid variable name; No value supplied");
             result.SetStatus (eReturnStatusFailed);
@@ -851,10 +847,10 @@ class CommandObjectSettingsInsertAfter :
 {
 public:
     CommandObjectSettingsInsertAfter (CommandInterpreter &interpreter) :
-        CommandObjectRaw (interpreter,
-                          "settings insert-after",
-                          "Insert value(s) into an internal debugger settings array variable, immediately after the specified element.",
-                          NULL)
+        CommandObjectRaw(interpreter,
+                         "settings insert-after",
+                         "Insert value(s) into an internal debugger settings array variable, immediately after the specified element.",
+                         nullptr)
     {
         CommandArgumentEntry arg1;
         CommandArgumentEntry arg2;
@@ -890,7 +886,7 @@ public:
         m_arguments.push_back (arg3);
     }
 
-    ~CommandObjectSettingsInsertAfter () override {}
+    ~CommandObjectSettingsInsertAfter() override = default;
 
     // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
     bool
@@ -910,14 +906,14 @@ public:
 
         // Attempting to complete variable name
         if (cursor_index < 2)
-            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();
     }
@@ -939,7 +935,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 insert-after' command requires a valid variable name; No value supplied");
             result.SetStatus (eReturnStatusFailed);
@@ -974,10 +970,10 @@ class CommandObjectSettingsAppend : publ
 {
 public:
     CommandObjectSettingsAppend (CommandInterpreter &interpreter) :
-        CommandObjectRaw (interpreter,
-                          "settings append",
-                          "Append a new value to the end of an internal debugger settings array, dictionary or string variable.",
-                          NULL)
+        CommandObjectRaw(interpreter,
+                         "settings append",
+                         "Append a new value to the end of an internal debugger settings array, dictionary or string variable.",
+                         nullptr)
     {
         CommandArgumentEntry arg1;
         CommandArgumentEntry arg2;
@@ -1003,7 +999,7 @@ public:
         m_arguments.push_back (arg2);
     }
 
-    ~CommandObjectSettingsAppend () override {}
+    ~CommandObjectSettingsAppend() override = default;
 
     // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
     bool
@@ -1023,14 +1019,14 @@ public:
 
         // Attempting to complete variable name
         if (cursor_index < 2)
-            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();
     }
@@ -1051,7 +1047,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 append' command requires a valid variable name; No value supplied");
             result.SetStatus (eReturnStatusFailed);
@@ -1089,10 +1085,10 @@ class CommandObjectSettingsClear : publi
 {
 public:
     CommandObjectSettingsClear (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "settings clear",
-                             "Erase all the contents of an internal debugger settings variables; this is only valid for variables with clearable types, i.e. strings, arrays or dictionaries.",
-                             NULL)
+        CommandObjectParsed(interpreter,
+                            "settings clear",
+                            "Erase all the contents of an internal debugger settings variables; this is only valid for variables with clearable types, i.e. strings, arrays or dictionaries.",
+                            nullptr)
     {
         CommandArgumentEntry arg;
         CommandArgumentData var_name_arg;
@@ -1108,7 +1104,7 @@ public:
         m_arguments.push_back (arg);
     }
 
-    ~CommandObjectSettingsClear () override {}
+    ~CommandObjectSettingsClear() override = default;
 
     int
     HandleArgumentCompletion (Args &input,
@@ -1124,14 +1120,14 @@ public:
 
         // Attempting to complete variable name
         if (cursor_index < 2)
-            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();
     }
@@ -1151,17 +1147,17 @@ protected:
         }
 
         const char *var_name = command.GetArgumentAtIndex (0);
-        if ((var_name == NULL) || (var_name[0] == '\0'))
+        if ((var_name == nullptr) || (var_name[0] == '\0'))
         {
             result.AppendError ("'settings clear' command requires a valid variable name; No value supplied");
             result.SetStatus (eReturnStatusFailed);
             return false;
         }
         
-        Error error (m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx,
-                                                                   eVarSetOperationClear,
-                                                                   var_name,
-                                                                   NULL));
+        Error error(m_interpreter.GetDebugger().SetPropertyValue(&m_exe_ctx,
+                                                                 eVarSetOperationClear,
+                                                                 var_name,
+                                                                 nullptr));
         if (error.Fail())
         {
             result.AppendError (error.AsCString());
@@ -1194,6 +1190,4 @@ CommandObjectMultiwordSettings::CommandO
     LoadSubCommand ("clear",         CommandObjectSP (new CommandObjectSettingsClear (interpreter)));
 }
 
-CommandObjectMultiwordSettings::~CommandObjectMultiwordSettings ()
-{
-}
+CommandObjectMultiwordSettings::~CommandObjectMultiwordSettings() = default;

Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=261716&r1=261715&r2=261716&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Tue Feb 23 20:05:55 2016
@@ -35,7 +35,6 @@
 using namespace lldb;
 using namespace lldb_private;
 
-
 #pragma mark CommandObjectSourceInfo
 //----------------------------------------------------------------------
 // CommandObjectSourceInfo - debug line entries dumping command
@@ -43,13 +42,12 @@ using namespace lldb_private;
 
 class CommandObjectSourceInfo : public CommandObjectParsed
 {
-
     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
@@ -119,6 +117,7 @@ class CommandObjectSourceInfo : public C
         {
             return g_option_table;
         }
+
         static OptionDefinition g_option_table[];
 
         // Instance variables to hold the values for command options.
@@ -133,15 +132,18 @@ class CommandObjectSourceInfo : public C
     };
 
 public:
-    CommandObjectSourceInfo (CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "source info", "Display source line information (as specified) based "
-                                                          "on the current executable's debug info.",
-                              NULL, eCommandRequiresTarget),
-          m_options(interpreter)
+    CommandObjectSourceInfo (CommandInterpreter &interpreter) :
+        CommandObjectParsed(interpreter,
+                            "source info",
+                            "Display source line information (as specified) based "
+                            "on the current executable's debug info.",
+                            nullptr,
+                            eCommandRequiresTarget),
+        m_options(interpreter)
     {
     }
 
-    ~CommandObjectSourceInfo () override {}
+    ~CommandObjectSourceInfo() override = default;
 
     Options *
     GetOptions () override
@@ -150,7 +152,6 @@ public:
     }
 
 protected:
-
     // Dump the line entries in each symbol context.
     // Return the number of entries found.
     // If module_list is set, only dump lines contained in one of the modules.
@@ -172,7 +173,7 @@ protected:
         if (file_spec)
         {
             assert(file_spec.GetFilename().AsCString());
-            has_path = (file_spec.GetDirectory().AsCString() != 0);
+            has_path = (file_spec.GetDirectory().AsCString() != nullptr);
         }
     
         // Dump all the line entries for the file in the list.
@@ -240,7 +241,7 @@ protected:
         if (cu)
         {
             assert(file_spec.GetFilename().AsCString());
-            bool has_path = (file_spec.GetDirectory().AsCString() != 0);
+            bool has_path = (file_spec.GetDirectory().AsCString() != nullptr);
             const FileSpecList &cu_file_list = cu->GetSupportFiles();
             size_t file_idx = cu_file_list.FindFileIndex(0, file_spec, has_path);
             if (file_idx != UINT32_MAX)
@@ -390,7 +391,7 @@ protected:
                     else
                     {
                         StreamString addr_strm;
-                        so_addr.Dump(&addr_strm, NULL, Address::DumpStyleModuleWithFileAddress);
+                        so_addr.Dump(&addr_strm, nullptr, Address::DumpStyleModuleWithFileAddress);
                         error_strm.Printf("Address 0x%" PRIx64 " resolves to %s, but there is"
                                           " no source information available for this address.\n",
                                           addr, addr_strm.GetData());
@@ -399,7 +400,7 @@ protected:
                 else
                 {
                     StreamString addr_strm;
-                    so_addr.Dump(&addr_strm, NULL, Address::DumpStyleModuleWithFileAddress);
+                    so_addr.Dump(&addr_strm, nullptr, Address::DumpStyleModuleWithFileAddress);
                     error_strm.Printf("Address 0x%" PRIx64 " resolves to %s, but it cannot"
                                       " be found in any modules.\n",
                                       addr, addr_strm.GetData());
@@ -573,7 +574,7 @@ protected:
     DumpLinesForFrame (CommandReturnObject &result)
     {
         StackFrame *cur_frame = m_exe_ctx.GetFramePtr();
-        if (cur_frame == NULL)
+        if (cur_frame == nullptr)
         {
             result.AppendError("No selected frame to use to find the default source.");
             return false;
@@ -613,10 +614,10 @@ protected:
         }
 
         Target *target = m_exe_ctx.GetTargetPtr();
-        if (target == NULL)
+        if (target == nullptr)
         {
             target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-            if (target == NULL)
+            if (target == nullptr)
             {
                 result.AppendError("invalid target, create a debug target using the "
                                    "'target create' command.");
@@ -631,7 +632,7 @@ protected:
 
         // Collect the list of modules to search.
         m_module_list.Clear();
-        if (m_options.modules.size() > 0)
+        if (!m_options.modules.empty())
         {
             for (size_t i = 0, e = m_options.modules.size(); i < e; ++i)
             {
@@ -699,27 +700,26 @@ protected:
 };
 
 OptionDefinition CommandObjectSourceInfo::CommandOptions::g_option_table[] = {
-    {LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount,
+    {LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount,
      "The number of line entries to display."},
-    {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib", 's', OptionParser::eRequiredArgument, NULL, NULL,
+    {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr,
      CommandCompletions::eModuleCompletion, eArgTypeShlibName,
      "Look up the source in the given module or shared library (can be "
      "specified more than once)."},
-    {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL,
+    {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr,
      CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."},
-    {LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum,
+    {LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum,
      "The line number at which to start the displaying lines."},
-    {LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum,
+    {LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum,
      "The line number at which to stop displaying lines."},
-    {LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL,
+    {LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr,
      CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."},
-    {LLDB_OPT_SET_3, false, "address", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression,
+    {LLDB_OPT_SET_3, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression,
      "Lookup the address and display the source information for the "
      "corresponding file and line."},
-    {0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL}
+    {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
 };
 
-
 #pragma mark CommandObjectSourceList
 //-------------------------------------------------------------------------
 // CommandObjectSourceList
@@ -727,7 +727,6 @@ OptionDefinition CommandObjectSourceInfo
 
 class CommandObjectSourceList : public CommandObjectParsed
 {
-
     class CommandOptions : public Options
     {
     public:
@@ -736,9 +735,7 @@ class CommandObjectSourceList : public C
         {
         }
 
-        ~CommandOptions () override
-        {
-        }
+        ~CommandOptions() override = default;
 
         Error
         SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -810,6 +807,7 @@ class CommandObjectSourceList : public C
         {
             return g_option_table;
         }
+
         static OptionDefinition g_option_table[];
 
         // Instance variables to hold the values for command options.
@@ -826,19 +824,16 @@ class CommandObjectSourceList : public C
  
 public:   
     CommandObjectSourceList(CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "source list",
-                             "Display source code (as specified) based on the current executable's debug info.",
-                             NULL,
-                             eCommandRequiresTarget), 
+        CommandObjectParsed(interpreter,
+                            "source list",
+                            "Display source code (as specified) based on the current executable's debug info.",
+                            nullptr,
+                            eCommandRequiresTarget),
         m_options (interpreter)
     {
     }
 
-    ~CommandObjectSourceList () override
-    {
-    }
-
+    ~CommandObjectSourceList() override = default;
 
     Options *
     GetOptions () override
@@ -853,7 +848,7 @@ public:
         // values for this invocation...  I have to scan the arguments directly.
         size_t num_args = current_command_args.GetArgumentCount();
         bool is_reverse = false;
-        for (size_t i = 0 ; i < num_args; i++)
+        for (size_t i = 0; i < num_args; i++)
         {
             const char *arg = current_command_args.GetArgumentAtIndex(i);
             if (arg && (strcmp(arg, "-r") == 0 || strcmp(arg, "--reverse") == 0))
@@ -875,7 +870,6 @@ public:
     }
 
 protected:
-
     struct SourceInfo
     {
         ConstString function;
@@ -950,7 +944,7 @@ protected:
             uint32_t end_line;
             FileSpec end_file;
             
-            if (sc.block == NULL)
+            if (sc.block == nullptr)
             {
                 // Not an inlined function
                 sc.function->GetStartLineSourceInfo (start_file, start_line);
@@ -1194,7 +1188,7 @@ protected:
                 // in all modules
                 const ModuleList &module_list = target->GetImages();
                 const size_t num_modules = module_list.GetSize();
-                for (size_t i=0; i<num_modules; ++i)
+                for (size_t i = 0; i < num_modules; ++i)
                 {
                     ModuleSP module_sp (module_list.GetModuleAtIndex(i));
                     if (module_sp && module_sp->ResolveFileAddress(m_options.address, so_addr))
@@ -1231,7 +1225,7 @@ protected:
                         }
                         else
                         {
-                            so_addr.Dump(&error_strm, NULL, Address::DumpStyleModuleWithFileAddress);
+                            so_addr.Dump(&error_strm, nullptr, Address::DumpStyleModuleWithFileAddress);
                             result.AppendErrorWithFormat("address resolves to %s, but there is no line table information available for this address.\n",
                                                          error_strm.GetData());
                             result.SetStatus (eReturnStatusFailed);
@@ -1248,7 +1242,7 @@ protected:
                 }
             }
             uint32_t num_matches = sc_list.GetSize();
-            for (uint32_t i=0; i<num_matches; ++i)
+            for (uint32_t i = 0; i < num_matches; ++i)
             {
                 SymbolContext sc;
                 sc_list.GetContextAtIndex(i, sc);
@@ -1339,7 +1333,6 @@ protected:
                 {
                     result.SetStatus (eReturnStatusSuccessFinishResult);
                 }
-
             }
         }
         else
@@ -1350,7 +1343,7 @@ protected:
             SymbolContextList sc_list;
             size_t num_matches = 0;
             
-            if (m_options.modules.size() > 0)
+            if (!m_options.modules.empty())
             {
                 ModuleList matching_modules;
                 for (size_t i = 0, e = m_options.modules.size(); i < e; ++i)
@@ -1389,7 +1382,7 @@ protected:
             if (num_matches > 1)
             {
                 bool got_multiple = false;
-                FileSpec *test_cu_spec = NULL;
+                FileSpec *test_cu_spec = nullptr;
 
                 for (unsigned i = 0; i < num_matches; i++)
                 {
@@ -1461,27 +1454,27 @@ protected:
     {
         if (m_breakpoint_locations.GetFileLineMatches().GetSize() > 0)
             return &m_breakpoint_locations.GetFileLineMatches();
-        return NULL;
+        return nullptr;
     }
+
     CommandOptions m_options;
     FileLineResolver m_breakpoint_locations;
     std::string    m_reverse_name;
-
 };
 
 OptionDefinition
 CommandObjectSourceList::CommandOptions::g_option_table[] =
 {
-{ LLDB_OPT_SET_ALL, false, "count",  'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount,   "The number of source lines to display."},
+{ LLDB_OPT_SET_ALL, false, "count",  'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount,   "The number of source lines to display."},
 { LLDB_OPT_SET_1  |
-  LLDB_OPT_SET_2  , false, "shlib",  's', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source file in the given shared library."},
-{ LLDB_OPT_SET_ALL, false, "show-breakpoints", 'b', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Show the line table locations from the debug information that indicate valid places to set source level breakpoints."},
-{ LLDB_OPT_SET_1  , false, "file",   'f', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename,    "The file from which to display source."},
-{ LLDB_OPT_SET_1  , false, "line",   'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum,    "The line number at which to start the display source."},
-{ LLDB_OPT_SET_2  , false, "name",   'n', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeSymbol,    "The name of a function whose source to display."},
-{ LLDB_OPT_SET_3  , false, "address",'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."},
-{ LLDB_OPT_SET_4, false, "reverse", 'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Reverse the listing to look backwards from the last displayed block of source."},
-{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+  LLDB_OPT_SET_2  , false, "shlib",  's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Look up the source file in the given shared library."},
+{ LLDB_OPT_SET_ALL, false, "show-breakpoints", 'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show the line table locations from the debug information that indicate valid places to set source level breakpoints."},
+{ LLDB_OPT_SET_1  , false, "file",   'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename,    "The file from which to display source."},
+{ LLDB_OPT_SET_1  , false, "line",   'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum,    "The line number at which to start the display source."},
+{ LLDB_OPT_SET_2  , false, "name",   'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeSymbol,    "The name of a function whose source to display."},
+{ LLDB_OPT_SET_3  , false, "address",'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."},
+{ LLDB_OPT_SET_4, false, "reverse", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Reverse the listing to look backwards from the last displayed block of source."},
+{ 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
 };
 
 #pragma mark CommandObjectMultiwordSource
@@ -1499,7 +1492,4 @@ CommandObjectMultiwordSource::CommandObj
     LoadSubCommand ("list",   CommandObjectSP (new CommandObjectSourceList (interpreter)));
 }
 
-CommandObjectMultiwordSource::~CommandObjectMultiwordSource ()
-{
-}
-
+CommandObjectMultiwordSource::~CommandObjectMultiwordSource() = default;

Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=261716&r1=261715&r2=261716&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Tue Feb 23 20:05:55 2016
@@ -12,7 +12,11 @@
 
 // C Includes
 // C++ Includes
+#include <vector>
+
 // Other libraries and framework includes
+#include "llvm/ADT/StringRef.h"
+
 // Project includes
 #include "lldb/Breakpoint/Watchpoint.h"
 #include "lldb/Breakpoint/WatchpointList.h"
@@ -28,10 +32,6 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
 
-#include "llvm/ADT/StringRef.h"
-
-#include <vector>
-
 using namespace lldb;
 using namespace lldb_private;
 
@@ -47,7 +47,7 @@ AddWatchpointDescription(Stream *s, Watc
 static bool
 CheckTargetForWatchpointOperations(Target *target, CommandReturnObject &result)
 {
-    if (target == NULL)
+    if (target == nullptr)
     {
         result.AppendError ("Invalid target.  No existing target or watchpoints.");
         result.SetStatus (eReturnStatusFailed);
@@ -87,7 +87,7 @@ CommandObjectMultiwordWatchpoint::Verify
     // Pre-condition: args.GetArgumentCount() > 0.
     if (args.GetArgumentCount() == 0)
     {
-        if (target == NULL)
+        if (target == nullptr)
             return false;
         WatchpointSP watch_sp = target->GetLastCreatedWatchpoint();
         if (watch_sp)
@@ -166,10 +166,10 @@ class CommandObjectWatchpointList : publ
 {
 public:
     CommandObjectWatchpointList (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter, 
-                             "watchpoint list",
-                             "List all watchpoints at configurable levels of detail.",
-                             NULL),
+        CommandObjectParsed(interpreter,
+                            "watchpoint list",
+                            "List all watchpoints at configurable levels of detail.",
+                            nullptr),
         m_options(interpreter)
     {
         CommandArgumentEntry arg;
@@ -178,7 +178,7 @@ public:
         m_arguments.push_back(arg);
     }
 
-    ~CommandObjectWatchpointList () override {}
+    ~CommandObjectWatchpointList() override = default;
 
     Options *
     GetOptions () override
@@ -189,14 +189,13 @@ public:
     class CommandOptions : public Options
     {
     public:
-
         CommandOptions (CommandInterpreter &interpreter) :
             Options(interpreter),
             m_level(lldb::eDescriptionLevelBrief) // Watchpoint List defaults to brief descriptions
         {
         }
 
-        ~CommandOptions () override {}
+        ~CommandOptions() override = default;
 
         Error
         SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -235,7 +234,6 @@ public:
             return g_option_table;
         }
 
-
         // Options table: Required for subclasses of Options.
 
         static OptionDefinition g_option_table[];
@@ -250,7 +248,7 @@ protected:
     DoExecute (Args& command, CommandReturnObject &result) override
     {
         Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-        if (target == NULL)
+        if (target == nullptr)
         {
             result.AppendError ("Invalid target. No current target or watchpoints.");
             result.SetStatus (eReturnStatusSuccessFinishNoResult);
@@ -324,19 +322,20 @@ private:
 // CommandObjectWatchpointList::Options
 //-------------------------------------------------------------------------
 #pragma mark List::CommandOptions
+
 OptionDefinition
 CommandObjectWatchpointList::CommandOptions::g_option_table[] =
 {
-    { LLDB_OPT_SET_1, false, "brief",    'b', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
+    { LLDB_OPT_SET_1, false, "brief",    'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
         "Give a brief description of the watchpoint (no location info)."},
 
-    { LLDB_OPT_SET_2, false, "full",    'f', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
+    { LLDB_OPT_SET_2, false, "full",    'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
         "Give a full description of the watchpoint and its locations."},
 
-    { LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone,
+    { LLDB_OPT_SET_3, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
         "Explain everything we know about the watchpoint (for debugging debugger bugs)." },
 
-    { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
+    { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
 };
 
 //-------------------------------------------------------------------------
@@ -348,10 +347,10 @@ class CommandObjectWatchpointEnable : pu
 {
 public:
     CommandObjectWatchpointEnable (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "enable",
-                             "Enable the specified disabled watchpoint(s). If no watchpoints are specified, enable all of them.",
-                             NULL)
+        CommandObjectParsed(interpreter,
+                            "enable",
+                            "Enable the specified disabled watchpoint(s). If no watchpoints are specified, enable all of them.",
+                            nullptr)
     {
         CommandArgumentEntry arg;
         CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@@ -359,7 +358,7 @@ public:
         m_arguments.push_back(arg);
     }
 
-    ~CommandObjectWatchpointEnable () override {}
+    ~CommandObjectWatchpointEnable() override = default;
 
 protected:
     bool
@@ -413,8 +412,6 @@ protected:
 
         return result.Succeeded();
     }
-
-private:
 };
 
 //-------------------------------------------------------------------------
@@ -426,10 +423,10 @@ class CommandObjectWatchpointDisable : p
 {
 public:
     CommandObjectWatchpointDisable (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "watchpoint disable",
-                             "Disable the specified watchpoint(s) without removing it/them.  If no watchpoints are specified, disable them all.",
-                             NULL)
+        CommandObjectParsed(interpreter,
+                            "watchpoint disable",
+                            "Disable the specified watchpoint(s) without removing it/them.  If no watchpoints are specified, disable them all.",
+                            nullptr)
     {
         CommandArgumentEntry arg;
         CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@@ -437,8 +434,7 @@ public:
         m_arguments.push_back(arg);
     }
 
-
-    ~CommandObjectWatchpointDisable () override {}
+    ~CommandObjectWatchpointDisable() override = default;
 
 protected:
     bool
@@ -497,7 +493,6 @@ protected:
 
         return result.Succeeded();
     }
-
 };
 
 //-------------------------------------------------------------------------
@@ -512,7 +507,7 @@ public:
         CommandObjectParsed(interpreter,
                             "watchpoint delete",
                             "Delete the specified watchpoint(s).  If no watchpoints are specified, delete them all.",
-                            NULL)
+                            nullptr)
     {
         CommandArgumentEntry arg;
         CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@@ -520,7 +515,7 @@ public:
         m_arguments.push_back(arg);
     }
 
-    ~CommandObjectWatchpointDelete () override {}
+    ~CommandObjectWatchpointDelete() override = default;
 
 protected:
     bool
@@ -579,7 +574,6 @@ protected:
 
         return result.Succeeded();
     }
-
 };
 
 //-------------------------------------------------------------------------
@@ -590,10 +584,10 @@ class CommandObjectWatchpointIgnore : pu
 {
 public:
     CommandObjectWatchpointIgnore (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "watchpoint ignore",
-                             "Set ignore count on the specified watchpoint(s).  If no watchpoints are specified, set them all.",
-                             NULL),
+        CommandObjectParsed(interpreter,
+                            "watchpoint ignore",
+                            "Set ignore count on the specified watchpoint(s).  If no watchpoints are specified, set them all.",
+                            nullptr),
         m_options (interpreter)
     {
         CommandArgumentEntry arg;
@@ -602,7 +596,7 @@ public:
         m_arguments.push_back(arg);
     }
 
-    ~CommandObjectWatchpointIgnore () override {}
+    ~CommandObjectWatchpointIgnore() override = default;
 
     Options *
     GetOptions () override
@@ -613,14 +607,13 @@ public:
     class CommandOptions : public Options
     {
     public:
-
         CommandOptions (CommandInterpreter &interpreter) :
             Options (interpreter),
             m_ignore_count (0)
         {
         }
 
-        ~CommandOptions () override {}
+        ~CommandOptions() override = default;
 
         Error
         SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -631,12 +624,10 @@ public:
             switch (short_option)
             {
                 case 'i':
-                {
                     m_ignore_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
                     if (m_ignore_count == UINT32_MAX)
                        error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
-                }
-                break;
+                    break;
                 default:
                     error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
                     break;
@@ -657,7 +648,6 @@ public:
             return g_option_table;
         }
 
-
         // Options table: Required for subclasses of Options.
 
         static OptionDefinition g_option_table[];
@@ -724,14 +714,14 @@ private:
 };
 
 #pragma mark Ignore::CommandOptions
+
 OptionDefinition
 CommandObjectWatchpointIgnore::CommandOptions::g_option_table[] =
 {
-    { LLDB_OPT_SET_ALL, true, "ignore-count", 'i', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." },
-    { 0,                false, NULL,            0 , 0,                 NULL, NULL, 0,    eArgTypeNone, NULL }
+    { LLDB_OPT_SET_ALL, true, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Set the number of times this watchpoint is skipped before stopping." },
+    { 0,                false, nullptr,            0 , 0,                 nullptr, nullptr, 0,    eArgTypeNone, nullptr }
 };
 
-
 //-------------------------------------------------------------------------
 // CommandObjectWatchpointModify
 //-------------------------------------------------------------------------
@@ -740,14 +730,13 @@ CommandObjectWatchpointIgnore::CommandOp
 class CommandObjectWatchpointModify : public CommandObjectParsed
 {
 public:
-
     CommandObjectWatchpointModify (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "watchpoint modify", 
-                             "Modify the options on a watchpoint or set of watchpoints in the executable.  "
-                             "If no watchpoint is specified, act on the last created watchpoint.  "
-                             "Passing an empty argument clears the modification.", 
-                             NULL),
+        CommandObjectParsed(interpreter,
+                            "watchpoint modify",
+                            "Modify the options on a watchpoint or set of watchpoints in the executable.  "
+                            "If no watchpoint is specified, act on the last created watchpoint.  "
+                            "Passing an empty argument clears the modification.",
+                            nullptr),
         m_options (interpreter)
     {
         CommandArgumentEntry arg;
@@ -756,7 +745,7 @@ public:
         m_arguments.push_back (arg);   
     }
 
-    ~CommandObjectWatchpointModify () override {}
+    ~CommandObjectWatchpointModify() override = default;
 
     Options *
     GetOptions () override
@@ -767,7 +756,6 @@ public:
     class CommandOptions : public Options
     {
     public:
-
         CommandOptions (CommandInterpreter &interpreter) :
             Options (interpreter),
             m_condition (),
@@ -775,7 +763,7 @@ public:
         {
         }
 
-        ~CommandOptions () override {}
+        ~CommandOptions() override = default;
 
         Error
         SetOptionValue (uint32_t option_idx, const char *option_arg) override
@@ -786,7 +774,7 @@ public:
             switch (short_option)
             {
                 case 'c':
-                    if (option_arg != NULL)
+                    if (option_arg != nullptr)
                         m_condition.assign (option_arg);
                     else
                         m_condition.clear();
@@ -885,11 +873,12 @@ private:
 };
 
 #pragma mark Modify::CommandOptions
+
 OptionDefinition
 CommandObjectWatchpointModify::CommandOptions::g_option_table[] =
 {
-{ LLDB_OPT_SET_ALL, false, "condition",    'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true."},
-{ 0,                false, NULL,            0 , 0,                 NULL, NULL, 0,    eArgTypeNone, NULL }
+{ LLDB_OPT_SET_ALL, false, "condition",    'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "The watchpoint stops only if this condition expression evaluates to true."},
+{ 0,                false, nullptr,            0 , 0,                 nullptr, nullptr, 0,    eArgTypeNone, nullptr }
 };
 
 //-------------------------------------------------------------------------
@@ -900,24 +889,23 @@ CommandObjectWatchpointModify::CommandOp
 class CommandObjectWatchpointSetVariable : public CommandObjectParsed
 {
 public:
-
     CommandObjectWatchpointSetVariable (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "watchpoint set variable",
-                             "Set a watchpoint on a variable. "
-                             "Use the '-w' option to specify the type of watchpoint and "
-                             "the '-x' option to specify the byte size to watch for. "
-                             "If no '-w' option is specified, it defaults to write. "
-                             "If no '-x' option is specified, it defaults to the variable's "
-                             "byte size. "
-                             "Note that there are limited hardware resources for watchpoints. "
-                             "If watchpoint setting fails, consider disable/delete existing ones "
-                             "to free up resources.",
-                             NULL,
-                             eCommandRequiresFrame         |
-                             eCommandTryTargetAPILock      |
-                             eCommandProcessMustBeLaunched |
-                             eCommandProcessMustBePaused   ),
+        CommandObjectParsed(interpreter,
+                            "watchpoint set variable",
+                            "Set a watchpoint on a variable. "
+                            "Use the '-w' option to specify the type of watchpoint and "
+                            "the '-x' option to specify the byte size to watch for. "
+                            "If no '-w' option is specified, it defaults to write. "
+                            "If no '-x' option is specified, it defaults to the variable's "
+                            "byte size. "
+                            "Note that there are limited hardware resources for watchpoints. "
+                            "If watchpoint setting fails, consider disable/delete existing ones "
+                            "to free up resources.",
+                            nullptr,
+                            eCommandRequiresFrame         |
+                            eCommandTryTargetAPILock      |
+                            eCommandProcessMustBeLaunched |
+                            eCommandProcessMustBePaused   ),
         m_option_group (interpreter),
         m_option_watchpoint ()
     {
@@ -949,7 +937,7 @@ corresponding to the byte size of the da
         m_option_group.Finalize();
     }
 
-    ~CommandObjectWatchpointSetVariable () override {}
+    ~CommandObjectWatchpointSetVariable() override = default;
 
     Options *
     GetOptions () override
@@ -1055,7 +1043,7 @@ protected:
         }
         else
         {
-            const char *error_cstr = error.AsCString(NULL);
+            const char *error_cstr = error.AsCString(nullptr);
             if (error_cstr)
                 result.GetErrorStream().Printf("error: %s\n", error_cstr);
             else
@@ -1089,7 +1077,7 @@ protected:
         {
             result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRIu64 ", variable expression='%s').\n",
                                          addr, (uint64_t)size, command.GetArgumentAtIndex(0));
-            if (error.AsCString(NULL))
+            if (error.AsCString(nullptr))
                 result.AppendError(error.AsCString());
             result.SetStatus(eReturnStatusFailed);
         }
@@ -1110,24 +1098,23 @@ private:
 class CommandObjectWatchpointSetExpression : public CommandObjectRaw
 {
 public:
-
     CommandObjectWatchpointSetExpression (CommandInterpreter &interpreter) :
-        CommandObjectRaw (interpreter,
-                          "watchpoint set expression",
-                          "Set a watchpoint on an address by supplying an expression. "
-                          "Use the '-w' option to specify the type of watchpoint and "
-                          "the '-x' option to specify the byte size to watch for. "
-                          "If no '-w' option is specified, it defaults to write. "
-                          "If no '-x' option is specified, it defaults to the target's "
-                          "pointer byte size. "
-                          "Note that there are limited hardware resources for watchpoints. "
-                          "If watchpoint setting fails, consider disable/delete existing ones "
-                          "to free up resources.",
-                          NULL,
-                          eCommandRequiresFrame         |
-                          eCommandTryTargetAPILock      |
-                          eCommandProcessMustBeLaunched |
-                          eCommandProcessMustBePaused   ),
+        CommandObjectRaw(interpreter,
+                         "watchpoint set expression",
+                         "Set a watchpoint on an address by supplying an expression. "
+                         "Use the '-w' option to specify the type of watchpoint and "
+                         "the '-x' option to specify the byte size to watch for. "
+                         "If no '-w' option is specified, it defaults to write. "
+                         "If no '-x' option is specified, it defaults to the target's "
+                         "pointer byte size. "
+                         "Note that there are limited hardware resources for watchpoints. "
+                         "If watchpoint setting fails, consider disable/delete existing ones "
+                         "to free up resources.",
+                         nullptr,
+                         eCommandRequiresFrame         |
+                         eCommandTryTargetAPILock      |
+                         eCommandProcessMustBeLaunched |
+                         eCommandProcessMustBePaused   ),
         m_option_group (interpreter),
         m_option_watchpoint ()
     {
@@ -1158,8 +1145,7 @@ Examples:
         m_option_group.Finalize();
     }
 
-
-    ~CommandObjectWatchpointSetExpression () override {}
+    ~CommandObjectWatchpointSetExpression() override = default;
 
     // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
     bool
@@ -1181,11 +1167,11 @@ protected:
         StackFrame *frame = m_exe_ctx.GetFramePtr();
 
         Args command(raw_command);
-        const char *expr = NULL;
+        const char *expr = nullptr;
         if (raw_command[0] == '-')
         {
             // We have some options and these options MUST end with --.
-            const char *end_options = NULL;
+            const char *end_options = nullptr;
             const char *s = raw_command;
             while (s && s[0])
             {
@@ -1220,7 +1206,7 @@ protected:
             }
         }
 
-        if (expr == NULL)
+        if (expr == nullptr)
             expr = raw_command;
 
         // If no argument is present, issue an error message.  There's no way to set a watchpoint.
@@ -1300,7 +1286,7 @@ protected:
         {
             result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRIu64 ").\n",
                                          addr, (uint64_t)size);
-            if (error.AsCString(NULL))
+            if (error.AsCString(nullptr))
                 result.AppendError(error.AsCString());
             result.SetStatus(eReturnStatusFailed);
         }
@@ -1321,7 +1307,6 @@ private:
 class CommandObjectWatchpointSet : public CommandObjectMultiword
 {
 public:
-
     CommandObjectWatchpointSet (CommandInterpreter &interpreter) :
         CommandObjectMultiword (interpreter,
                                 "watchpoint set",
@@ -1333,9 +1318,7 @@ public:
         LoadSubCommand ("expression", CommandObjectSP (new CommandObjectWatchpointSetExpression (interpreter)));
     }
 
-
-    ~CommandObjectWatchpointSet () override {}
-
+    ~CommandObjectWatchpointSet() override = default;
 };
 
 //-------------------------------------------------------------------------
@@ -1377,7 +1360,4 @@ CommandObjectMultiwordWatchpoint::Comman
     LoadSubCommand ("set",        set_command_object);
 }
 
-CommandObjectMultiwordWatchpoint::~CommandObjectMultiwordWatchpoint()
-{
-}
-
+CommandObjectMultiwordWatchpoint::~CommandObjectMultiwordWatchpoint() = default;




More information about the lldb-commits mailing list