[Lldb-commits] [lldb] r261179 - Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes.

Eugene Zelenko via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 17 16:10:18 PST 2016


Author: eugenezelenko
Date: Wed Feb 17 18:10:17 2016
New Revision: 261179

URL: http://llvm.org/viewvc/llvm-project?rev=261179&view=rev
Log:
Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes.

Modified:
    lldb/trunk/include/lldb/Target/Platform.h
    lldb/trunk/source/Target/ABI.cpp
    lldb/trunk/source/Target/ExecutionContext.cpp
    lldb/trunk/source/Target/InstrumentationRuntime.cpp
    lldb/trunk/source/Target/JITLoader.cpp
    lldb/trunk/source/Target/LanguageRuntime.cpp
    lldb/trunk/source/Target/MemoryHistory.cpp
    lldb/trunk/source/Target/OperatingSystem.cpp
    lldb/trunk/source/Target/PathMappingList.cpp
    lldb/trunk/source/Target/Platform.cpp
    lldb/trunk/source/Target/ProcessLaunchInfo.cpp
    lldb/trunk/source/Target/RegisterContext.cpp

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Wed Feb 17 18:10:17 2016
@@ -1325,10 +1325,10 @@ class ModuleCache;
     class OptionGroupPlatformRSync : public lldb_private::OptionGroup
     {
     public:
-        OptionGroupPlatformRSync ();
-        
-        ~OptionGroupPlatformRSync() override;
-        
+        OptionGroupPlatformRSync() = default;
+
+        ~OptionGroupPlatformRSync() override = default;
+
         lldb_private::Error
         SetOptionValue(CommandInterpreter &interpreter,
 		       uint32_t option_idx,
@@ -1353,6 +1353,7 @@ class ModuleCache;
         std::string m_rsync_opts;
         std::string m_rsync_prefix;
         bool m_ignores_remote_hostname;
+
     private:
         DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformRSync);
     };
@@ -1360,10 +1361,10 @@ class ModuleCache;
     class OptionGroupPlatformSSH : public lldb_private::OptionGroup
     {
     public:
-        OptionGroupPlatformSSH ();
-        
-        ~OptionGroupPlatformSSH() override;
-        
+        OptionGroupPlatformSSH() = default;
+
+        ~OptionGroupPlatformSSH() override = default;
+
         lldb_private::Error
         SetOptionValue(CommandInterpreter &interpreter,
 		       uint32_t option_idx,
@@ -1394,10 +1395,10 @@ class ModuleCache;
     class OptionGroupPlatformCaching : public lldb_private::OptionGroup
     {
     public:
-        OptionGroupPlatformCaching ();
-        
-        ~OptionGroupPlatformCaching() override;
-        
+        OptionGroupPlatformCaching() = default;
+
+        ~OptionGroupPlatformCaching() override = default;
+
         lldb_private::Error
         SetOptionValue(CommandInterpreter &interpreter,
 		       uint32_t option_idx,

Modified: lldb/trunk/source/Target/ABI.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ABI.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/ABI.cpp (original)
+++ lldb/trunk/source/Target/ABI.cpp Wed Feb 17 18:10:17 2016
@@ -7,6 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/Target/ABI.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Value.h"
@@ -27,7 +31,7 @@ ABI::FindPlugin (const ArchSpec &arch)
     ABICreateInstance create_callback;
 
     for (uint32_t idx = 0;
-         (create_callback = PluginManager::GetABICreateCallbackAtIndex(idx)) != NULL;
+         (create_callback = PluginManager::GetABICreateCallbackAtIndex(idx)) != nullptr;
          ++idx)
     {
         abi_sp = create_callback(arch);
@@ -39,19 +43,9 @@ ABI::FindPlugin (const ArchSpec &arch)
     return abi_sp;
 }
 
-//----------------------------------------------------------------------
-// Constructor
-//----------------------------------------------------------------------
-ABI::ABI()
-{
-}
+ABI::ABI() = default;
 
-//----------------------------------------------------------------------
-// Destructor
-//----------------------------------------------------------------------
-ABI::~ABI()
-{
-}
+ABI::~ABI() = default;
 
 bool
 ABI::GetRegisterInfoByName (const ConstString &name, RegisterInfo &info)
@@ -62,7 +56,7 @@ ABI::GetRegisterInfoByName (const ConstS
     {
         const char *unique_name_cstr = name.GetCString();
         uint32_t i;
-        for (i=0; i<count; ++i)
+        for (i = 0; i < count; ++i)
         {
             if (register_info_array[i].name == unique_name_cstr)
             {
@@ -70,7 +64,7 @@ ABI::GetRegisterInfoByName (const ConstS
                 return true;
             }
         }
-        for (i=0; i<count; ++i)
+        for (i = 0; i < count; ++i)
         {
             if (register_info_array[i].alt_name == unique_name_cstr)
             {
@@ -92,7 +86,7 @@ ABI::GetRegisterInfoByKind (RegisterKind
     const RegisterInfo *register_info_array = GetRegisterInfoArray (count);
     if (register_info_array)
     {
-        for (uint32_t i=0; i<count; ++i)
+        for (uint32_t i = 0; i < count; ++i)
         {
             if (register_info_array[i].kinds[reg_kind] == reg_num)
             {
@@ -148,7 +142,7 @@ ABI::GetReturnValueObject (Thread &threa
 
         ExpressionVariableSP clang_expr_variable_sp(persistent_expression_state->CreatePersistentVariable(return_valobj_sp));
                
-        assert (clang_expr_variable_sp.get());
+        assert (clang_expr_variable_sp);
         
         // Set flags and live data as appropriate
 

Modified: lldb/trunk/source/Target/ExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ExecutionContext.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/ExecutionContext.cpp (original)
+++ lldb/trunk/source/Target/ExecutionContext.cpp Wed Feb 17 18:10:17 2016
@@ -7,8 +7,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/Target/ExecutionContext.h"
-
 #include "lldb/Core/State.h"
 #include "lldb/Target/ExecutionContextScope.h"
 #include "lldb/Target/StackFrame.h"
@@ -241,9 +244,7 @@ ExecutionContext::Clear()
     m_frame_sp.reset();
 }
 
-ExecutionContext::~ExecutionContext()
-{
-}
+ExecutionContext::~ExecutionContext() = default;
 
 uint32_t
 ExecutionContext::GetAddressByteSize() const
@@ -272,7 +273,7 @@ ExecutionContext::GetRegisterContext ()
         return m_frame_sp->GetRegisterContext().get();
     else if (m_thread_sp)
         return m_thread_sp->GetRegisterContext().get();
-    return NULL;
+    return nullptr;
 }
 
 Target *
@@ -282,7 +283,7 @@ ExecutionContext::GetTargetPtr () const
         return m_target_sp.get();
     if (m_process_sp)
         return &m_process_sp->GetTarget();
-    return NULL;
+    return nullptr;
 }
 
 Process *
@@ -292,7 +293,7 @@ ExecutionContext::GetProcessPtr () const
         return m_process_sp.get();
     if (m_target_sp)
         return m_target_sp->GetProcessSP().get();
-    return NULL;
+    return nullptr;
 }
 
 ExecutionContextScope *
@@ -311,7 +312,7 @@ Target &
 ExecutionContext::GetTargetRef () const
 {
 #if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
-    assert (m_target_sp.get());
+    assert (m_target_sp);
 #endif
     return *m_target_sp;
 }
@@ -320,7 +321,7 @@ Process &
 ExecutionContext::GetProcessRef () const
 {
 #if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
-    assert (m_process_sp.get());
+    assert (m_process_sp);
 #endif
     return *m_process_sp;
 }
@@ -329,7 +330,7 @@ Thread &
 ExecutionContext::GetThreadRef () const
 {
 #if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
-    assert (m_thread_sp.get());
+    assert (m_thread_sp);
 #endif
     return *m_thread_sp;
 }
@@ -338,7 +339,7 @@ StackFrame &
 ExecutionContext::GetFrameRef () const
 {
 #if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
-    assert (m_frame_sp.get());
+    assert (m_frame_sp);
 #endif
     return *m_frame_sp;
 }
@@ -572,7 +573,6 @@ ExecutionContextRef::ExecutionContextRef
     *this = exe_ctx;
 }
 
-
 ExecutionContextRef::ExecutionContextRef (Target *target, bool adopt_selected) :
     m_target_wp(),
     m_process_wp(),
@@ -583,9 +583,6 @@ ExecutionContextRef::ExecutionContextRef
     SetTargetPtr (target, adopt_selected);
 }
 
-
-
-
 ExecutionContextRef::ExecutionContextRef (const ExecutionContextRef &rhs) :
     m_target_wp (rhs.m_target_wp),
     m_process_wp(rhs.m_process_wp),
@@ -637,9 +634,7 @@ ExecutionContextRef::Clear()
     ClearFrame();
 }
 
-ExecutionContextRef::~ExecutionContextRef()
-{
-}
+ExecutionContextRef::~ExecutionContextRef() = default;
 
 void
 ExecutionContextRef::SetTargetSP (const lldb::TargetSP &target_sp)
@@ -694,7 +689,6 @@ ExecutionContextRef::SetFrameSP (const l
         m_process_wp.reset();
         m_target_wp.reset();
     }
-
 }
 
 void
@@ -820,7 +814,7 @@ ExecutionContextRef::GetThreadSP () cons
         }
     }
     
-    // Check that we aren't about to return an invalid thread sp.  We might return a NULL thread_sp,
+    // Check that we aren't about to return an invalid thread sp.  We might return a nullptr thread_sp,
     // but don't return an invalid one.
     
     if (thread_sp && !thread_sp->IsValid())
@@ -846,5 +840,3 @@ ExecutionContextRef::Lock (bool thread_a
 {
     return ExecutionContext(this, thread_and_frame_only_if_stopped);
 }
-
-

Modified: lldb/trunk/source/Target/InstrumentationRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/InstrumentationRuntime.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/InstrumentationRuntime.cpp (original)
+++ lldb/trunk/source/Target/InstrumentationRuntime.cpp Wed Feb 17 18:10:17 2016
@@ -5,8 +5,12 @@
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
-//===----------------------------------------------------------------------===//
+//===---------------------------------------------------------------------===//
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Core/PluginManager.h"
@@ -18,12 +22,12 @@ using namespace lldb_private;
 void
 InstrumentationRuntime::ModulesDidLoad(lldb_private::ModuleList &module_list, lldb_private::Process *process, InstrumentationRuntimeCollection &runtimes)
 {
-    InstrumentationRuntimeCreateInstance create_callback = NULL;
+    InstrumentationRuntimeCreateInstance create_callback = nullptr;
     InstrumentationRuntimeGetType get_type_callback;
     for (uint32_t idx = 0; ; ++idx)
     {
         create_callback = PluginManager::GetInstrumentationRuntimeCreateCallbackAtIndex(idx);
-        if (create_callback == NULL)
+        if (create_callback == nullptr)
             break;
         get_type_callback = PluginManager::GetInstrumentationRuntimeGetTypeCallbackAtIndex(idx);
         InstrumentationRuntimeType type = get_type_callback();

Modified: lldb/trunk/source/Target/JITLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/JITLoader.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/JITLoader.cpp (original)
+++ lldb/trunk/source/Target/JITLoader.cpp Wed Feb 17 18:10:17 2016
@@ -7,6 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Target/JITLoader.h"
 #include "lldb/Target/JITLoaderList.h"
@@ -19,8 +23,8 @@ using namespace lldb_private;
 void
 JITLoader::LoadPlugins (Process *process, JITLoaderList &list)
 {
-    JITLoaderCreateInstance create_callback = NULL;
-    for (uint32_t idx = 0; (create_callback = PluginManager::GetJITLoaderCreateCallbackAtIndex(idx)) != NULL; ++idx)
+    JITLoaderCreateInstance create_callback = nullptr;
+    for (uint32_t idx = 0; (create_callback = PluginManager::GetJITLoaderCreateCallbackAtIndex(idx)) != nullptr; ++idx)
     {
         JITLoaderSP instance_sp(create_callback(process, false));
         if (instance_sp)
@@ -33,6 +37,4 @@ JITLoader::JITLoader(Process *process) :
 {
 }
 
-JITLoader::~JITLoader()
-{
-}
+JITLoader::~JITLoader() = default;

Modified: lldb/trunk/source/Target/LanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/LanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/LanguageRuntime.cpp Wed Feb 17 18:10:17 2016
@@ -29,10 +29,10 @@ public:
     ExceptionSearchFilter (const lldb::TargetSP &target_sp,
                            lldb::LanguageType language,
                            bool update_module_list = true) :
-        SearchFilter (target_sp),
-        m_language (language),
-        m_language_runtime (NULL),
-        m_filter_sp ()
+        SearchFilter(target_sp),
+        m_language(language),
+        m_language_runtime(nullptr),
+        m_filter_sp()
     {
         if (update_module_list)
             UpdateModuleListIfNeeded ();
@@ -92,7 +92,7 @@ protected:
         if (process_sp)
         {
             bool refreash_filter = !m_filter_sp;
-            if (m_language_runtime == NULL)
+            if (m_language_runtime == nullptr)
             {
                 m_language_runtime = process_sp->GetLanguageRuntime(m_language);
                 refreash_filter = true;
@@ -115,7 +115,7 @@ protected:
         else
         {
             m_filter_sp.reset();
-            m_language_runtime = NULL;
+            m_language_runtime = nullptr;
         }
     }
 };
@@ -128,11 +128,11 @@ public:
     ExceptionBreakpointResolver (lldb::LanguageType language,
                                  bool catch_bp,
                                  bool throw_bp) :
-        BreakpointResolver (NULL, BreakpointResolver::ExceptionResolver),
-        m_language (language),
-        m_language_runtime (NULL),
-        m_catch_bp (catch_bp),
-        m_throw_bp (throw_bp)
+        BreakpointResolver(nullptr, BreakpointResolver::ExceptionResolver),
+        m_language(language),
+        m_language_runtime(nullptr),
+        m_catch_bp(catch_bp),
+        m_throw_bp(throw_bp)
     {
     }
 
@@ -207,7 +207,7 @@ protected:
             if (process_sp)
             {
                 bool refreash_resolver = !m_actual_resolver_sp;
-                if (m_language_runtime == NULL)
+                if (m_language_runtime == nullptr)
                 {
                     m_language_runtime = process_sp->GetLanguageRuntime(m_language);
                     refreash_resolver = true;
@@ -230,16 +230,17 @@ protected:
             else
             {
                 m_actual_resolver_sp.reset();
-                m_language_runtime = NULL;
+                m_language_runtime = nullptr;
             }
         }
         else
         {
             m_actual_resolver_sp.reset();
-            m_language_runtime = NULL;
+            m_language_runtime = nullptr;
         }
         return (bool)m_actual_resolver_sp;
     }
+
     lldb::BreakpointResolverSP m_actual_resolver_sp;
     lldb::LanguageType m_language;
     LanguageRuntime *m_language_runtime;
@@ -254,16 +255,16 @@ LanguageRuntime::FindPlugin (Process *pr
     LanguageRuntimeCreateInstance create_callback;
 
     for (uint32_t idx = 0;
-         (create_callback = PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(idx)) != NULL;
+         (create_callback = PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(idx)) != nullptr;
          ++idx)
     {
         language_runtime_ap.reset (create_callback(process, language));
 
-        if (language_runtime_ap.get())
+        if (language_runtime_ap)
             return language_runtime_ap.release();
     }
 
-    return NULL;
+    return nullptr;
 }
 
 LanguageRuntime::LanguageRuntime(Process *process) :
@@ -348,5 +349,5 @@ LanguageRuntime::InitializeCommands (Com
 lldb::SearchFilterSP
 LanguageRuntime::CreateExceptionSearchFilter ()
 {
-    return m_process->GetTarget().GetSearchFilterForModule(NULL);
+    return m_process->GetTarget().GetSearchFilterForModule(nullptr);
 }

Modified: lldb/trunk/source/Target/MemoryHistory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/MemoryHistory.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/MemoryHistory.cpp (original)
+++ lldb/trunk/source/Target/MemoryHistory.cpp Wed Feb 17 18:10:17 2016
@@ -1,4 +1,4 @@
-//===-- MemoryHistory.cpp -------------------------*- C++ -*-===//
+//===-- MemoryHistory.cpp ---------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,8 +7,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/Target/MemoryHistory.h"
-
 #include "lldb/Core/PluginManager.h"
 
 using namespace lldb;
@@ -17,12 +20,12 @@ using namespace lldb_private;
 lldb::MemoryHistorySP
 MemoryHistory::FindPlugin (const ProcessSP process)
 {
-    MemoryHistoryCreateInstance create_callback = NULL;
+    MemoryHistoryCreateInstance create_callback = nullptr;
     
-    for (uint32_t idx = 0; (create_callback = PluginManager::GetMemoryHistoryCreateCallbackAtIndex(idx)) != NULL; ++idx)
+    for (uint32_t idx = 0; (create_callback = PluginManager::GetMemoryHistoryCreateCallbackAtIndex(idx)) != nullptr; ++idx)
     {
         MemoryHistorySP memory_history_sp (create_callback (process));
-        if (memory_history_sp.get())
+        if (memory_history_sp)
             return memory_history_sp;
     }
     

Modified: lldb/trunk/source/Target/OperatingSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/OperatingSystem.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/OperatingSystem.cpp (original)
+++ lldb/trunk/source/Target/OperatingSystem.cpp Wed Feb 17 18:10:17 2016
@@ -1,4 +1,4 @@
-//===-- OperatingSystem.cpp --------------------------------------------*- C++ -*-===//
+//===-- OperatingSystem.cpp -------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,22 +7,21 @@
 //
 //===----------------------------------------------------------------------===//
 
-
-#include "lldb/Target/OperatingSystem.h"
 // C Includes
 // C++ Includes
 // Other libraries and framework includes
+// Project includes
+#include "lldb/Target/OperatingSystem.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Thread.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
-
 OperatingSystem*
 OperatingSystem::FindPlugin (Process *process, const char *plugin_name)
 {
-    OperatingSystemCreateInstance create_callback = NULL;
+    OperatingSystemCreateInstance create_callback = nullptr;
     if (plugin_name)
     {
         ConstString const_plugin_name(plugin_name);
@@ -30,20 +29,20 @@ OperatingSystem::FindPlugin (Process *pr
         if (create_callback)
         {
             std::unique_ptr<OperatingSystem> instance_ap(create_callback(process, true));
-            if (instance_ap.get())
+            if (instance_ap)
                 return instance_ap.release();
         }
     }
     else
     {
-        for (uint32_t idx = 0; (create_callback = PluginManager::GetOperatingSystemCreateCallbackAtIndex(idx)) != NULL; ++idx)
+        for (uint32_t idx = 0; (create_callback = PluginManager::GetOperatingSystemCreateCallbackAtIndex(idx)) != nullptr; ++idx)
         {
             std::unique_ptr<OperatingSystem> instance_ap(create_callback(process, false));
-            if (instance_ap.get())
+            if (instance_ap)
                 return instance_ap.release();
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 
@@ -52,10 +51,7 @@ OperatingSystem::OperatingSystem (Proces
 {
 }
 
-OperatingSystem::~OperatingSystem()
-{
-}
-
+OperatingSystem::~OperatingSystem() = default;
 
 bool
 OperatingSystem::IsOperatingSystemPluginThread (const lldb::ThreadSP &thread_sp)
@@ -64,4 +60,3 @@ OperatingSystem::IsOperatingSystemPlugin
         return thread_sp->IsOperatingSystemPluginThread();
     return false;
 }
-

Modified: lldb/trunk/source/Target/PathMappingList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/PathMappingList.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/PathMappingList.cpp (original)
+++ lldb/trunk/source/Target/PathMappingList.cpp Wed Feb 17 18:10:17 2016
@@ -8,10 +8,10 @@
 //===----------------------------------------------------------------------===//
 
 // C Includes
-#include <limits.h>
-#include <string.h>
-
 // C++ Includes
+#include <climits>
+#include <cstring>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Error.h"
@@ -26,10 +26,10 @@ using namespace lldb_private;
 // PathMappingList constructor
 //----------------------------------------------------------------------
 PathMappingList::PathMappingList () :
-    m_pairs (),
-    m_callback (NULL),
-    m_callback_baton (NULL),
-    m_mod_id (0)
+    m_pairs(),
+    m_callback(nullptr),
+    m_callback_baton(nullptr),
+    m_mod_id(0)
 {
 }
 
@@ -42,14 +42,12 @@ PathMappingList::PathMappingList (Change
 {
 }
 
-
 PathMappingList::PathMappingList (const PathMappingList &rhs) :
-    m_pairs (rhs.m_pairs),
-    m_callback (NULL),
-    m_callback_baton (NULL),
-    m_mod_id (0)
+    m_pairs(rhs.m_pairs),
+    m_callback(nullptr),
+    m_callback_baton(nullptr),
+    m_mod_id(0)
 {
-    
 }
 
 const PathMappingList &
@@ -58,20 +56,14 @@ PathMappingList::operator =(const PathMa
     if (this != &rhs)
     {
         m_pairs = rhs.m_pairs;
-        m_callback = NULL;
-        m_callback_baton = NULL;
+        m_callback = nullptr;
+        m_callback_baton = nullptr;
         m_mod_id = rhs.m_mod_id;
     }
     return *this;
 }
 
-
-//----------------------------------------------------------------------
-// Destructor
-//----------------------------------------------------------------------
-PathMappingList::~PathMappingList ()
-{
-}
+PathMappingList::~PathMappingList() = default;
 
 void
 PathMappingList::Append (const ConstString &path,
@@ -204,7 +196,7 @@ PathMappingList::RemapPath (const ConstS
 bool
 PathMappingList::RemapPath (const char *path, std::string &new_path) const
 {
-    if (m_pairs.empty() || path == NULL || path[0] == '\0')
+    if (m_pairs.empty() || path == nullptr || path[0] == '\0')
         return false;
 
     const_iterator pos, end = m_pairs.end();
@@ -329,8 +321,6 @@ PathMappingList::GetPathsAtIndex (uint32
     return false;
 }
 
-
-
 uint32_t
 PathMappingList::FindIndexForPath (const ConstString &path) const
 {
@@ -345,4 +335,3 @@ PathMappingList::FindIndexForPath (const
     }
     return UINT32_MAX;
 }
-

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Wed Feb 17 18:10:17 2016
@@ -7,17 +7,18 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/Target/Platform.h"
-
 // C Includes
-
 // C++ Includes
 #include <algorithm>
 #include <fstream>
 #include <vector>
 
 // Other libraries and framework includes
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+
 // Project includes
+#include "lldb/Target/Platform.h"
 #include "lldb/Breakpoint/BreakpointIDList.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/Debugger.h"
@@ -39,12 +40,8 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/UnixSignals.h"
 #include "lldb/Utility/Utils.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Path.h"
-
 #include "Utility/ModuleCache.h"
 
-
 // Define these constants from POSIX mman.h rather than include the file
 // so that they will be correct even when compiled on Linux.
 #define MAP_PRIVATE 2
@@ -230,7 +227,7 @@ Platform::LocateExecutableScriptingResou
 //PlatformSP
 //Platform::FindPlugin (Process *process, const ConstString &plugin_name)
 //{
-//    PlatformCreateInstance create_callback = NULL;
+//    PlatformCreateInstance create_callback = nullptr;
 //    if (plugin_name)
 //    {
 //        create_callback  = PluginManager::GetPlatformCreateCallbackForPluginName (plugin_name);
@@ -248,7 +245,7 @@ Platform::LocateExecutableScriptingResou
 //    }
 //    else
 //    {
-//        for (uint32_t idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx)) != NULL; ++idx)
+//        for (uint32_t idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx)) != nullptr; ++idx)
 //        {
 //            PlatformSP platform_sp(create_callback(process, nullptr));
 //            if (platform_sp)
@@ -324,7 +321,7 @@ Platform::Find (const ConstString &name)
 PlatformSP
 Platform::Create (const ConstString &name, Error &error)
 {
-    PlatformCreateInstance create_callback = NULL;
+    PlatformCreateInstance create_callback = nullptr;
     lldb::PlatformSP platform_sp;
     if (name)
     {
@@ -334,7 +331,7 @@ Platform::Create (const ConstString &nam
 
         create_callback = PluginManager::GetPlatformCreateCallbackForPluginName (name);
         if (create_callback)
-            platform_sp = create_callback(true, NULL);
+            platform_sp = create_callback(true, nullptr);
         else
             error.SetErrorStringWithFormat ("unable to find a plug-in for the platform named \"%s\"", name.GetCString());
     }
@@ -350,7 +347,6 @@ Platform::Create (const ConstString &nam
     return platform_sp;
 }
 
-
 PlatformSP
 Platform::Create (const ArchSpec &arch, ArchSpec *platform_arch_ptr, Error &error)
 {
@@ -521,11 +517,10 @@ Platform::GetStatus (Stream &strm)
 
     std::string specific_info(GetPlatformSpecificConnectionInformation());
     
-    if (specific_info.empty() == false)
+    if (!specific_info.empty())
         strm.Printf("Platform-specific connection: %s\n", specific_info.c_str());
 }
 
-
 bool
 Platform::GetOSVersion (uint32_t &major, 
                         uint32_t &minor, 
@@ -631,7 +626,6 @@ Platform::AddClangModuleCompilationOptio
                    default_compilation_options.end());
 }
 
-
 FileSpec
 Platform::GetWorkingDirectory ()
 {
@@ -651,7 +645,6 @@ Platform::GetWorkingDirectory ()
     }
 }
 
-
 struct RecurseCopyBaton
 {
     const FileSpec& dst;
@@ -659,7 +652,6 @@ struct RecurseCopyBaton
     Error error;
 };
 
-
 static FileSpec::EnumerateDirectoryResult
 RecurseCopy_Callback (void *baton,
                       FileSpec::FileType file_type,
@@ -728,6 +720,7 @@ RecurseCopy_Callback (void *baton,
                 return FileSpec::eEnumerateDirectoryResultNext;
             }
             break;
+
         case FileSpec::eFileTypeRegular:
             {
                 // copy the file and keep going
@@ -964,7 +957,7 @@ Platform::GetHostname ()
         return "127.0.0.1";
 
     if (m_name.empty())        
-        return NULL;
+        return nullptr;
     return m_name.c_str();
 }
 
@@ -999,7 +992,7 @@ Platform::GetUserName (uint32_t uid)
             return SetCachedUserName (uid, name.c_str(), name.size());
     }
 #endif
-    return NULL;
+    return nullptr;
 }
 
 const char *
@@ -1016,7 +1009,7 @@ Platform::GetGroupName (uint32_t gid)
             return SetCachedGroupName (gid, name.c_str(), name.size());
     }
 #endif
-    return NULL;
+    return nullptr;
 }
 
 bool
@@ -1052,7 +1045,6 @@ Platform::SetOSVersion (uint32_t major,
     return false;
 }
 
-
 Error
 Platform::ResolveExecutable (const ModuleSpec &module_spec,
                              lldb::ModuleSP &exe_module_sp,
@@ -1063,11 +1055,11 @@ Platform::ResolveExecutable (const Modul
     {
         if (module_spec.GetArchitecture().IsValid())
         {
-            error = ModuleList::GetSharedModule (module_spec, 
-                                                 exe_module_sp, 
-                                                 module_search_paths_ptr,
-                                                 NULL, 
-                                                 NULL);
+            error = ModuleList::GetSharedModule(module_spec, 
+                                                exe_module_sp, 
+                                                module_search_paths_ptr,
+                                                nullptr, 
+                                                nullptr);
         }
         else
         {
@@ -1077,11 +1069,11 @@ Platform::ResolveExecutable (const Modul
             ModuleSpec arch_module_spec(module_spec);
             for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, arch_module_spec.GetArchitecture()); ++idx)
             {
-                error = ModuleList::GetSharedModule (arch_module_spec,
-                                                     exe_module_sp, 
-                                                     module_search_paths_ptr,
-                                                     NULL, 
-                                                     NULL);
+                error = ModuleList::GetSharedModule(arch_module_spec,
+                                                    exe_module_sp, 
+                                                    module_search_paths_ptr,
+                                                    nullptr, 
+                                                    nullptr);
                 // Did we find an executable using one of the 
                 if (error.Success() && exe_module_sp)
                     break;
@@ -1107,10 +1099,7 @@ Platform::ResolveSymbolFile (Target &tar
     else
         error.SetErrorString("unable to resolve symbol file");
     return error;
-    
-}
-
-
+}   
 
 bool
 Platform::ResolveRemotePath (const FileSpec &platform_path,
@@ -1120,7 +1109,6 @@ Platform::ResolveRemotePath (const FileS
     return resolved_platform_path.ResolvePath();
 }
 
-
 const ArchSpec &
 Platform::GetSystemArchitecture()
 {
@@ -1166,7 +1154,6 @@ Platform::GetSystemArchitecture()
     return m_system_arch;
 }
 
-
 Error
 Platform::ConnectRemote (Args& args)
 {
@@ -1211,7 +1198,6 @@ Platform::FindProcesses (const ProcessIn
     return match_count;    
 }
 
-
 Error
 Platform::LaunchProcess (ProcessLaunchInfo &launch_info)
 {
@@ -1309,7 +1295,7 @@ Platform::KillProcess (const lldb::pid_t
 lldb::ProcessSP
 Platform::DebugProcess (ProcessLaunchInfo &launch_info, 
                         Debugger &debugger,
-                        Target *target,       // Can be NULL, if NULL create a new target, else use existing one
+                        Target *target,       // Can be nullptr, if nullptr create a new target, else use existing one
                         Error &error)
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));
@@ -1376,7 +1362,6 @@ Platform::DebugProcess (ProcessLaunchInf
     return process_sp;
 }
 
-
 lldb::PlatformSP
 Platform::GetPlatformForArchitecture (const ArchSpec &arch, ArchSpec *platform_arch_ptr)
 {
@@ -1387,7 +1372,6 @@ Platform::GetPlatformForArchitecture (co
     return platform_sp;
 }
 
-
 //------------------------------------------------------------------
 /// Lets a platform answer if it is compatible with a given
 /// architecture and the target triple contained within.
@@ -1539,11 +1523,11 @@ Platform::ConvertMmapFlagsToPlatform(con
 }
 
 lldb_private::Error
-Platform::RunShellCommand(const char *command,           // Shouldn't be NULL
+Platform::RunShellCommand(const char *command,           // Shouldn't be nullptr
                           const FileSpec &working_dir,   // Pass empty FileSpec to use the current working directory
-                          int *status_ptr,               // Pass NULL if you don't want the process exit status
-                          int *signo_ptr,                // Pass NULL if you don't want the signal that caused the process to exit
-                          std::string *command_output,   // Pass NULL if you don't want the command output
+                          int *status_ptr,               // Pass nullptr if you don't want the process exit status
+                          int *signo_ptr,                // Pass nullptr if you don't want the signal that caused the process to exit
+                          std::string *command_output,   // Pass nullptr if you don't want the command output
                           uint32_t timeout_sec)          // Timeout in seconds to wait for shell program to finish
 {
     if (IsHost())
@@ -1552,7 +1536,6 @@ Platform::RunShellCommand(const char *co
         return Error("unimplemented");
 }
 
-
 bool
 Platform::CalculateMD5 (const FileSpec& file_spec,
                         uint64_t &low,
@@ -1579,33 +1562,25 @@ Platform::GetLocalCacheDirectory ()
 static OptionDefinition
 g_rsync_option_table[] =
 {
-    {   LLDB_OPT_SET_ALL, false, "rsync"                  , 'r', OptionParser::eNoArgument,       NULL, NULL, 0, eArgTypeNone         , "Enable rsync." },
-    {   LLDB_OPT_SET_ALL, false, "rsync-opts"             , 'R', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCommandName  , "Platform-specific options required for rsync to work." },
-    {   LLDB_OPT_SET_ALL, false, "rsync-prefix"           , 'P', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCommandName  , "Platform-specific rsync prefix put before the remote path." },
-    {   LLDB_OPT_SET_ALL, false, "ignore-remote-hostname" , 'i', OptionParser::eNoArgument,       NULL, NULL, 0, eArgTypeNone         , "Do not automatically fill in the remote hostname when composing the rsync command." },
+    {   LLDB_OPT_SET_ALL, false, "rsync"                  , 'r', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone         , "Enable rsync." },
+    {   LLDB_OPT_SET_ALL, false, "rsync-opts"             , 'R', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCommandName  , "Platform-specific options required for rsync to work." },
+    {   LLDB_OPT_SET_ALL, false, "rsync-prefix"           , 'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCommandName  , "Platform-specific rsync prefix put before the remote path." },
+    {   LLDB_OPT_SET_ALL, false, "ignore-remote-hostname" , 'i', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone         , "Do not automatically fill in the remote hostname when composing the rsync command." },
 };
 
 static OptionDefinition
 g_ssh_option_table[] =
 {
-    {   LLDB_OPT_SET_ALL, false, "ssh"                    , 's', OptionParser::eNoArgument,       NULL, NULL, 0, eArgTypeNone         , "Enable SSH." },
-    {   LLDB_OPT_SET_ALL, false, "ssh-opts"               , 'S', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCommandName  , "Platform-specific options required for SSH to work." },
+    {   LLDB_OPT_SET_ALL, false, "ssh"                    , 's', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone         , "Enable SSH." },
+    {   LLDB_OPT_SET_ALL, false, "ssh-opts"               , 'S', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCommandName  , "Platform-specific options required for SSH to work." },
 };
 
 static OptionDefinition
 g_caching_option_table[] =
 {
-    {   LLDB_OPT_SET_ALL, false, "local-cache-dir"        , 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePath         , "Path in which to store local copies of files." },
+    {   LLDB_OPT_SET_ALL, false, "local-cache-dir"        , 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePath         , "Path in which to store local copies of files." },
 };
 
-OptionGroupPlatformRSync::OptionGroupPlatformRSync ()
-{
-}
-
-OptionGroupPlatformRSync::~OptionGroupPlatformRSync ()
-{
-}
-
 const lldb_private::OptionDefinition*
 OptionGroupPlatformRSync::GetDefinitions ()
 {
@@ -1666,14 +1641,6 @@ Platform::SetThreadCreationBreakpoint (l
     return lldb::BreakpointSP();
 }
 
-OptionGroupPlatformSSH::OptionGroupPlatformSSH ()
-{
-}
-
-OptionGroupPlatformSSH::~OptionGroupPlatformSSH ()
-{
-}
-
 const lldb_private::OptionDefinition*
 OptionGroupPlatformSSH::GetDefinitions ()
 {
@@ -1718,14 +1685,6 @@ OptionGroupPlatformSSH::GetNumDefinition
     return llvm::array_lengthof(g_ssh_option_table);
 }
 
-OptionGroupPlatformCaching::OptionGroupPlatformCaching ()
-{
-}
-
-OptionGroupPlatformCaching::~OptionGroupPlatformCaching ()
-{
-}
-
 const lldb_private::OptionDefinition*
 OptionGroupPlatformCaching::GetDefinitions ()
 {

Modified: lldb/trunk/source/Target/ProcessLaunchInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ProcessLaunchInfo.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/ProcessLaunchInfo.cpp (original)
+++ lldb/trunk/source/Target/ProcessLaunchInfo.cpp Wed Feb 17 18:10:17 2016
@@ -7,8 +7,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/Host/Config.h"
+// C Includes
+// C++ Includes
+#include <climits>
 
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Host/Config.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Host/FileSystem.h"
@@ -16,10 +21,6 @@
 #include "lldb/Target/FileAction.h"
 #include "lldb/Target/Target.h"
 
-#if !defined(_WIN32)
-#include <limits.h>
-#endif
-
 using namespace lldb;
 using namespace lldb_private;
 
@@ -27,19 +28,19 @@ using namespace lldb_private;
 // ProcessLaunchInfo member functions
 //----------------------------------------------------------------------------
 
-ProcessLaunchInfo::ProcessLaunchInfo () :
+ProcessLaunchInfo::ProcessLaunchInfo() :
     ProcessInfo(),
-    m_working_dir (),
-    m_plugin_name (),
-    m_flags (0),
-    m_file_actions (),
-    m_pty (new lldb_utility::PseudoTerminal),
-    m_resume_count (0),
-    m_monitor_callback (NULL),
-    m_monitor_callback_baton (NULL),
-    m_monitor_signals (false),
-    m_listener_sp (),
-    m_hijack_listener_sp ()
+    m_working_dir(),
+    m_plugin_name(),
+    m_flags(0),
+    m_file_actions(),
+    m_pty(new lldb_utility::PseudoTerminal),
+    m_resume_count(0),
+    m_monitor_callback(nullptr),
+    m_monitor_callback_baton(nullptr),
+    m_monitor_signals(false),
+    m_listener_sp(),
+    m_hijack_listener_sp()
 {
 }
 
@@ -55,8 +56,8 @@ ProcessLaunchInfo::ProcessLaunchInfo(con
     m_file_actions(),
     m_pty(new lldb_utility::PseudoTerminal),
     m_resume_count(0),
-    m_monitor_callback(NULL),
-    m_monitor_callback_baton(NULL),
+    m_monitor_callback(nullptr),
+    m_monitor_callback_baton(nullptr),
     m_monitor_signals(false),
     m_listener_sp (),
     m_hijack_listener_sp()
@@ -143,7 +144,7 @@ ProcessLaunchInfo::GetFileActionAtIndex(
 {
     if (idx < m_file_actions.size())
         return &m_file_actions[idx];
-    return NULL;
+    return nullptr;
 }
 
 const FileAction *
@@ -154,7 +155,7 @@ ProcessLaunchInfo::GetFileActionForFD(in
         if (m_file_actions[idx].GetFD () == fd)
             return &m_file_actions[idx];
     }
-    return NULL;
+    return nullptr;
 }
 
 const FileSpec &
@@ -172,9 +173,7 @@ ProcessLaunchInfo::SetWorkingDirectory(c
 const char *
 ProcessLaunchInfo::GetProcessPluginName () const
 {
-    if (m_plugin_name.empty())
-        return NULL;
-    return m_plugin_name.c_str();
+    return (m_plugin_name.empty() ? nullptr : m_plugin_name.c_str());
 }
 
 void
@@ -277,9 +276,9 @@ ProcessLaunchInfo::FinalizeFileActions (
 
     // If nothing for stdin or stdout or stderr was specified, then check the process for any default
     // settings that were set with "settings set"
-    if (GetFileActionForFD(STDIN_FILENO) == NULL ||
-        GetFileActionForFD(STDOUT_FILENO) == NULL ||
-        GetFileActionForFD(STDERR_FILENO) == NULL)
+    if (GetFileActionForFD(STDIN_FILENO) == nullptr ||
+        GetFileActionForFD(STDOUT_FILENO) == nullptr ||
+        GetFileActionForFD(STDERR_FILENO) == nullptr)
     {
         if (log)
             log->Printf ("ProcessLaunchInfo::%s at least one of stdin/stdout/stderr was not set, evaluating default handling",
@@ -314,11 +313,11 @@ ProcessLaunchInfo::FinalizeFileActions (
             {
                 // Only override with the target settings if we don't already have
                 // an action for in, out or error
-                if (GetFileActionForFD(STDIN_FILENO) == NULL)
+                if (GetFileActionForFD(STDIN_FILENO) == nullptr)
                     in_file_spec = target->GetStandardInputPath();
-                if (GetFileActionForFD(STDOUT_FILENO) == NULL)
+                if (GetFileActionForFD(STDOUT_FILENO) == nullptr)
                     out_file_spec = target->GetStandardOutputPath();
-                if (GetFileActionForFD(STDERR_FILENO) == NULL)
+                if (GetFileActionForFD(STDERR_FILENO) == nullptr)
                     err_file_spec = target->GetStandardErrorPath();
             }
 
@@ -366,27 +365,27 @@ ProcessLaunchInfo::FinalizeFileActions (
                 // this will have to do for now.
                 open_flags |= O_CLOEXEC;
 #endif
-                if (m_pty->OpenFirstAvailableMaster(open_flags, NULL, 0))
+                if (m_pty->OpenFirstAvailableMaster(open_flags, nullptr, 0))
                 {
-                    const FileSpec slave_file_spec{m_pty->GetSlaveName(NULL, 0), false};
+                    const FileSpec slave_file_spec{m_pty->GetSlaveName(nullptr, 0), false};
 
                     // Only use the slave tty if we don't have anything specified for
                     // input and don't have an action for stdin
-                    if (!in_file_spec && GetFileActionForFD(STDIN_FILENO) == NULL)
+                    if (!in_file_spec && GetFileActionForFD(STDIN_FILENO) == nullptr)
                     {
                         AppendOpenFileAction(STDIN_FILENO, slave_file_spec, true, false);
                     }
 
                     // Only use the slave tty if we don't have anything specified for
                     // output and don't have an action for stdout
-                    if (!out_file_spec && GetFileActionForFD(STDOUT_FILENO) == NULL)
+                    if (!out_file_spec && GetFileActionForFD(STDOUT_FILENO) == nullptr)
                     {
                         AppendOpenFileAction(STDOUT_FILENO, slave_file_spec, false, true);
                     }
 
                     // Only use the slave tty if we don't have anything specified for
                     // error and don't have an action for stderr
-                    if (!err_file_spec && GetFileActionForFD(STDERR_FILENO) == NULL)
+                    if (!err_file_spec && GetFileActionForFD(STDERR_FILENO) == nullptr)
                     {
                         AppendOpenFileAction(STDERR_FILENO, slave_file_spec, false, true);
                     }
@@ -396,7 +395,6 @@ ProcessLaunchInfo::FinalizeFileActions (
     }
 }
 
-
 bool
 ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell (Error &error,
                                                         bool localhost,
@@ -413,7 +411,7 @@ ProcessLaunchInfo::ConvertArgumentsForLa
             std::string shell_executable = m_shell.GetPath();
 
             const char **argv = GetArguments().GetConstArgumentVector ();
-            if (argv == NULL || argv[0] == NULL)
+            if (argv == nullptr || argv[0] == nullptr)
                 return false;
             Args shell_arguments;
             std::string safe_arg;
@@ -496,7 +494,7 @@ ProcessLaunchInfo::ConvertArgumentsForLa
             }
             else
             {
-                for (size_t i=0; argv[i] != NULL; ++i)
+                for (size_t i=0; argv[i] != nullptr; ++i)
                 {
                     const char *arg = Args::GetShellSafeArgument (argv[i], safe_arg);
                     shell_command.Printf(" %s", arg);

Modified: lldb/trunk/source/Target/RegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/RegisterContext.cpp?rev=261179&r1=261178&r2=261179&view=diff
==============================================================================
--- lldb/trunk/source/Target/RegisterContext.cpp (original)
+++ lldb/trunk/source/Target/RegisterContext.cpp Wed Feb 17 18:10:17 2016
@@ -32,12 +32,7 @@ RegisterContext::RegisterContext (Thread
 {
 }
 
-//----------------------------------------------------------------------
-// Destructor
-//----------------------------------------------------------------------
-RegisterContext::~RegisterContext()
-{
-}
+RegisterContext::~RegisterContext() = default;
 
 void
 RegisterContext::InvalidateIfNeeded (bool force)
@@ -61,7 +56,6 @@ RegisterContext::InvalidateIfNeeded (boo
     }
 }
 
-
 const RegisterInfo *
 RegisterContext::GetRegisterInfoByName (const char *reg_name, uint32_t start_idx)
 {
@@ -72,14 +66,14 @@ RegisterContext::GetRegisterInfoByName (
         {
             const RegisterInfo * reg_info = GetRegisterInfoAtIndex(reg);
 
-            if ((reg_info->name != NULL && ::strcasecmp (reg_info->name, reg_name) == 0) ||
-                (reg_info->alt_name != NULL && ::strcasecmp (reg_info->alt_name, reg_name) == 0))
+            if ((reg_info->name != nullptr && ::strcasecmp (reg_info->name, reg_name) == 0) ||
+                (reg_info->alt_name != nullptr && ::strcasecmp (reg_info->alt_name, reg_name) == 0))
             {
                 return reg_info;
             }
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 const RegisterInfo *
@@ -87,7 +81,7 @@ RegisterContext::GetRegisterInfo (lldb::
 {
     const uint32_t reg_num = ConvertRegisterKindToRegisterNumber(kind, num);
     if (reg_num == LLDB_INVALID_REGNUM)
-        return NULL;
+        return nullptr;
     return GetRegisterInfoAtIndex (reg_num);
 }
 
@@ -97,7 +91,7 @@ RegisterContext::GetRegisterName (uint32
     const RegisterInfo * reg_info = GetRegisterInfoAtIndex(reg);
     if (reg_info)
         return reg_info->name;
-    return NULL;
+    return nullptr;
 }
 
 uint64_t
@@ -191,7 +185,6 @@ RegisterContext::GetFlags (uint64_t fail
     return ReadRegisterAsUnsigned (reg, fail_value);
 }
 
-
 uint64_t
 RegisterContext::ReadRegisterAsUnsigned (uint32_t reg, uint64_t fail_value)
 {
@@ -297,7 +290,6 @@ RegisterContext::ClearHardwareBreakpoint
     return false;
 }
 
-
 uint32_t
 RegisterContext::NumSupportedHardwareWatchpoints ()
 {
@@ -329,13 +321,12 @@ RegisterContext::ReadRegisterValueFromMe
                                               RegisterValue &reg_value)
 {
     Error error;
-    if (reg_info == NULL)
+    if (reg_info == nullptr)
     {
         error.SetErrorString ("invalid register info argument.");
         return error;
     }
 
-    
     // Moving from addr into a register
     //
     // Case 1: src_len == dst_len
@@ -408,7 +399,6 @@ RegisterContext::WriteRegisterValueToMem
                                              uint32_t dst_len, 
                                              const RegisterValue &reg_value)
 {
-    
     uint8_t dst[RegisterValue::kMaxRegisterByteSize];
 
     Error error;
@@ -451,7 +441,6 @@ RegisterContext::WriteRegisterValueToMem
         error.SetErrorString("invalid process");
 
     return error;
-
 }
 
 bool
@@ -472,7 +461,6 @@ RegisterContext::CalculateTarget ()
     return m_thread.CalculateTarget();
 }
 
-
 ProcessSP
 RegisterContext::CalculateProcess ()
 {
@@ -500,7 +488,6 @@ RegisterContext::CalculateExecutionConte
     m_thread.CalculateExecutionContext (exe_ctx);
 }
 
-
 bool
 RegisterContext::ConvertBetweenRegisterKinds (lldb::RegisterKind source_rk, uint32_t source_regnum, lldb::RegisterKind target_rk, uint32_t& target_regnum)
 {
@@ -512,14 +499,7 @@ RegisterContext::ConvertBetweenRegisterK
         if (reg_info->kinds[source_rk] == source_regnum)
         {
             target_regnum = reg_info->kinds[target_rk];
-            if (target_regnum == LLDB_INVALID_REGNUM)
-            {
-                return false;
-            }
-            else
-            {
-                return true;
-            }
+            return (target_regnum != LLDB_INVALID_REGNUM);
         } 
     }
     return false;




More information about the lldb-commits mailing list