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

llvm-svn: 263289
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index 7230011..130fa02 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -38,8 +38,14 @@
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/ThreadPlan.h"
-
-
+#ifndef LLDB_DISABLE_CURSES
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/VariableList.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/StackFrame.h"
+#endif
 
 using namespace lldb;
 using namespace lldb_private;
@@ -67,7 +73,7 @@
     m_popped (false),
     m_flags (flags),
     m_type (type),
-    m_user_data (NULL),
+    m_user_data(nullptr),
     m_done (false),
     m_active (false)
 {
@@ -83,49 +89,37 @@
 int
 IOHandler::GetInputFD()
 {
-    if (m_input_sp)
-        return m_input_sp->GetFile().GetDescriptor();
-    return -1;
+    return (m_input_sp ? m_input_sp->GetFile().GetDescriptor() : -1);
 }
 
 int
 IOHandler::GetOutputFD()
 {
-    if (m_output_sp)
-        return m_output_sp->GetFile().GetDescriptor();
-    return -1;
+    return (m_output_sp ? m_output_sp->GetFile().GetDescriptor() : -1);
 }
 
 int
 IOHandler::GetErrorFD()
 {
-    if (m_error_sp)
-        return m_error_sp->GetFile().GetDescriptor();
-    return -1;
+    return (m_error_sp ? m_error_sp->GetFile().GetDescriptor() : -1);
 }
 
 FILE *
 IOHandler::GetInputFILE()
 {
-    if (m_input_sp)
-        return m_input_sp->GetFile().GetStream();
-    return NULL;
+    return (m_input_sp ? m_input_sp->GetFile().GetStream() : nullptr);
 }
 
 FILE *
 IOHandler::GetOutputFILE()
 {
-    if (m_output_sp)
-        return m_output_sp->GetFile().GetStream();
-    return NULL;
+    return (m_output_sp ? m_output_sp->GetFile().GetStream() : nullptr);
 }
 
 FILE *
 IOHandler::GetErrorFILE()
 {
-    if (m_error_sp)
-        return m_error_sp->GetFile().GetStream();
-    return NULL;
+    return (m_error_sp ? m_error_sp->GetFile().GetStream() : nullptr);
 }
 
 StreamFileSP &
@@ -186,9 +180,9 @@
                                     bool default_response) :
     IOHandlerEditline(debugger,
                       IOHandler::Type::Confirm,
-                      NULL,     // NULL editline_name means no history loaded/saved
-                      NULL,     // No prompt
-                      NULL,     // No continuation prompt
+                      nullptr,  // nullptr editline_name means no history loaded/saved
+                      nullptr,  // No prompt
+                      nullptr,  // No continuation prompt
                       false,    // Multi-line
                       false,    // Don't colorize the prompt (i.e. the confirm message.)
                       0,
@@ -204,7 +198,6 @@
         prompt_stream.Printf(": [y/N] ");
     
     SetPrompt (prompt_stream.GetString().c_str());
-    
 }
 
 IOHandlerConfirm::~IOHandlerConfirm() = default;
@@ -304,14 +297,14 @@
                 --word_start;
             while (word_start > current_line && !isspace(*word_start))
                 --word_start;
-            CommandCompletions::InvokeCommonCompletionCallbacks (io_handler.GetDebugger().GetCommandInterpreter(),
-                                                                 CommandCompletions::eVariablePathCompletion,
-                                                                 word_start,
-                                                                 skip_first_n_matches,
-                                                                 max_matches,
-                                                                 NULL,
-                                                                 word_complete,
-                                                                 matches);
+            CommandCompletions::InvokeCommonCompletionCallbacks(io_handler.GetDebugger().GetCommandInterpreter(),
+                                                                CommandCompletions::eVariablePathCompletion,
+                                                                word_start,
+                                                                skip_first_n_matches,
+                                                                max_matches,
+                                                                nullptr,
+                                                                word_complete,
+                                                                matches);
             
             size_t num_matches = matches.GetSize();
             if (num_matches > 0)
@@ -382,7 +375,7 @@
     m_delegate (delegate),
     m_prompt (),
     m_continuation_prompt(),
-    m_current_lines_ptr (NULL),
+    m_current_lines_ptr(nullptr),
     m_base_line_number (line_number_start),
     m_curr_line_idx (UINT32_MAX),
     m_multi_line (multi_line),
@@ -460,12 +453,12 @@
         {
             if (GetIsInteractive())
             {
-                const char *prompt = NULL;
+                const char *prompt = nullptr;
                 
                 if (m_multi_line && m_curr_line_idx > 0)
                     prompt = GetContinuationPrompt();
                 
-                if (prompt == NULL)
+                if (prompt == nullptr)
                     prompt = GetPrompt();
                 
                 if (prompt && prompt[0])
@@ -484,7 +477,7 @@
             m_editing = true;
             while (!done)
             {
-                if (fgets(buffer, sizeof(buffer), in) == NULL)
+                if (fgets(buffer, sizeof(buffer), in) == nullptr)
                 {
                     const int saved_errno = errno;
                     if (feof(in))
@@ -532,7 +525,6 @@
 #endif
 }
 
-
 #ifndef LLDB_DISABLE_LIBEDIT
 bool
 IOHandlerEditline::IsInputCompleteCallback (Editline *editline,
@@ -587,7 +579,7 @@
     {
 #endif
         if (m_prompt.empty())
-            return NULL;
+            return nullptr;
 #ifndef LLDB_DISABLE_LIBEDIT
     }
 #endif
@@ -603,7 +595,7 @@
         m_prompt.clear();
 #ifndef LLDB_DISABLE_LIBEDIT
     if (m_editline_ap)
-        m_editline_ap->SetPrompt (m_prompt.empty() ? NULL : m_prompt.c_str());
+        m_editline_ap->SetPrompt(m_prompt.empty() ? nullptr : m_prompt.c_str());
 #endif
     return true;
 }
@@ -611,9 +603,7 @@
 const char *
 IOHandlerEditline::GetContinuationPrompt ()
 {
-    if (m_continuation_prompt.empty())
-        return NULL;
-    return m_continuation_prompt.c_str();
+    return (m_continuation_prompt.empty() ? nullptr : m_continuation_prompt.c_str());
 }
 
 void
@@ -626,7 +616,7 @@
 
 #ifndef LLDB_DISABLE_LIBEDIT
     if (m_editline_ap)
-        m_editline_ap->SetContinuationPrompt (m_continuation_prompt.empty() ? NULL : m_continuation_prompt.c_str());
+        m_editline_ap->SetContinuationPrompt(m_continuation_prompt.empty() ? nullptr : m_continuation_prompt.c_str());
 #endif
 }
 
@@ -671,7 +661,7 @@
             {
                 FILE *out = GetOutputFILE();
                 if (out)
-                    ::fprintf(out, "%u%s", m_base_line_number + (uint32_t)lines.GetSize(), GetPrompt() == NULL ? " " : "");
+                    ::fprintf(out, "%u%s", m_base_line_number + (uint32_t)lines.GetSize(), GetPrompt() == nullptr ? " " : "");
             }
             
             m_curr_line_idx = lines.GetSize();
@@ -790,13 +780,6 @@
 // for instance, windows
 #ifndef LLDB_DISABLE_CURSES
 
-#include "lldb/Core/ValueObject.h"
-#include "lldb/Symbol/VariableList.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/Thread.h"
-#include "lldb/Target/StackFrame.h"
-
 #define KEY_RETURN   10
 #define KEY_ESCAPE  27
 
@@ -1078,13 +1061,13 @@
         virtual const char *
         WindowDelegateGetHelpText ()
         {
-            return NULL;
+            return nullptr;
         }
 
         virtual KeyHelp *
         WindowDelegateGetKeyHelp ()
         {
-            return NULL;
+            return nullptr;
         }
     };
     
@@ -1124,9 +1107,9 @@
     public:
         Window (const char *name) :
             m_name (name),
-            m_window (NULL),
-            m_panel (NULL),
-            m_parent (NULL),
+            m_window(nullptr),
+            m_panel(nullptr),
+            m_parent(nullptr),
             m_subwindows (),
             m_delegate_sp (),
             m_curr_active_window_idx (UINT32_MAX),
@@ -1140,9 +1123,9 @@
         
         Window (const char *name, WINDOW *w, bool del = true) :
             m_name (name),
-            m_window (NULL),
-            m_panel (NULL),
-            m_parent (NULL),
+            m_window(nullptr),
+            m_panel(nullptr),
+            m_parent(nullptr),
             m_subwindows (),
             m_delegate_sp (),
             m_curr_active_window_idx (UINT32_MAX),
@@ -1158,8 +1141,8 @@
         
         Window (const char *name, const Rect &bounds) :
             m_name (name),
-            m_window (NULL),
-            m_parent (NULL),
+            m_window(nullptr),
+            m_parent(nullptr),
             m_subwindows (),
             m_delegate_sp (),
             m_curr_active_window_idx (UINT32_MAX),
@@ -1180,7 +1163,7 @@
         }
         
         void
-        Reset (WINDOW *w = NULL, bool del = true)
+        Reset(WINDOW *w = nullptr, bool del = true)
         {
             if (m_window == w)
                 return;
@@ -1188,12 +1171,12 @@
             if (m_panel)
             {
                 ::del_panel (m_panel);
-                m_panel = NULL;
+                m_panel = nullptr;
             }
             if (m_window && m_delete)
             {
                 ::delwin (m_window);
-                m_window = NULL;
+                m_window = nullptr;
                 m_delete = false;
             }
             if (w)
@@ -1415,7 +1398,7 @@
         // Window drawing utilities
         //----------------------------------------------------------------------
         void
-        DrawTitleBox (const char *title, const char *bottom_message = NULL)
+        DrawTitleBox(const char *title, const char *bottom_message = nullptr)
         {
             attr_t attr = 0;
             if (IsActive())
@@ -1456,7 +1439,6 @@
             }
             if (attr)
                 AttributeOff(attr);
-            
         }
 
         virtual void
@@ -1554,7 +1536,7 @@
             Windows subwindows (m_subwindows);
             for (auto subwindow_sp : subwindows)
             {
-                if (subwindow_sp->m_can_activate == false)
+                if (!subwindow_sp->m_can_activate)
                 {
                     HandleCharResult result = subwindow_sp->HandleChar(key);
                     if (result != eKeyNotHandled)
@@ -1569,7 +1551,7 @@
         SetActiveWindow (Window *window)
         {
             const size_t num_subwindows = m_subwindows.size();
-            for (size_t i=0; i<num_subwindows; ++i)
+            for (size_t i = 0; i < num_subwindows; ++i)
             {
                 if (m_subwindows[i].get() == window)
                 {
@@ -1601,7 +1583,7 @@
                         
                         // Find first window that wants to be active if this window is active
                         const size_t num_subwindows = m_subwindows.size();
-                        for (size_t i=0; i<num_subwindows; ++i)
+                        for (size_t i = 0; i < num_subwindows; ++i)
                         {
                             if (m_subwindows[i]->GetCanBeActive())
                             {
@@ -1944,7 +1926,7 @@
         m_max_submenu_name_length (0),
         m_max_submenu_key_name_length (0),
         m_selected (0),
-        m_parent (NULL),
+        m_parent(nullptr),
         m_submenus (),
         m_canned_result (MenuActionResult::NotHandled),
         m_delegate_sp()
@@ -1965,7 +1947,7 @@
         m_max_submenu_name_length (0),
         m_max_submenu_key_name_length (0),
         m_selected (0),
-        m_parent (NULL),
+        m_parent(nullptr),
         m_submenus (),
         m_canned_result (MenuActionResult::NotHandled),
         m_delegate_sp()
@@ -1990,7 +1972,7 @@
         m_max_submenu_key_name_length = 0;
         Menus &submenus = GetSubmenus();
         const size_t num_submenus = submenus.size();
-        for (size_t i=0; i<num_submenus; ++i)
+        for (size_t i = 0; i < num_submenus; ++i)
         {
             Menu *submenu = submenus[i].get();
             if (static_cast<size_t>(m_max_submenu_name_length) < submenu->m_name.size())
@@ -2022,7 +2004,7 @@
             if (width > 2)
             {
                 width -= 2;
-                for (int i=0; i< width; ++i)
+                for (int i = 0; i < width; ++i)
                     window.PutChar(ACS_HLINE);
             }
             window.PutChar(ACS_RTEE);
@@ -2097,7 +2079,7 @@
             {
                 window.SetBackground(2);
                 window.MoveCursor(0, 0);
-                for (size_t i=0; i<num_submenus; ++i)
+                for (size_t i = 0; i < num_submenus; ++i)
                 {
                     Menu *menu = submenus[i].get();
                     if (i > 0)
@@ -2121,7 +2103,7 @@
                 window.Erase();
                 window.SetBackground(2);
                 window.Box();
-                for (size_t i=0; i<num_submenus; ++i)
+                for (size_t i = 0; i < num_submenus; ++i)
                 {
                     const bool is_selected =
                       (i == static_cast<size_t>(selected_idx));
@@ -2171,7 +2153,6 @@
                     break;
                     
                 case KEY_RIGHT:
-                {
                     ++m_selected;
                     if (m_selected >= static_cast<int>(num_submenus))
                         m_selected = 0;
@@ -2180,11 +2161,9 @@
                     else if (!submenus.empty())
                         run_menu_sp = submenus.front();
                     result = eKeyHandled;
-                }
                     break;
                     
                 case KEY_LEFT:
-                {
                     --m_selected;
                     if (m_selected < 0)
                         m_selected = num_submenus - 1;
@@ -2193,11 +2172,10 @@
                     else if (!submenus.empty())
                         run_menu_sp = submenus.front();
                     result = eKeyHandled;
-                }
                     break;
                     
                 default:
-                    for (size_t i=0; i<num_submenus; ++i)
+                    for (size_t i = 0; i < num_submenus; ++i)
                     {
                         if (submenus[i]->GetKeyValue() == key)
                         {
@@ -2285,8 +2263,7 @@
                     return eKeyHandled;
                     
                 default:
-                {
-                    for (size_t i=0; i<num_submenus; ++i)
+                    for (size_t i = 0; i < num_submenus; ++i)
                     {
                         Menu *menu = submenus[i].get();
                         if (menu->GetKeyValue() == key)
@@ -2298,9 +2275,7 @@
                             return eKeyHandled;
                         }
                     }
-                }
                     break;
-                    
             }
         }
         else if (menu_type == Menu::Type::Separator)
@@ -2314,11 +2289,10 @@
     public:
         Application (FILE *in, FILE *out) :
             m_window_sp(),
-            m_screen (NULL),
+            m_screen(nullptr),
             m_in (in),
             m_out (out)
         {
-            
         }
         
         ~Application ()
@@ -2328,7 +2302,7 @@
             if (m_screen)
             {
                 ::delscreen(m_screen);
-                m_screen = NULL;
+                m_screen = nullptr;
             }
         }
         
@@ -2340,7 +2314,7 @@
 #if 0
             ::initscr();
 #else
-            m_screen = ::newterm(NULL, m_out, m_in);
+            m_screen = ::newterm(nullptr, m_out, m_in);
 #endif
             ::start_color();
             ::curs_set(0);
@@ -2457,7 +2431,7 @@
                                     ConstString broadcaster_class (broadcaster->GetBroadcasterClass());
                                     if (broadcaster_class == broadcaster_class_process)
                                     {
-                                        debugger.GetCommandInterpreter().UpdateExecutionContext(NULL);
+                                        debugger.GetCommandInterpreter().UpdateExecutionContext(nullptr);
                                         update = true;
                                         continue; // Don't get any key, just update our view
                                     }
@@ -2472,7 +2446,7 @@
                     switch (key_result)
                     {
                         case eKeyHandled:
-                            debugger.GetCommandInterpreter().UpdateExecutionContext(NULL);
+                            debugger.GetCommandInterpreter().UpdateExecutionContext(nullptr);
                             update = true;
                             break;
                         case eKeyNotHandled:
@@ -2556,7 +2530,7 @@
             if (valobj)
             {
                 const size_t num_children = valobj->GetNumChildren();
-                for (size_t i=0; i<num_children; ++i)
+                for (size_t i = 0; i < num_children; ++i)
                 {
                     children.push_back(Row (valobj->GetChildAtIndex(i, true), this));
                 }
@@ -2646,7 +2620,7 @@
 class TreeDelegate
 {
 public:
-    TreeDelegate() {}
+    TreeDelegate() = default;
     virtual ~TreeDelegate() = default;
 
     virtual void TreeDelegateDrawTreeItem (TreeItem &item, Window &window) = 0;
@@ -2659,11 +2633,10 @@
 class TreeItem
 {
 public:
-    
     TreeItem (TreeItem *parent, TreeDelegate &delegate, bool might_have_children) :
         m_parent (parent),
         m_delegate (delegate),
-        m_user_data (NULL),
+        m_user_data(nullptr),
         m_identifier (0),
         m_row_idx (-1),
         m_children (),
@@ -2751,7 +2724,7 @@
         // The root item must calculate its children,
         // or we must calculate the number of children
         // if the item is expanded
-        if (m_parent == NULL || expanded)
+        if (m_parent == nullptr || expanded)
             GetNumChildren();
         
         for (auto &item : m_children)
@@ -2849,7 +2822,7 @@
             {
                 // If we displayed all the rows and item.Draw() returns
                 // false we are done drawing and can exit this for loop
-                if (item.Draw(window, first_visible_row, selected_row_idx, row_idx, num_rows_left) == false)
+                if (!item.Draw(window, first_visible_row, selected_row_idx, row_idx, num_rows_left))
                     break;
             }
         }
@@ -2897,7 +2870,7 @@
         if (static_cast<uint32_t>(m_row_idx) == row_idx)
             return this;
         if (m_children.empty())
-            return NULL;
+            return nullptr;
         if (IsExpanded())
         {
             for (auto &item : m_children)
@@ -2907,7 +2880,7 @@
                     return selected_item_ptr;
             }
         }
-        return NULL;
+        return nullptr;
     }
     
     void *
@@ -2957,8 +2930,8 @@
     TreeWindowDelegate (Debugger &debugger, const TreeDelegateSP &delegate_sp) :
         m_debugger (debugger),
         m_delegate_sp (delegate_sp),
-        m_root (NULL, *delegate_sp, true),
-        m_selected_item (NULL),
+        m_root(nullptr, *delegate_sp, true),
+        m_selected_item(nullptr),
         m_num_rows (0),
         m_selected_row_idx (0),
         m_first_visible_row (0),
@@ -3031,12 +3004,11 @@
         }
         else
         {
-            m_selected_item = NULL;
+            m_selected_item = nullptr;
         }
         
         window.DeferredRefresh();
-        
-        
+
         return true; // Drawing handled
     }
 
@@ -3060,7 +3032,7 @@
             { ' ', "Toggle item expansion" },
             { ',', "Page up" },
             { '.', "Page down" },
-            { '\0', NULL }
+            { '\0', nullptr }
         };
         return g_source_view_key_help;
     }
@@ -3205,7 +3177,7 @@
                 StreamString strm;
                 const SymbolContext &sc = frame_sp->GetSymbolContext(eSymbolContextEverything);
                 ExecutionContext exe_ctx (frame_sp);
-                if (FormatEntity::Format(m_format, strm, &sc, &exe_ctx, NULL, NULL, false, false))
+                if (FormatEntity::Format(m_format, strm, &sc, &exe_ctx, nullptr, nullptr, false, false))
                 {
                     int right_pad = 1;
                     window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
@@ -3276,7 +3248,7 @@
         {
             StreamString strm;
             ExecutionContext exe_ctx (thread_sp);
-            if (FormatEntity::Format (m_format, strm, NULL, &exe_ctx, NULL, NULL, false, false))
+            if (FormatEntity::Format(m_format, strm, nullptr, &exe_ctx, nullptr, nullptr, false, false))
             {
                 int right_pad = 1;
                 window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
@@ -3310,7 +3282,7 @@
                     TreeItem t (&item, *m_frame_delegate_sp, false);
                     size_t num_frames = thread_sp->GetStackFrameCount();
                     item.Resize (num_frames, t);
-                    for (size_t i=0; i<num_frames; ++i)
+                    for (size_t i = 0; i < num_frames; ++i)
                     {
                         item[i].SetUserData(thread_sp.get());
                         item[i].SetIdentifier(i);
@@ -3385,7 +3357,7 @@
         {
             StreamString strm;
             ExecutionContext exe_ctx (process_sp);
-            if (FormatEntity::Format (m_format, strm, NULL, &exe_ctx, NULL, NULL, false, false))
+            if (FormatEntity::Format(m_format, strm, nullptr, &exe_ctx, nullptr, nullptr, false, false))
             {
                 int right_pad = 1;
                 window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
@@ -3420,7 +3392,7 @@
                 Mutex::Locker locker (threads.GetMutex());
                 size_t num_threads = threads.GetSize();
                 item.Resize (num_threads, t);
-                for (size_t i=0; i<num_threads; ++i)
+                for (size_t i = 0; i < num_threads; ++i)
                 {
                     item[i].SetIdentifier(threads.GetThreadAtIndex(i)->GetID());
                     item[i].SetMightHaveChildren(true);
@@ -3450,7 +3422,7 @@
     ValueObjectListDelegate () :
         m_valobj_list (),
         m_rows (),
-        m_selected_row (NULL),
+        m_selected_row(nullptr),
         m_selected_row_idx (0),
         m_first_visible_row (0),
         m_num_rows (0),
@@ -3462,7 +3434,7 @@
     ValueObjectListDelegate (ValueObjectList &valobj_list) :
         m_valobj_list (valobj_list),
         m_rows (),
-        m_selected_row (NULL),
+        m_selected_row(nullptr),
         m_selected_row_idx (0),
         m_first_visible_row (0),
         m_num_rows (0),
@@ -3477,15 +3449,15 @@
     void
     SetValues (ValueObjectList &valobj_list)
     {
-        m_selected_row = NULL;
+        m_selected_row = nullptr;
         m_selected_row_idx = 0;
         m_first_visible_row = 0;
         m_num_rows = 0;
         m_rows.clear();
         m_valobj_list = valobj_list;
         const size_t num_values = m_valobj_list.GetSize();
-        for (size_t i=0; i<num_values; ++i)
-            m_rows.push_back(Row(m_valobj_list.GetValueObjectAtIndex(i), NULL));
+        for (size_t i = 0; i < num_values; ++i)
+            m_rows.push_back(Row(m_valobj_list.GetValueObjectAtIndex(i), nullptr));
     }
     
     bool
@@ -3560,7 +3532,7 @@
             { ' ', "Toggle item expansion" },
             { ',', "Page up" },
             { '.', "Page down" },
-            { '\0', NULL }
+            { '\0', nullptr }
         };
         return g_source_view_key_help;
     }
@@ -3713,10 +3685,10 @@
     {
         ValueObject *valobj = row.valobj.get();
         
-        if (valobj == NULL)
+        if (valobj == nullptr)
             return false;
     
-        const char *type_name = options.show_types ? valobj->GetTypeName().GetCString() : NULL;
+        const char *type_name = options.show_types ? valobj->GetTypeName().GetCString() : nullptr;
         const char *name = valobj->GetName().GetCString();
         const char *value = valobj->GetValueAsCString ();
         const char *summary = valobj->GetSummaryAsCString ();
@@ -3844,7 +3816,7 @@
                 }
             }
         }
-        return NULL;
+        return nullptr;
     }
     
     Row *
@@ -3868,7 +3840,7 @@
     FrameVariablesWindowDelegate (Debugger &debugger) :
         ValueObjectListDelegate (),
         m_debugger (debugger),
-        m_frame_block (NULL)
+        m_frame_block(nullptr)
     {
     }
 
@@ -3885,8 +3857,8 @@
     {
         ExecutionContext exe_ctx (m_debugger.GetCommandInterpreter().GetExecutionContext());
         Process *process = exe_ctx.GetProcessPtr();
-        Block *frame_block = NULL;
-        StackFrame *frame = NULL;
+        Block *frame_block = nullptr;
+        StackFrame *frame = nullptr;
         
         if (process)
         {
@@ -3916,7 +3888,7 @@
                 {
                     const DynamicValueType use_dynamic = eDynamicDontRunTarget;
                     const size_t num_locals = locals->GetSize();
-                    for (size_t i=0; i<num_locals; ++i)
+                    for (size_t i = 0; i < num_locals; ++i)
                     {
                         ValueObjectSP value_sp = frame->GetValueObjectForFrameVariable (locals->GetVariableAtIndex(i), use_dynamic);
                         if (value_sp)
@@ -3926,7 +3898,6 @@
                                 local_values.Append(synthetic_value_sp);
                             else
                                 local_values.Append(value_sp);
-
                         }
                     }
                     // Update the values
@@ -3936,7 +3907,7 @@
         }
         else
         {
-            m_frame_block = NULL;
+            m_frame_block = nullptr;
             // Update the values with an empty list if there is no frame
             SetValues(local_values);
         }
@@ -4121,7 +4092,7 @@
                 snprintf(g_desc, sizeof(g_desc), "\\x%2.2x", ch);
             return g_desc;
     }
-    return NULL;
+    return nullptr;
 }
 
 HelpDialogDelegate::HelpDialogDelegate (const char *text, KeyHelp *key_help_array) :
@@ -4328,7 +4299,7 @@
             { KEY_RIGHT, "Expand" },
             { KEY_PPAGE, "Page up" },
             { KEY_NPAGE, "Page down" },
-            { '\0', NULL }
+            { '\0', nullptr }
         };
         return g_source_view_key_help;
     }
@@ -4439,7 +4410,7 @@
                         ThreadList &threads = process->GetThreadList();
                         Mutex::Locker locker (threads.GetMutex());
                         size_t num_threads = threads.GetSize();
-                        for (size_t i=0; i<num_threads; ++i)
+                        for (size_t i = 0; i < num_threads; ++i)
                         {
                             ThreadSP thread_sp = threads.GetThreadAtIndex(i);
                             char menu_char = '\0';
@@ -4456,7 +4427,7 @@
                                 if (queue_name && queue_name[0])
                                     thread_menu_title.Printf (" %s", queue_name);
                             }
-                            menu.AddSubmenu (MenuSP (new Menu(thread_menu_title.GetString().c_str(), NULL, menu_char, thread_sp->GetID())));
+                            menu.AddSubmenu(MenuSP(new Menu(thread_menu_title.GetString().c_str(), nullptr, menu_char, thread_sp->GetID())));
                         }
                     }
                     else if (submenus.size() > 7)
@@ -4629,7 +4600,7 @@
             if (StateIsStoppedState(state, true))
             {
                 StreamString strm;
-                if (thread && FormatEntity::Format (m_format, strm, NULL, &exe_ctx, NULL, NULL, false, false))
+                if (thread && FormatEntity::Format(m_format, strm, nullptr, &exe_ctx, nullptr, nullptr, false, false))
                 {
                     window.MoveCursor (40, 0);
                     window.PutCStringTruncated(strm.GetString().c_str(), 1);
@@ -4666,7 +4637,7 @@
         m_debugger (debugger),
         m_sc (),
         m_file_sp (),
-        m_disassembly_scope (NULL),
+        m_disassembly_scope(nullptr),
         m_disassembly_sp (),
         m_disassembly_range (),
         m_title (),
@@ -4725,7 +4696,7 @@
             { 'S', "Step in (single instruction)" },
             { ',', "Page up" },
             { '.', "Page down" },
-            { '\0', NULL }
+            { '\0', nullptr }
         };
         return g_source_view_key_help;
     }
@@ -4735,7 +4706,7 @@
     {
         ExecutionContext exe_ctx = m_debugger.GetCommandInterpreter().GetExecutionContext();
         Process *process = exe_ctx.GetProcessPtr();
-        Thread *thread = NULL;
+        Thread *thread = nullptr;
 
         bool update_location = false;
         if (process)
@@ -4870,7 +4841,7 @@
                         if (m_disassembly_scope != m_sc.function)
                         {
                             m_disassembly_scope = m_sc.function;
-                            m_disassembly_sp = m_sc.function->GetInstructions (exe_ctx, NULL, prefer_file_cache);
+                            m_disassembly_sp = m_sc.function->GetInstructions(exe_ctx, nullptr, prefer_file_cache);
                             if (m_disassembly_sp)
                             {
                                 set_selected_line_to_pc = true;
@@ -4891,7 +4862,7 @@
                         if (m_disassembly_scope != m_sc.symbol)
                         {
                             m_disassembly_scope = m_sc.symbol;
-                            m_disassembly_sp = m_sc.symbol->GetInstructions (exe_ctx, NULL, prefer_file_cache);
+                            m_disassembly_sp = m_sc.symbol->GetInstructions(exe_ctx, nullptr, prefer_file_cache);
                             if (m_disassembly_sp)
                             {
                                 set_selected_line_to_pc = true;
@@ -4965,7 +4936,7 @@
             const attr_t selected_highlight_attr = A_REVERSE;
             const attr_t pc_highlight_attr = COLOR_PAIR(1);
 
-            for (size_t i=0; i<num_visible_lines; ++i)
+            for (size_t i = 0; i < num_visible_lines; ++i)
             {
                 const uint32_t curr_line = m_first_visible_line + i;
                 if (curr_line < num_source_lines)
@@ -5095,7 +5066,7 @@
                         m_first_visible_line = pc_idx - non_visible_pc_offset;
                 }
 
-                for (size_t i=0; i<num_visible_lines; ++i)
+                for (size_t i = 0; i < num_visible_lines; ++i)
                 {
                     const uint32_t inst_idx = m_first_visible_line + i;
                     Instruction *inst = insts.GetInstructionAtIndex(inst_idx).get();
@@ -5141,20 +5112,20 @@
                     const char *operands = inst->GetOperands(&exe_ctx);
                     const char *comment = inst->GetComment(&exe_ctx);
 
-                    if (mnemonic && mnemonic[0] == '\0')
-                        mnemonic = NULL;
-                    if (operands && operands[0] == '\0')
-                        operands = NULL;
-                    if (comment && comment[0] == '\0')
-                        comment = NULL;
+                    if (mnemonic != nullptr && mnemonic[0] == '\0')
+                        mnemonic = nullptr;
+                    if (operands != nullptr && operands[0] == '\0')
+                        operands = nullptr;
+                    if (comment != nullptr && comment[0] == '\0')
+                        comment = nullptr;
 
                     strm.Clear();
 
-                    if (mnemonic && operands && comment)
+                    if (mnemonic != nullptr && operands != nullptr && comment != nullptr)
                         strm.Printf ("%-8s %-25s ; %s", mnemonic, operands, comment);
-                    else if (mnemonic && operands)
+                    else if (mnemonic != nullptr && operands != nullptr)
                         strm.Printf ("%-8s %s", mnemonic, operands);
-                    else if (mnemonic)
+                    else if (mnemonic != nullptr)
                         strm.Printf ("%s", mnemonic);
 
                     int right_pad = 1;
@@ -5275,15 +5246,15 @@
                     ExecutionContext exe_ctx = m_debugger.GetCommandInterpreter().GetExecutionContext();
                     if (exe_ctx.HasProcessScope() && exe_ctx.GetProcessRef().IsAlive())
                     {
-                        BreakpointSP bp_sp = exe_ctx.GetTargetRef().CreateBreakpoint (NULL,                      // Don't limit the breakpoint to certain modules
-                                                                                      m_file_sp->GetFileSpec(),  // Source file
-                                                                                      m_selected_line + 1,       // Source line number (m_selected_line is zero based)
-                                                                                      0,                         // No offset
-                                                                                      eLazyBoolCalculate,        // Check inlines using global setting
-                                                                                      eLazyBoolCalculate,        // Skip prologue using global setting,
-                                                                                      false,                     // internal
-                                                                                      false,                     // request_hardware
-                                                                                      eLazyBoolCalculate);       // move_to_nearest_code
+                        BreakpointSP bp_sp = exe_ctx.GetTargetRef().CreateBreakpoint(nullptr,                   // Don't limit the breakpoint to certain modules
+                                                                                     m_file_sp->GetFileSpec(),  // Source file
+                                                                                     m_selected_line + 1,       // Source line number (m_selected_line is zero based)
+                                                                                     0,                         // No offset
+                                                                                     eLazyBoolCalculate,        // Check inlines using global setting
+                                                                                     eLazyBoolCalculate,        // Skip prologue using global setting,
+                                                                                     false,                     // internal
+                                                                                     false,                     // request_hardware
+                                                                                     eLazyBoolCalculate);       // move_to_nearest_code
                         // Make breakpoint one shot
                         bp_sp->GetOptions()->SetOneShot(true);
                         exe_ctx.GetProcessRef().Resume();
@@ -5312,15 +5283,15 @@
                     ExecutionContext exe_ctx = m_debugger.GetCommandInterpreter().GetExecutionContext();
                     if (exe_ctx.HasTargetScope())
                     {
-                        BreakpointSP bp_sp = exe_ctx.GetTargetRef().CreateBreakpoint (NULL,                      // Don't limit the breakpoint to certain modules
-                                                                                      m_file_sp->GetFileSpec(),  // Source file
-                                                                                      m_selected_line + 1,       // Source line number (m_selected_line is zero based)
-                                                                                      0,                         // No offset
-                                                                                      eLazyBoolCalculate,        // Check inlines using global setting
-                                                                                      eLazyBoolCalculate,        // Skip prologue using global setting,
-                                                                                      false,                     // internal
-                                                                                      false,                     // request_hardware
-                                                                                      eLazyBoolCalculate);       // move_to_nearest_code
+                        BreakpointSP bp_sp = exe_ctx.GetTargetRef().CreateBreakpoint(nullptr,                   // Don't limit the breakpoint to certain modules
+                                                                                     m_file_sp->GetFileSpec(),  // Source file
+                                                                                     m_selected_line + 1,       // Source line number (m_selected_line is zero based)
+                                                                                     0,                         // No offset
+                                                                                     eLazyBoolCalculate,        // Check inlines using global setting
+                                                                                     eLazyBoolCalculate,        // Skip prologue using global setting,
+                                                                                     false,                     // internal
+                                                                                     false,                     // request_hardware
+                                                                                     eLazyBoolCalculate);       // move_to_nearest_code
                     }
                 }
                 else if (m_selected_line < GetNumDisassemblyLines())
@@ -5454,38 +5425,38 @@
         
         MenuDelegateSP app_menu_delegate_sp = std::static_pointer_cast<MenuDelegate>(app_delegate_sp);
         MenuSP lldb_menu_sp(new Menu("LLDB" , "F1", KEY_F(1), ApplicationDelegate::eMenuID_LLDB));
-        MenuSP exit_menuitem_sp(new Menu("Exit", NULL, 'x', ApplicationDelegate::eMenuID_LLDBExit));
+        MenuSP exit_menuitem_sp(new Menu("Exit", nullptr, 'x', ApplicationDelegate::eMenuID_LLDBExit));
         exit_menuitem_sp->SetCannedResult(MenuActionResult::Quit);
-        lldb_menu_sp->AddSubmenu (MenuSP (new Menu("About LLDB", NULL, 'a', ApplicationDelegate::eMenuID_LLDBAbout)));
+        lldb_menu_sp->AddSubmenu (MenuSP (new Menu("About LLDB", nullptr, 'a', ApplicationDelegate::eMenuID_LLDBAbout)));
         lldb_menu_sp->AddSubmenu (MenuSP (new Menu(Menu::Type::Separator)));
         lldb_menu_sp->AddSubmenu (exit_menuitem_sp);
         
         MenuSP target_menu_sp(new Menu("Target" ,"F2", KEY_F(2), ApplicationDelegate::eMenuID_Target));
-        target_menu_sp->AddSubmenu (MenuSP (new Menu("Create", NULL, 'c', ApplicationDelegate::eMenuID_TargetCreate)));
-        target_menu_sp->AddSubmenu (MenuSP (new Menu("Delete", NULL, 'd', ApplicationDelegate::eMenuID_TargetDelete)));
+        target_menu_sp->AddSubmenu (MenuSP (new Menu("Create", nullptr, 'c', ApplicationDelegate::eMenuID_TargetCreate)));
+        target_menu_sp->AddSubmenu (MenuSP (new Menu("Delete", nullptr, 'd', ApplicationDelegate::eMenuID_TargetDelete)));
         
         MenuSP process_menu_sp(new Menu("Process", "F3", KEY_F(3), ApplicationDelegate::eMenuID_Process));
-        process_menu_sp->AddSubmenu (MenuSP (new Menu("Attach"  , NULL, 'a', ApplicationDelegate::eMenuID_ProcessAttach)));
-        process_menu_sp->AddSubmenu (MenuSP (new Menu("Detach"  , NULL, 'd', ApplicationDelegate::eMenuID_ProcessDetach)));
-        process_menu_sp->AddSubmenu (MenuSP (new Menu("Launch"  , NULL, 'l', ApplicationDelegate::eMenuID_ProcessLaunch)));
+        process_menu_sp->AddSubmenu (MenuSP (new Menu("Attach"  , nullptr, 'a', ApplicationDelegate::eMenuID_ProcessAttach)));
+        process_menu_sp->AddSubmenu (MenuSP (new Menu("Detach"  , nullptr, 'd', ApplicationDelegate::eMenuID_ProcessDetach)));
+        process_menu_sp->AddSubmenu (MenuSP (new Menu("Launch"  , nullptr, 'l', ApplicationDelegate::eMenuID_ProcessLaunch)));
         process_menu_sp->AddSubmenu (MenuSP (new Menu(Menu::Type::Separator)));
-        process_menu_sp->AddSubmenu (MenuSP (new Menu("Continue", NULL, 'c', ApplicationDelegate::eMenuID_ProcessContinue)));
-        process_menu_sp->AddSubmenu (MenuSP (new Menu("Halt"    , NULL, 'h', ApplicationDelegate::eMenuID_ProcessHalt)));
-        process_menu_sp->AddSubmenu (MenuSP (new Menu("Kill"    , NULL, 'k', ApplicationDelegate::eMenuID_ProcessKill)));
+        process_menu_sp->AddSubmenu (MenuSP (new Menu("Continue", nullptr, 'c', ApplicationDelegate::eMenuID_ProcessContinue)));
+        process_menu_sp->AddSubmenu (MenuSP (new Menu("Halt"    , nullptr, 'h', ApplicationDelegate::eMenuID_ProcessHalt)));
+        process_menu_sp->AddSubmenu (MenuSP (new Menu("Kill"    , nullptr, 'k', ApplicationDelegate::eMenuID_ProcessKill)));
         
         MenuSP thread_menu_sp(new Menu("Thread", "F4", KEY_F(4), ApplicationDelegate::eMenuID_Thread));
-        thread_menu_sp->AddSubmenu (MenuSP (new Menu("Step In"  , NULL, 'i', ApplicationDelegate::eMenuID_ThreadStepIn)));
-        thread_menu_sp->AddSubmenu (MenuSP (new Menu("Step Over", NULL, 'v', ApplicationDelegate::eMenuID_ThreadStepOver)));
-        thread_menu_sp->AddSubmenu (MenuSP (new Menu("Step Out" , NULL, 'o', ApplicationDelegate::eMenuID_ThreadStepOut)));
+        thread_menu_sp->AddSubmenu (MenuSP (new Menu("Step In"  , nullptr, 'i', ApplicationDelegate::eMenuID_ThreadStepIn)));
+        thread_menu_sp->AddSubmenu (MenuSP (new Menu("Step Over", nullptr, 'v', ApplicationDelegate::eMenuID_ThreadStepOver)));
+        thread_menu_sp->AddSubmenu (MenuSP (new Menu("Step Out" , nullptr, 'o', ApplicationDelegate::eMenuID_ThreadStepOut)));
         
         MenuSP view_menu_sp(new Menu("View", "F5", KEY_F(5), ApplicationDelegate::eMenuID_View));
-        view_menu_sp->AddSubmenu (MenuSP (new Menu("Backtrace", NULL, 'b', ApplicationDelegate::eMenuID_ViewBacktrace)));
-        view_menu_sp->AddSubmenu (MenuSP (new Menu("Registers", NULL, 'r', ApplicationDelegate::eMenuID_ViewRegisters)));
-        view_menu_sp->AddSubmenu (MenuSP (new Menu("Source"   , NULL, 's', ApplicationDelegate::eMenuID_ViewSource)));
-        view_menu_sp->AddSubmenu (MenuSP (new Menu("Variables", NULL, 'v', ApplicationDelegate::eMenuID_ViewVariables)));
+        view_menu_sp->AddSubmenu (MenuSP (new Menu("Backtrace", nullptr, 'b', ApplicationDelegate::eMenuID_ViewBacktrace)));
+        view_menu_sp->AddSubmenu (MenuSP (new Menu("Registers", nullptr, 'r', ApplicationDelegate::eMenuID_ViewRegisters)));
+        view_menu_sp->AddSubmenu (MenuSP (new Menu("Source"   , nullptr, 's', ApplicationDelegate::eMenuID_ViewSource)));
+        view_menu_sp->AddSubmenu (MenuSP (new Menu("Variables", nullptr, 'v', ApplicationDelegate::eMenuID_ViewVariables)));
         
         MenuSP help_menu_sp(new Menu("Help", "F6", KEY_F(6), ApplicationDelegate::eMenuID_Help));
-        help_menu_sp->AddSubmenu (MenuSP (new Menu("GUI Help", NULL, 'g', ApplicationDelegate::eMenuID_HelpGUIHelp)));
+        help_menu_sp->AddSubmenu (MenuSP (new Menu("GUI Help", nullptr, 'g', ApplicationDelegate::eMenuID_HelpGUIHelp)));
         
         m_app_ap->Initialize();
         WindowSP &main_window_sp = m_app_ap->GetMainWindow();