[Lldb-commits] [lldb] r252374 - Fix some Clang-tidy warnings and formatting in recently added code.

Eugene Zelenko via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 6 16:28:50 PST 2015


Author: eugenezelenko
Date: Fri Nov  6 18:28:50 2015
New Revision: 252374

URL: http://llvm.org/viewvc/llvm-project?rev=252374&view=rev
Log:
Fix some Clang-tidy warnings and formatting in recently added code.

Fixed Clang-tidy warnings:

* modernize-use-override;
* modernize-use-nullptr;
* modernize-use-default;
* readability-simplify-boolean-expr.

Modified:
    lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.h
    lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp
    lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp
    lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h

Modified: lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp?rev=252374&r1=252373&r2=252374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp Fri Nov  6 18:28:50 2015
@@ -1,4 +1,4 @@
-//===-- GoUserExpression.cpp ---------------------------------*- C++ -*-===//
+//===-- GoUserExpression.cpp ------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,16 +7,23 @@
 //
 //===----------------------------------------------------------------------===//
 
+// C Includes
 #include <stdio.h>
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 
+// C++ Includes
 #include <cstdlib>
+#include <memory>
 #include <string>
-#include <map>
 #include <vector>
 
+// Other libraries and framework includes
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringMap.h"
+
+// Project includes
 #include "GoUserExpression.h"
 
 #include "lldb/lldb-private.h"
@@ -41,8 +48,6 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadPlan.h"
 #include "lldb/Target/ThreadPlanCallUserExpression.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/StringMap.h"
 
 #include "Plugins/ExpressionParser/Go/GoAST.h"
 #include "Plugins/ExpressionParser/Go/GoParser.h"
@@ -86,6 +91,7 @@ class GoUserExpression::GoInterpreter
         m_parser.GetError(m_error);
         return nullptr;
     }
+
     ValueObjectSP VisitParenExpr(const GoASTParenExpr *e);
     ValueObjectSP VisitIdent(const GoASTIdent *e);
     ValueObjectSP VisitStarExpr(const GoASTStarExpr *e);
@@ -94,66 +100,79 @@ class GoUserExpression::GoInterpreter
     ValueObjectSP VisitIndexExpr(const GoASTIndexExpr *e);
     ValueObjectSP VisitUnaryExpr(const GoASTUnaryExpr *e);
     ValueObjectSP VisitCallExpr(const GoASTCallExpr *e);
+
     ValueObjectSP
     VisitTypeAssertExpr(const GoASTTypeAssertExpr *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitBinaryExpr(const GoASTBinaryExpr *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitArrayType(const GoASTArrayType *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitChanType(const GoASTChanType *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitCompositeLit(const GoASTCompositeLit *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitEllipsis(const GoASTEllipsis *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitFuncType(const GoASTFuncType *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitFuncLit(const GoASTFuncLit *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitInterfaceType(const GoASTInterfaceType *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitKeyValueExpr(const GoASTKeyValueExpr *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitMapType(const GoASTMapType *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitSliceExpr(const GoASTSliceExpr *e)
     {
         return NotImplemented(e);
     }
+
     ValueObjectSP
     VisitStructType(const GoASTStructType *e)
     {
@@ -217,6 +236,7 @@ LookupType(TargetSP target, ConstString
     }
     return CompilerType();
 }
+
 GoUserExpression::GoUserExpression(ExecutionContextScope &exe_scope, const char *expr, const char *expr_prefix,
                                    lldb::LanguageType language, ResultType desired_type,
                                    const EvaluateExpressionOptions &options)
@@ -531,7 +551,7 @@ GoUserExpression::GoInterpreter::VisitBa
         return nullptr;
     }
     errno = 0;
-    int64_t intvalue = strtol(value.c_str(), NULL, 0);
+    int64_t intvalue = strtol(value.c_str(), nullptr, 0);
     if (errno != 0)
     {
         m_error.SetErrorToErrno();
@@ -731,6 +751,6 @@ GoPersistentExpressionState::RemovePersi
     if (*(name++) != 'o')
         return;
 
-    if (strtoul(name, NULL, 0) == m_next_persistent_variable_id - 1)
+    if (strtoul(name, nullptr, 0) == m_next_persistent_variable_id - 1)
         m_next_persistent_variable_id--;
 }

Modified: lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.h?rev=252374&r1=252373&r2=252374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.h (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.h Fri Nov  6 18:28:50 2015
@@ -1,4 +1,4 @@
-//===-- GoUserExpression.h -----------------------------------*- C++ -*-===//
+//===-- GoUserExpression.h --------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -12,13 +12,10 @@
 
 // C Includes
 // C++ Includes
-#include <string>
-#include <map>
-#include <vector>
+#include <memory>
 
 // Other libraries and framework includes
 // Project includes
-
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Expression/UserExpression.h"
@@ -68,13 +65,15 @@ class GoUserExpression : public UserExpr
     GoUserExpression(ExecutionContextScope &exe_scope, const char *expr, const char *expr_prefix,
                      lldb::LanguageType language, ResultType desired_type, const EvaluateExpressionOptions &options);
 
-    virtual bool Parse(Stream &error_stream, ExecutionContext &exe_ctx, lldb_private::ExecutionPolicy execution_policy,
-                       bool keep_result_in_memory, bool generate_debug_info) override;
+    bool
+    Parse(Stream &error_stream, ExecutionContext &exe_ctx, lldb_private::ExecutionPolicy execution_policy,
+          bool keep_result_in_memory, bool generate_debug_info) override;
 
-    virtual lldb::ExpressionResults Execute(Stream &error_stream, ExecutionContext &exe_ctx,
-                                            const EvaluateExpressionOptions &options,
-                                            lldb::UserExpressionSP &shared_ptr_to_me,
-                                            lldb::ExpressionVariableSP &result) override;
+    lldb::ExpressionResults
+    Execute(Stream &error_stream, ExecutionContext &exe_ctx,
+            const EvaluateExpressionOptions &options,
+            lldb::UserExpressionSP &shared_ptr_to_me,
+            lldb::ExpressionVariableSP &result) override;
 
     bool
     CanInterpret() override

Modified: lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp?rev=252374&r1=252373&r2=252374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp (original)
+++ lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp Fri Nov  6 18:28:50 2015
@@ -10,7 +10,6 @@
 // C Includes
 // C++ Includes
 #include <map>
-#include <vector>
 
 // Other libraries and framework includes
 // Project includes
@@ -169,6 +168,6 @@ lldb_private::formatters::GoSliceSynthet
 
     lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
     if (!process_sp)
-        return NULL;
+        return nullptr;
     return new GoSliceSyntheticFrontEnd(*valobj_sp);
 }

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp?rev=252374&r1=252373&r2=252374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp Fri Nov  6 18:28:50 2015
@@ -1,4 +1,4 @@
-//===-- NSError.cpp ----------------------------------------------*- C++ -*-===//
+//===-- NSError.cpp ---------------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,6 +7,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+#include "clang/AST/DeclCXX.h"
+
+// Project includes
 #include "Cocoa.h"
 
 #include "lldb/Core/DataBufferHeap.h"
@@ -22,8 +28,6 @@
 
 #include "lldb/Utility/ProcessStructReader.h"
 
-#include "clang/AST/DeclCXX.h"
-
 #include "Plugins/Language/ObjC/NSString.h"
 
 using namespace lldb;
@@ -96,9 +100,12 @@ public:
     NSErrorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
     SyntheticChildrenFrontEnd(*valobj_sp)
     {}
-    
-    virtual size_t
-    CalculateNumChildren ()
+
+    ~NSErrorSyntheticFrontEnd() override = default;
+    // no need to delete m_child_ptr - it's kept alive by the cluster manager on our behalf
+
+    size_t
+    CalculateNumChildren() override
     {
         if (m_child_ptr)
             return 1;
@@ -107,8 +114,8 @@ public:
         return 0;
     }
     
-    virtual lldb::ValueObjectSP
-    GetChildAtIndex (size_t idx)
+    lldb::ValueObjectSP
+    GetChildAtIndex(size_t idx) override
     {
         if (idx != 0)
             return lldb::ValueObjectSP();
@@ -118,8 +125,8 @@ public:
         return m_child_sp;
     }
     
-    virtual bool
-    Update()
+    bool
+    Update() override
     {
         m_child_ptr = nullptr;
         m_child_sp.reset();
@@ -158,27 +165,21 @@ public:
         return false;
     }
     
-    virtual bool
-    MightHaveChildren ()
+    bool
+    MightHaveChildren() override
     {
         return true;
     }
     
-    virtual size_t
-    GetIndexOfChildWithName (const ConstString &name)
+    size_t
+    GetIndexOfChildWithName(const ConstString &name) override
     {
         static ConstString g___userInfo("_userInfo");
         if (name == g___userInfo)
             return 0;
         return UINT32_MAX;
     }
-    
-    virtual
-    ~NSErrorSyntheticFrontEnd ()
-    {
-        // no need to delete m_child_ptr - it's kept alive by the cluster manager on our behalf
-    }
-    
+
 private:
     // the child here can be "real" (i.e. an actual child of the root) or synthetized from raw memory
     // if the former, I need to store a plain pointer to it - or else a loop of references will cause this entire hierarchy of values to leak
@@ -215,4 +216,3 @@ lldb_private::formatters::NSErrorSynthet
     
     return nullptr;
 }
-

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp?rev=252374&r1=252373&r2=252374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp Fri Nov  6 18:28:50 2015
@@ -1,4 +1,4 @@
-//===-- NSException.cpp ----------------------------------------------*- C++ -*-===//
+//===-- NSException.cpp -----------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,6 +7,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+#include "clang/AST/DeclCXX.h"
+
+// Project includes
 #include "Cocoa.h"
 
 #include "lldb/Core/DataBufferHeap.h"
@@ -22,8 +28,6 @@
 
 #include "lldb/Utility/ProcessStructReader.h"
 
-#include "clang/AST/DeclCXX.h"
-
 #include "Plugins/Language/ObjC/NSString.h"
 
 using namespace lldb;
@@ -79,8 +83,8 @@ lldb_private::formatters::NSException_Su
     StreamString reason_str_summary;
     if (NSStringSummaryProvider(*name_sp, name_str_summary, options) &&
         NSStringSummaryProvider(*reason_sp, reason_str_summary, options) &&
-        name_str_summary.Empty() == false &&
-        reason_str_summary.Empty() == false)
+        !name_str_summary.Empty() &&
+        !reason_str_summary.Empty())
     {
         stream.Printf("name: %s - reason: %s", name_str_summary.GetData(), reason_str_summary.GetData());
         return true;
@@ -95,9 +99,12 @@ public:
     NSExceptionSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
     SyntheticChildrenFrontEnd(*valobj_sp)
     {}
-    
-    virtual size_t
-    CalculateNumChildren ()
+
+    ~NSExceptionSyntheticFrontEnd() override = default;
+    // no need to delete m_child_ptr - it's kept alive by the cluster manager on our behalf
+
+    size_t
+    CalculateNumChildren() override
     {
         if (m_child_ptr)
             return 1;
@@ -106,8 +113,8 @@ public:
         return 0;
     }
     
-    virtual lldb::ValueObjectSP
-    GetChildAtIndex (size_t idx)
+    lldb::ValueObjectSP
+    GetChildAtIndex(size_t idx) override
     {
         if (idx != 0)
             return lldb::ValueObjectSP();
@@ -117,8 +124,8 @@ public:
         return m_child_sp;
     }
     
-    virtual bool
-    Update()
+    bool
+    Update() override
     {
         m_child_ptr = nullptr;
         m_child_sp.reset();
@@ -157,27 +164,21 @@ public:
         return false;
     }
     
-    virtual bool
-    MightHaveChildren ()
+    bool
+    MightHaveChildren() override
     {
         return true;
     }
     
-    virtual size_t
-    GetIndexOfChildWithName (const ConstString &name)
+    size_t
+    GetIndexOfChildWithName(const ConstString &name) override
     {
         static ConstString g___userInfo("userInfo");
         if (name == g___userInfo)
             return 0;
         return UINT32_MAX;
     }
-    
-    virtual
-    ~NSExceptionSyntheticFrontEnd ()
-    {
-        // no need to delete m_child_ptr - it's kept alive by the cluster manager on our behalf
-    }
-    
+
 private:
     // the child here can be "real" (i.e. an actual child of the root) or synthetized from raw memory
     // if the former, I need to store a plain pointer to it - or else a loop of references will cause this entire hierarchy of values to leak
@@ -216,4 +217,3 @@ lldb_private::formatters::NSExceptionSyn
     
     return nullptr;
 }
-

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp?rev=252374&r1=252373&r2=252374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp Fri Nov  6 18:28:50 2015
@@ -7,12 +7,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PlatformRemoteAppleTV.h"
-
 // C Includes
 // C++ Includes
+#include <string>
+#include <vector>
+
 // Other libraries and framework includes
 // Project includes
+#include "PlatformRemoteAppleTV.h"
+
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Error.h"
@@ -29,6 +32,20 @@
 using namespace lldb;
 using namespace lldb_private;
 
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+PlatformRemoteAppleTV::PlatformRemoteAppleTV () :
+    PlatformDarwin (false),    // This is a remote platform
+    m_sdk_directory_infos(),
+    m_device_support_directory(),
+    m_device_support_directory_for_os_version (),
+    m_build_update(),
+    m_last_module_sdk_idx (UINT32_MAX),
+    m_connected_module_sdk_idx (UINT32_MAX)
+{
+}
+
 PlatformRemoteAppleTV::SDKDirectoryInfo::SDKDirectoryInfo (const lldb_private::FileSpec &sdk_dir) :
     directory(sdk_dir),
     build(),
@@ -91,7 +108,7 @@ PlatformSP
 PlatformRemoteAppleTV::CreateInstance (bool force, const ArchSpec *arch)
 {
     bool create = force;
-    if (create == false && arch && arch->IsValid())
+    if (!create && arch && arch->IsValid())
     {
         switch (arch->GetMachine())
         {
@@ -151,7 +168,6 @@ PlatformRemoteAppleTV::CreateInstance (b
     return lldb::PlatformSP();
 }
 
-
 lldb_private::ConstString
 PlatformRemoteAppleTV::GetPluginNameStatic ()
 {
@@ -165,32 +181,6 @@ PlatformRemoteAppleTV::GetDescriptionSta
     return "Remote Apple TV platform plug-in.";
 }
 
-
-//------------------------------------------------------------------
-/// Default Constructor
-//------------------------------------------------------------------
-PlatformRemoteAppleTV::PlatformRemoteAppleTV () :
-    PlatformDarwin (false),    // This is a remote platform
-    m_sdk_directory_infos(),
-    m_device_support_directory(),
-    m_device_support_directory_for_os_version (),
-    m_build_update(),
-    m_last_module_sdk_idx (UINT32_MAX),
-    m_connected_module_sdk_idx (UINT32_MAX)
-{
-}
-
-//------------------------------------------------------------------
-/// Destructor.
-///
-/// The destructor is virtual since this class is designed to be
-/// inherited from by the plug-in instance.
-//------------------------------------------------------------------
-PlatformRemoteAppleTV::~PlatformRemoteAppleTV()
-{
-}
-
-
 void
 PlatformRemoteAppleTV::GetStatus (Stream &strm)
 {
@@ -211,7 +201,6 @@ PlatformRemoteAppleTV::GetStatus (Stream
     }
 }
 
-
 Error
 PlatformRemoteAppleTV::ResolveExecutable (const ModuleSpec &ms,
                                           lldb::ModuleSP &exe_module_sp,
@@ -230,11 +219,11 @@ PlatformRemoteAppleTV::ResolveExecutable
     {
         if (resolved_module_spec.GetArchitecture().IsValid() || resolved_module_spec.GetUUID().IsValid())
         {
-            error = ModuleList::GetSharedModule (resolved_module_spec,
-                                                 exe_module_sp, 
-                                                 NULL,
-                                                 NULL, 
-                                                 NULL);
+            error = ModuleList::GetSharedModule(resolved_module_spec,
+                                                exe_module_sp,
+                                                nullptr,
+                                                nullptr,
+                                                nullptr);
         
             if (exe_module_sp && exe_module_sp->GetObjectFile())
                 return error;
@@ -246,11 +235,11 @@ PlatformRemoteAppleTV::ResolveExecutable
         StreamString arch_names;
         for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, resolved_module_spec.GetArchitecture()); ++idx)
         {
-            error = ModuleList::GetSharedModule (resolved_module_spec,
-                                                 exe_module_sp, 
-                                                 NULL,
-                                                 NULL, 
-                                                 NULL);
+            error = ModuleList::GetSharedModule(resolved_module_spec,
+                                                exe_module_sp,
+                                                nullptr,
+                                                nullptr,
+                                                nullptr);
             // Did we find an executable using one of the 
             if (error.Success())
             {
@@ -454,13 +443,13 @@ PlatformRemoteAppleTV::GetSDKDirectoryFo
                     return &m_sdk_directory_infos[i];
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 const PlatformRemoteAppleTV::SDKDirectoryInfo *
 PlatformRemoteAppleTV::GetSDKDirectoryForLatestOSVersion ()
 {
-    const PlatformRemoteAppleTV::SDKDirectoryInfo *result = NULL;
+    const PlatformRemoteAppleTV::SDKDirectoryInfo *result = nullptr;
     if (UpdateSDKDirectoryInfosIfNeeded())
     {
         const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
@@ -470,7 +459,7 @@ PlatformRemoteAppleTV::GetSDKDirectoryFo
             const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
             if (sdk_dir_info.version_major != UINT32_MAX)
             {
-                if (result == NULL || sdk_dir_info.version_major > result->version_major)
+                if (result == nullptr || sdk_dir_info.version_major > result->version_major)
                 {
                     result = &sdk_dir_info;
                 }
@@ -494,8 +483,6 @@ PlatformRemoteAppleTV::GetSDKDirectoryFo
     return result;
 }
 
-
-
 const char *
 PlatformRemoteAppleTV::GetDeviceSupportDirectory()
 {
@@ -519,10 +506,9 @@ PlatformRemoteAppleTV::GetDeviceSupportD
     assert (m_device_support_directory.empty() == false);
     if (m_device_support_directory[0])
         return m_device_support_directory.c_str();
-    return NULL;
+    return nullptr;
 }
             
-
 const char *
 PlatformRemoteAppleTV::GetDeviceSupportDirectoryForOSVersion()
 {
@@ -532,7 +518,7 @@ PlatformRemoteAppleTV::GetDeviceSupportD
     if (m_device_support_directory_for_os_version.empty())
     {
         const PlatformRemoteAppleTV::SDKDirectoryInfo *sdk_dir_info = GetSDKDirectoryForCurrentOSVersion ();
-        if (sdk_dir_info == NULL)
+        if (sdk_dir_info == nullptr)
             sdk_dir_info = GetSDKDirectoryForLatestOSVersion ();
         if (sdk_dir_info)
         {
@@ -555,7 +541,7 @@ PlatformRemoteAppleTV::GetDeviceSupportD
     assert (m_device_support_directory_for_os_version.empty() == false);
     if (m_device_support_directory_for_os_version[0])
         return m_device_support_directory_for_os_version.c_str();
-    return NULL;
+    return nullptr;
 }
 
 uint32_t
@@ -602,7 +588,6 @@ PlatformRemoteAppleTV::GetFileInSDK (con
     return false;
 }
 
-
 bool
 PlatformRemoteAppleTV::GetFileInSDKRoot (const char *platform_file_path,
                                      const char *sdkroot_path,
@@ -648,7 +633,6 @@ PlatformRemoteAppleTV::GetFileInSDKRoot
     return false;
 }
 
-
 Error
 PlatformRemoteAppleTV::GetSymbolFile (const FileSpec &platform_file,
                                   const UUID *uuid_ptr,
@@ -741,9 +725,9 @@ PlatformRemoteAppleTV::GetSharedModule (
             if (GetFileInSDK (platform_file_path, connected_sdk_idx, platform_module_spec.GetFileSpec()))
             {
                 module_sp.reset();
-                error = ResolveExecutable (platform_module_spec,
-                                           module_sp,
-                                           NULL);
+                error = ResolveExecutable(platform_module_spec,
+                                          module_sp,
+                                          nullptr);
                 if (module_sp)
                 {
                     m_last_module_sdk_idx = connected_sdk_idx;
@@ -760,9 +744,9 @@ PlatformRemoteAppleTV::GetSharedModule (
             if (GetFileInSDK (platform_file_path, m_last_module_sdk_idx, platform_module_spec.GetFileSpec()))
             {
                 module_sp.reset();
-                error = ResolveExecutable (platform_module_spec,
-                                           module_sp,
-                                           NULL);
+                error = ResolveExecutable(platform_module_spec,
+                                          module_sp,
+                                          nullptr);
                 if (module_sp)
                 {
                     error.Clear();
@@ -784,7 +768,7 @@ PlatformRemoteAppleTV::GetSharedModule (
             {
                 //printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str());
                 
-                error = ResolveExecutable (platform_module_spec, module_sp, NULL);
+                error = ResolveExecutable(platform_module_spec, module_sp, nullptr);
                 if (module_sp)
                 {
                     // Remember the index of the last SDK that we found a file
@@ -869,7 +853,6 @@ PlatformRemoteAppleTV::GetSupportedArchi
             default: break;
         }
         break;
-
     }
     arch.Clear();
     return false;

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h?rev=252374&r1=252373&r2=252374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h Fri Nov  6 18:28:50 2015
@@ -12,15 +12,20 @@
 
 // C Includes
 // C++ Includes
+#include <string>
+
 // Other libraries and framework includes
+// Project includes
 #include "lldb/Host/FileSpec.h"
 
-// Project includes
 #include "PlatformDarwin.h"
 
 class PlatformRemoteAppleTV : public PlatformDarwin
 {
 public:
+    PlatformRemoteAppleTV();
+
+    ~PlatformRemoteAppleTV() override = default;
 
     //------------------------------------------------------------
     // Class Functions
@@ -43,11 +48,6 @@ public:
     //------------------------------------------------------------
     // Class Methods
     //------------------------------------------------------------
-    PlatformRemoteAppleTV ();
-
-    virtual
-    ~PlatformRemoteAppleTV();
-
     //------------------------------------------------------------
     // lldb_private::PluginInterface functions
     //------------------------------------------------------------
@@ -166,7 +166,6 @@ protected:
 
 private:
     DISALLOW_COPY_AND_ASSIGN (PlatformRemoteAppleTV);
-
 };
 
-#endif  // liblldb_PlatformRemoteAppleTV_h_
+#endif // liblldb_PlatformRemoteAppleTV_h_

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp?rev=252374&r1=252373&r2=252374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp Fri Nov  6 18:28:50 2015
@@ -7,12 +7,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "PlatformRemoteAppleWatch.h"
-
 // C Includes
 // C++ Includes
+#include <string>
+#include <vector>
+
 // Other libraries and framework includes
 // Project includes
+#include "PlatformRemoteAppleWatch.h"
+
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Error.h"
@@ -29,6 +32,20 @@
 using namespace lldb;
 using namespace lldb_private;
 
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+PlatformRemoteAppleWatch::PlatformRemoteAppleWatch () :
+    PlatformDarwin (false),    // This is a remote platform
+    m_sdk_directory_infos(),
+    m_device_support_directory(),
+    m_device_support_directory_for_os_version (),
+    m_build_update(),
+    m_last_module_sdk_idx (UINT32_MAX),
+    m_connected_module_sdk_idx (UINT32_MAX)
+{
+}
+
 PlatformRemoteAppleWatch::SDKDirectoryInfo::SDKDirectoryInfo (const lldb_private::FileSpec &sdk_dir) :
     directory(sdk_dir),
     build(),
@@ -91,7 +108,7 @@ PlatformSP
 PlatformRemoteAppleWatch::CreateInstance (bool force, const ArchSpec *arch)
 {
     bool create = force;
-    if (create == false && arch && arch->IsValid())
+    if (!create && arch && arch->IsValid())
     {
         switch (arch->GetMachine())
         {
@@ -154,13 +171,11 @@ PlatformRemoteAppleWatch::CreateInstance
     }
 #endif
 
-
     if (create)
         return lldb::PlatformSP(new PlatformRemoteAppleWatch ());
     return lldb::PlatformSP();
 }
 
-
 lldb_private::ConstString
 PlatformRemoteAppleWatch::GetPluginNameStatic ()
 {
@@ -174,32 +189,6 @@ PlatformRemoteAppleWatch::GetDescription
     return "Remote Apple Watch platform plug-in.";
 }
 
-
-//------------------------------------------------------------------
-/// Default Constructor
-//------------------------------------------------------------------
-PlatformRemoteAppleWatch::PlatformRemoteAppleWatch () :
-    PlatformDarwin (false),    // This is a remote platform
-    m_sdk_directory_infos(),
-    m_device_support_directory(),
-    m_device_support_directory_for_os_version (),
-    m_build_update(),
-    m_last_module_sdk_idx (UINT32_MAX),
-    m_connected_module_sdk_idx (UINT32_MAX)
-{
-}
-
-//------------------------------------------------------------------
-/// Destructor.
-///
-/// The destructor is virtual since this class is designed to be
-/// inherited from by the plug-in instance.
-//------------------------------------------------------------------
-PlatformRemoteAppleWatch::~PlatformRemoteAppleWatch()
-{
-}
-
-
 void
 PlatformRemoteAppleWatch::GetStatus (Stream &strm)
 {
@@ -220,7 +209,6 @@ PlatformRemoteAppleWatch::GetStatus (Str
     }
 }
 
-
 Error
 PlatformRemoteAppleWatch::ResolveExecutable (const ModuleSpec &ms,
                                           lldb::ModuleSP &exe_module_sp,
@@ -239,11 +227,11 @@ PlatformRemoteAppleWatch::ResolveExecuta
     {
         if (resolved_module_spec.GetArchitecture().IsValid() || resolved_module_spec.GetUUID().IsValid())
         {
-            error = ModuleList::GetSharedModule (resolved_module_spec,
-                                                 exe_module_sp, 
-                                                 NULL,
-                                                 NULL, 
-                                                 NULL);
+            error = ModuleList::GetSharedModule(resolved_module_spec,
+                                                exe_module_sp,
+                                                nullptr,
+                                                nullptr,
+                                                nullptr);
         
             if (exe_module_sp && exe_module_sp->GetObjectFile())
                 return error;
@@ -255,11 +243,11 @@ PlatformRemoteAppleWatch::ResolveExecuta
         StreamString arch_names;
         for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, resolved_module_spec.GetArchitecture()); ++idx)
         {
-            error = ModuleList::GetSharedModule (resolved_module_spec,
-                                                 exe_module_sp, 
-                                                 NULL,
-                                                 NULL, 
-                                                 NULL);
+            error = ModuleList::GetSharedModule(resolved_module_spec,
+                                                exe_module_sp,
+                                                nullptr,
+                                                nullptr,
+                                                nullptr);
             // Did we find an executable using one of the 
             if (error.Success())
             {
@@ -455,13 +443,13 @@ PlatformRemoteAppleWatch::GetSDKDirector
                     return &m_sdk_directory_infos[i];
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 const PlatformRemoteAppleWatch::SDKDirectoryInfo *
 PlatformRemoteAppleWatch::GetSDKDirectoryForLatestOSVersion ()
 {
-    const PlatformRemoteAppleWatch::SDKDirectoryInfo *result = NULL;
+    const PlatformRemoteAppleWatch::SDKDirectoryInfo *result = nullptr;
     if (UpdateSDKDirectoryInfosIfNeeded())
     {
         const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
@@ -471,7 +459,7 @@ PlatformRemoteAppleWatch::GetSDKDirector
             const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
             if (sdk_dir_info.version_major != UINT32_MAX)
             {
-                if (result == NULL || sdk_dir_info.version_major > result->version_major)
+                if (result == nullptr || sdk_dir_info.version_major > result->version_major)
                 {
                     result = &sdk_dir_info;
                 }
@@ -495,8 +483,6 @@ PlatformRemoteAppleWatch::GetSDKDirector
     return result;
 }
 
-
-
 const char *
 PlatformRemoteAppleWatch::GetDeviceSupportDirectory()
 {
@@ -531,9 +517,8 @@ PlatformRemoteAppleWatch::GetDeviceSuppo
     assert (m_device_support_directory.empty() == false);
     if (m_device_support_directory[0])
         return m_device_support_directory.c_str();
-    return NULL;
+    return nullptr;
 }
-            
 
 const char *
 PlatformRemoteAppleWatch::GetDeviceSupportDirectoryForOSVersion()
@@ -544,7 +529,7 @@ PlatformRemoteAppleWatch::GetDeviceSuppo
     if (m_device_support_directory_for_os_version.empty())
     {
         const PlatformRemoteAppleWatch::SDKDirectoryInfo *sdk_dir_info = GetSDKDirectoryForCurrentOSVersion ();
-        if (sdk_dir_info == NULL)
+        if (sdk_dir_info == nullptr)
             sdk_dir_info = GetSDKDirectoryForLatestOSVersion ();
         if (sdk_dir_info)
         {
@@ -567,7 +552,7 @@ PlatformRemoteAppleWatch::GetDeviceSuppo
     assert (m_device_support_directory_for_os_version.empty() == false);
     if (m_device_support_directory_for_os_version[0])
         return m_device_support_directory_for_os_version.c_str();
-    return NULL;
+    return nullptr;
 }
 
 uint32_t
@@ -614,7 +599,6 @@ PlatformRemoteAppleWatch::GetFileInSDK (
     return false;
 }
 
-
 bool
 PlatformRemoteAppleWatch::GetFileInSDKRoot (const char *platform_file_path,
                                      const char *sdkroot_path,
@@ -660,7 +644,6 @@ PlatformRemoteAppleWatch::GetFileInSDKRo
     return false;
 }
 
-
 Error
 PlatformRemoteAppleWatch::GetSymbolFile (const FileSpec &platform_file,
                                   const UUID *uuid_ptr,
@@ -753,9 +736,9 @@ PlatformRemoteAppleWatch::GetSharedModul
             if (GetFileInSDK (platform_file_path, connected_sdk_idx, platform_module_spec.GetFileSpec()))
             {
                 module_sp.reset();
-                error = ResolveExecutable (platform_module_spec,
-                                           module_sp,
-                                           NULL);
+                error = ResolveExecutable(platform_module_spec,
+                                          module_sp,
+                                          nullptr);
                 if (module_sp)
                 {
                     m_last_module_sdk_idx = connected_sdk_idx;
@@ -772,9 +755,9 @@ PlatformRemoteAppleWatch::GetSharedModul
             if (GetFileInSDK (platform_file_path, m_last_module_sdk_idx, platform_module_spec.GetFileSpec()))
             {
                 module_sp.reset();
-                error = ResolveExecutable (platform_module_spec,
-                                           module_sp,
-                                           NULL);
+                error = ResolveExecutable(platform_module_spec,
+                                          module_sp,
+                                          nullptr);
                 if (module_sp)
                 {
                     error.Clear();
@@ -796,7 +779,7 @@ PlatformRemoteAppleWatch::GetSharedModul
             {
                 //printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str());
                 
-                error = ResolveExecutable (platform_module_spec, module_sp, NULL);
+                error = ResolveExecutable(platform_module_spec, module_sp, nullptr);
                 if (module_sp)
                 {
                     // Remember the index of the last SDK that we found a file
@@ -902,7 +885,6 @@ PlatformRemoteAppleWatch::GetSupportedAr
             default: break;
         }
         break;
-
     }
     arch.Clear();
     return false;
@@ -936,4 +918,3 @@ PlatformRemoteAppleWatch::GetConnectedSD
     }
     return m_connected_module_sdk_idx;
 }
-

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h?rev=252374&r1=252373&r2=252374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h Fri Nov  6 18:28:50 2015
@@ -12,15 +12,21 @@
 
 // C Includes
 // C++ Includes
+#include <string>
+#include <vector>
+
 // Other libraries and framework includes
+// Project includes
 #include "lldb/Host/FileSpec.h"
 
-// Project includes
 #include "PlatformDarwin.h"
 
 class PlatformRemoteAppleWatch : public PlatformDarwin
 {
 public:
+    PlatformRemoteAppleWatch();
+
+    ~PlatformRemoteAppleWatch() override = default;
 
     //------------------------------------------------------------
     // Class Functions
@@ -43,10 +49,6 @@ public:
     //------------------------------------------------------------
     // Class Methods
     //------------------------------------------------------------
-    PlatformRemoteAppleWatch ();
-
-    virtual
-    ~PlatformRemoteAppleWatch();
 
     //------------------------------------------------------------
     // lldb_private::PluginInterface functions
@@ -166,7 +168,6 @@ protected:
 
 private:
     DISALLOW_COPY_AND_ASSIGN (PlatformRemoteAppleWatch);
-
 };
 
-#endif  // liblldb_PlatformRemoteAppleWatch_h_
+#endif // liblldb_PlatformRemoteAppleWatch_h_




More information about the lldb-commits mailing list