[Lldb-commits] [lldb] r251587 - Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/Expression and Host; other minor fixes.

Eugene Zelenko via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 28 17:27:25 PDT 2015


Author: eugenezelenko
Date: Wed Oct 28 19:27:24 2015
New Revision: 251587

URL: http://llvm.org/viewvc/llvm-project?rev=251587&view=rev
Log:
Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/Expression and Host; other minor fixes.

Modified:
    lldb/trunk/include/lldb/Expression/ExpressionVariable.h
    lldb/trunk/include/lldb/Expression/FunctionCaller.h
    lldb/trunk/include/lldb/Expression/IRExecutionUnit.h
    lldb/trunk/include/lldb/Expression/Materializer.h
    lldb/trunk/include/lldb/Expression/UserExpression.h
    lldb/trunk/include/lldb/Expression/UtilityFunction.h
    lldb/trunk/include/lldb/Host/Condition.h
    lldb/trunk/include/lldb/Host/Debug.h
    lldb/trunk/include/lldb/Host/File.h
    lldb/trunk/include/lldb/Host/FileSpec.h
    lldb/trunk/include/lldb/Host/Mutex.h
    lldb/trunk/include/lldb/Host/Predicate.h
    lldb/trunk/include/lldb/Host/ProcessRunLock.h
    lldb/trunk/include/lldb/Host/XML.h

Modified: lldb/trunk/include/lldb/Expression/ExpressionVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionVariable.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ExpressionVariable.h (original)
+++ lldb/trunk/include/lldb/Expression/ExpressionVariable.h Wed Oct 28 19:27:24 2015
@@ -10,7 +10,9 @@
 #ifndef liblldb_ExpressionVariable_h_
 #define liblldb_ExpressionVariable_h_
 
+// C Includes
 // C++ Includes
+#include <memory>
 #include <vector>
 
 // Other libraries and framework includes
@@ -44,7 +46,9 @@ public:
         m_kind(kind)
     {
     }
-    
+
+    virtual ~ExpressionVariable();
+
     size_t
     GetByteSize ()
     {
@@ -110,18 +114,16 @@ public:
     void
     TransferAddress (bool force = false)
     {
-        if (m_live_sp.get() == NULL)
+        if (m_live_sp.get() == nullptr)
             return;
         
-        if (m_frozen_sp.get() == NULL)
+        if (m_frozen_sp.get() == nullptr)
             return;
         
         if (force || (m_frozen_sp->GetLiveAddress() == LLDB_INVALID_ADDRESS))
             m_frozen_sp->SetLiveAddress(m_live_sp->GetLiveAddress());
     }
     
-    virtual ~ExpressionVariable();
-
     enum Flags
     {
         EVNone                  = 0,
@@ -207,7 +209,7 @@ public:
     ///     The name of the requested variable.
     ///
     /// @return
-    ///     The variable requested, or NULL if that variable is not in the list.
+    ///     The variable requested, or nullptr if that variable is not in the list.
     //----------------------------------------------------------------------
     lldb::ExpressionVariableSP
     GetVariable (const ConstString &name)
@@ -286,7 +288,9 @@ public:
         m_kind(kind)
     {
     }
-    
+
+    virtual ~PersistentExpressionState();
+
     virtual lldb::ExpressionVariableSP
     CreatePersistentVariable (const lldb::ValueObjectSP &valobj_sp) = 0;
     
@@ -297,8 +301,6 @@ public:
                               lldb::ByteOrder byte_order,
                               uint32_t addr_byte_size) = 0;
 
-    virtual ~PersistentExpressionState ();
-    
     virtual ConstString
     GetNextPersistentVariableName () = 0;
     
@@ -312,6 +314,6 @@ private:
     LLVMCastKind m_kind;
 };
     
-}
+} // namespace lldb_private
 
-#endif /* liblldb_ExpressionVariable_h_ */
+#endif // liblldb_ExpressionVariable_h_

Modified: lldb/trunk/include/lldb/Expression/FunctionCaller.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/FunctionCaller.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/FunctionCaller.h (original)
+++ lldb/trunk/include/lldb/Expression/FunctionCaller.h Wed Oct 28 19:27:24 2015
@@ -1,4 +1,4 @@
-//===-- FunctionCaller.h -----------------------------------------*- C++ -*-===//
+//===-- FunctionCaller.h ----------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -12,8 +12,11 @@
 
 // C Includes
 // C++ Includes
-#include <vector>
 #include <list>
+#include <memory>
+#include <string>
+#include <vector>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Address.h"
@@ -55,7 +58,7 @@ namespace lldb_private
 /// a pointer set to LLDB_INVALID_ADDRESS and new structure will be allocated
 /// and its address returned in that variable.
 /// 
-/// Any of the methods that take arg_addr_ptr can be passed NULL, and the
+/// Any of the methods that take arg_addr_ptr can be passed nullptr, and the
 /// argument space will be managed for you.
 //----------------------------------------------------------------------    
 class FunctionCaller : public Expression
@@ -202,7 +205,7 @@ public:
     ///     The thread & process in which this function will run.
     ///
     /// @param[in] args_addr_ptr
-    ///     If NULL, the function will take care of allocating & deallocating the wrapper
+    ///     If nullptr, the function will take care of allocating & deallocating the wrapper
     ///     args structure.  Otherwise, if set to LLDB_INVALID_ADDRESS, a new structure
     ///     will be allocated, filled and the address returned to you.  You are responsible
     ///     for deallocating it.  And if passed in with a value other than LLDB_INVALID_ADDRESS,
@@ -317,12 +320,12 @@ public:
     
     //------------------------------------------------------------------
     /// Return the object that the parser should use when registering
-    /// local variables.  May be NULL if the Expression doesn't care.
+    /// local variables. May be nullptr if the Expression doesn't care.
     //------------------------------------------------------------------
     ExpressionVariableList *
     LocalVariables ()
     {
-        return NULL;
+        return nullptr;
     }
     
     //------------------------------------------------------------------
@@ -350,11 +353,8 @@ public:
     {
         return m_arg_values;
     }
-protected:
-    //------------------------------------------------------------------
-    // For FunctionCaller only
-    //------------------------------------------------------------------
 
+protected:
     // Note: the parser needs to be destructed before the execution unit, so
     // declare the execution unit first.
     std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
@@ -365,7 +365,7 @@ protected:
     lldb::ModuleWP                  m_jit_module_wp;
     std::string                     m_name;                         ///< The name of this clang function - for debugging purposes.
     
-    Function                       *m_function_ptr;                 ///< The function we're going to call.  May be NULL if we don't have debug info for the function.
+    Function                       *m_function_ptr;                 ///< The function we're going to call. May be nullptr if we don't have debug info for the function.
     Address                         m_function_addr;                ///< If we don't have the FunctionSP, we at least need the address & return type.
     CompilerType                    m_function_return_type;         ///< The opaque clang qual type for the function return type.
 
@@ -390,6 +390,6 @@ protected:
     bool                            m_JITted;                       ///< True if the wrapper function has already been JIT-compiled.
 };
 
-} // Namespace lldb_private
+} // namespace lldb_private
 
 #endif // liblldb_FunctionCaller_h_

Modified: lldb/trunk/include/lldb/Expression/IRExecutionUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRExecutionUnit.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRExecutionUnit.h (original)
+++ lldb/trunk/include/lldb/Expression/IRExecutionUnit.h Wed Oct 28 19:27:24 2015
@@ -13,18 +13,18 @@
 // C Includes
 // C++ Includes
 #include <atomic>
+#include <memory>
 #include <string>
 #include <vector>
-#include <map>
 
 // Other libraries and framework includes
 #include "llvm/IR/Module.h"
+#include "llvm/ExecutionEngine/SectionMemoryManager.h"
 
 // Project includes
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Core/DataBufferHeap.h"
-#include "llvm/ExecutionEngine/SectionMemoryManager.h"
 #include "lldb/Expression/IRMemoryMap.h"
 #include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -34,7 +34,7 @@ namespace llvm {
 class Module;
 class ExecutionEngine;
     
-}
+} // namespace llvm
 
 namespace lldb_private {
 
@@ -87,10 +87,7 @@ public:
     llvm::Function *
     GetFunction()
     {
-        if (m_module)
-            return m_module->getFunction (m_name.AsCString());
-        else
-            return NULL;
+        return ((m_module != nullptr) ? m_module->getFunction(m_name.AsCString()) : nullptr);
     }
     
     void

Modified: lldb/trunk/include/lldb/Expression/Materializer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/Materializer.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/Materializer.h (original)
+++ lldb/trunk/include/lldb/Expression/Materializer.h Wed Oct 28 19:27:24 2015
@@ -7,17 +7,22 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef lldb_Materializer_h
-#define lldb_Materializer_h
+#ifndef liblldb_Materializer_h
+#define liblldb_Materializer_h
 
+// C Includes
+// C++ Includes
+#include <memory>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private-types.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Expression/IRMemoryMap.h"
 #include "lldb/Symbol/TaggedASTType.h"
 #include "lldb/Target/StackFrame.h"
 
-#include <vector>
-
 namespace lldb_private
 {
     
@@ -31,8 +36,8 @@ public:
     {
     public:
         Dematerializer () :
-            m_materializer(NULL),
-            m_map(NULL),
+            m_materializer(nullptr),
+            m_map(nullptr),
             m_process_address(LLDB_INVALID_ADDRESS)
         {
         }
@@ -52,6 +57,7 @@ public:
         {
             return m_materializer && m_map && (m_process_address != LLDB_INVALID_ADDRESS);
         }
+
     private:
         friend class Materializer;
 
@@ -124,11 +130,9 @@ public:
             m_offset(0)
         {
         }
-        
-        virtual ~Entity ()
-        {
-        }
-        
+
+        virtual ~Entity() = default;
+
         virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err) = 0;
         virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
                                     lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err) = 0;
@@ -154,6 +158,7 @@ public:
         {
             m_offset = offset;
         }
+
     protected:
         void SetSizeAndAlignmentFromType (CompilerType &type);
         
@@ -174,6 +179,6 @@ private:
     uint32_t                        m_struct_alignment;
 };
     
-}
+} // namespace lldb_private
 
-#endif
+#endif // liblldb_Materializer_h

Modified: lldb/trunk/include/lldb/Expression/UserExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/UserExpression.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/UserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/UserExpression.h Wed Oct 28 19:27:24 2015
@@ -1,4 +1,4 @@
-//===-- UserExpression.h -----------------------------------*- C++ -*-===//
+//===-- UserExpression.h ----------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -12,12 +12,12 @@
 
 // C Includes
 // C++ Includes
+#include <memory>
 #include <string>
-#include <map>
 #include <vector>
 
+// Other libraries and framework includes
 // Project includes
-
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Core/Address.h"
@@ -42,8 +42,8 @@ namespace lldb_private
 class UserExpression : public Expression
 {
 public:
-
     enum { kDefaultTimeout = 500000u };
+
     //------------------------------------------------------------------
     /// Constructor
     ///
@@ -51,7 +51,7 @@ public:
     ///     The expression to parse.
     ///
     /// @param[in] expr_prefix
-    ///     If non-NULL, a C string containing translation-unit level
+    ///     If non-nullptr, a C string containing translation-unit level
     ///     definitions to be included when the expression is parsed.
     ///
     /// @param[in] language
@@ -267,7 +267,7 @@ public:
     ///     A C string containing the expression to be evaluated.
     ///
     /// @param[in] expr_prefix
-    ///     If non-NULL, a C string containing translation-unit level
+    ///     If non-nullptr, a C string containing translation-unit level
     ///     definitions to be included when the expression is parsed.
     ///
     /// @param[in,out] result_valobj_sp
@@ -281,22 +281,23 @@ public:
     ///     The offset of the first line of the expression from the "beginning" of a virtual source file used for error reporting and debug info.
     ///
     /// @param[out] jit_module_sp_ptr
-    ///     If non-NULL, used to persist the generated IR module.
+    ///     If non-nullptr, used to persist the generated IR module.
     ///
     /// @result
     ///      A Process::ExpressionResults value.  eExpressionCompleted for success.
     //------------------------------------------------------------------
     static lldb::ExpressionResults
-    Evaluate (ExecutionContext &exe_ctx,
-              const EvaluateExpressionOptions& options,
-              const char *expr_cstr,
-              const char *expr_prefix,
-              lldb::ValueObjectSP &result_valobj_sp,
-              Error &error,
-              uint32_t line_offset = 0,
-              lldb::ModuleSP *jit_module_sp_ptr = NULL);
+    Evaluate(ExecutionContext &exe_ctx,
+             const EvaluateExpressionOptions& options,
+             const char *expr_cstr,
+             const char *expr_prefix,
+             lldb::ValueObjectSP &result_valobj_sp,
+             Error &error,
+             uint32_t line_offset = 0,
+             lldb::ModuleSP *jit_module_sp_ptr = nullptr);
 
     static const Error::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result from the expression.
+
 protected:
     static lldb::addr_t
     GetObjectPointer (lldb::StackFrameSP frame_sp,
@@ -352,7 +353,7 @@ protected:
     bool                                        m_in_cplusplus_method;  ///< True if the expression is compiled as a C++ member function (true if it was parsed when exe_ctx was in a C++ method).
     bool                                        m_in_objectivec_method; ///< True if the expression is compiled as an Objective-C method (true if it was parsed when exe_ctx was in an Objective-C method).
     bool                                        m_in_static_method;     ///< True if the expression is compiled as a static (or class) method (currently true if it was parsed when exe_ctx was in an Objective-C class method).
-    bool                                        m_needs_object_ptr;     ///< True if "this" or "self" must be looked up and passed in.  False if the expression doesn't really use them and they can be NULL.
+    bool                                        m_needs_object_ptr;     ///< True if "this" or "self" must be looked up and passed in.  False if the expression doesn't really use them and they can be nullptr.
     bool                                        m_const_object;         ///< True if "this" is const.
     Target                                     *m_target;               ///< The target for storing persistent data like types and variables.
 

Modified: lldb/trunk/include/lldb/Expression/UtilityFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/UtilityFunction.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/UtilityFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/UtilityFunction.h Wed Oct 28 19:27:24 2015
@@ -1,4 +1,4 @@
-//===-- UtilityFunction.h ----------------------------------*- C++ -*-===//
+//===-- UtilityFunction.h ----------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -12,13 +12,11 @@
 
 // C Includes
 // C++ Includes
+#include <memory>
 #include <string>
-#include <map>
-#include <vector>
 
 // Other libraries and framework includes
 // Project includes
-
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Expression/Expression.h"
@@ -71,7 +69,7 @@ public:
     //------------------------------------------------------------------
     /// Check whether the given PC is inside the function
     ///
-    /// Especially useful if the function dereferences NULL to indicate a failed
+    /// Especially useful if the function dereferences nullptr to indicate a failed
     /// assert.
     ///
     /// @param[in] pc
@@ -88,8 +86,7 @@ public:
         // so this always returns false if the function is not JIT compiled yet
         return (address >= m_jit_start_addr && address < m_jit_end_addr);
     }
-    
-    
+
     //------------------------------------------------------------------
     /// Return the string that the parser should parse.  Must be a full
     /// translation unit.
@@ -113,12 +110,12 @@ public:
     
     //------------------------------------------------------------------
     /// Return the object that the parser should use when registering
-    /// local variables.  May be NULL if the Expression doesn't care.
+    /// local variables. May be nullptr if the Expression doesn't care.
     //------------------------------------------------------------------
     ExpressionVariableList *
     LocalVariables ()
     {
-        return NULL;
+        return nullptr;
     }
     
     //------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Host/Condition.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Condition.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Condition.h (original)
+++ lldb/trunk/include/lldb/Host/Condition.h Wed Oct 28 19:27:24 2015
@@ -7,11 +7,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef liblldb_DBCondition_h_
-#define liblldb_DBCondition_h_
-#if defined(__cplusplus)
-
+#ifndef liblldb_Condition_h_
+#define liblldb_Condition_h_
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-types.h"
 #include "lldb/Host/Mutex.h"
 
@@ -31,7 +33,6 @@ class TimeValue;
 class Condition
 {
 public:
-
     //------------------------------------------------------------------
     /// Default constructor
     ///
@@ -73,9 +74,9 @@ public:
     /// \a mutex. The waiting thread unblocks only after another thread
     /// signals or broadcasts this object's condition variable.
     ///
-    /// If \a abstime is non-NULL, this function will return when the
+    /// If \a abstime is non-nullptr, this function will return when the
     /// system time reaches the time specified in \a abstime if the
-    /// condition variable doesn't get unblocked. If \a abstime is NULL
+    /// condition variable doesn't get unblocked. If \a abstime is nullptr
     /// this function will wait for an infinite amount of time for the
     /// condition variable to be unblocked.
     ///
@@ -87,19 +88,19 @@ public:
     ///     \c pthread_cond_wait() calls.
     ///
     /// @param[in] abstime
-    ///     An absolute time at which to stop waiting if non-NULL, else
+    ///     An absolute time at which to stop waiting if non-nullptr, else
     ///     wait an infinite amount of time for the condition variable
     ///     toget signaled.
     ///
     /// @param[out] timed_out
-    ///     If not NULL, will be set to true if the wait timed out, and
+    ///     If not nullptr, will be set to true if the wait timed out, and
     //      false otherwise.
     ///
     /// @see Condition::Broadcast()
     /// @see Condition::Signal()
     //------------------------------------------------------------------
     int
-    Wait (Mutex &mutex, const TimeValue *abstime = NULL, bool *timed_out = NULL);
+    Wait(Mutex &mutex, const TimeValue *abstime = nullptr, bool *timed_out = nullptr);
 
 protected:
     //------------------------------------------------------------------
@@ -119,6 +120,4 @@ protected:
 
 } // namespace lldb_private
 
-#endif  // #if defined(__cplusplus)
-#endif
-
+#endif // liblldb_Condition_h_

Modified: lldb/trunk/include/lldb/Host/Debug.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Debug.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Debug.h (original)
+++ lldb/trunk/include/lldb/Host/Debug.h Wed Oct 28 19:27:24 2015
@@ -10,7 +10,12 @@
 #ifndef liblldb_Debug_h_
 #define liblldb_Debug_h_
 
+// C Includes
+// C++ Includes
 #include <vector>
+
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {
@@ -59,9 +64,7 @@ namespace lldb_private {
             }
         }
 
-        ~ResumeActionList()
-        {
-        }
+        ~ResumeActionList() = default;
 
         bool
         IsEmpty() const
@@ -114,7 +117,7 @@ namespace lldb_private {
             }
             if (default_ok && tid != LLDB_INVALID_THREAD_ID)
                 return GetActionForThread (LLDB_INVALID_THREAD_ID, false);
-            return NULL;
+            return nullptr;
         }
 
         size_t
@@ -133,7 +136,7 @@ namespace lldb_private {
         bool
         SetDefaultThreadActionIfNeeded (lldb::StateType action, int signal)
         {
-            if (GetActionForThread (LLDB_INVALID_THREAD_ID, true) == NULL)
+            if (GetActionForThread (LLDB_INVALID_THREAD_ID, true) == nullptr)
             {
                 // There isn't a default action so we do need to set it.
                 ResumeAction default_action = {LLDB_INVALID_THREAD_ID, action, signal };
@@ -203,4 +206,5 @@ namespace lldb_private {
         } details;
     };
 }
-#endif // #ifndef liblldb_Debug_h_
+
+#endif // liblldb_Debug_h_

Modified: lldb/trunk/include/lldb/Host/File.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/File.h (original)
+++ lldb/trunk/include/lldb/Host/File.h Wed Oct 28 19:27:24 2015
@@ -10,10 +10,14 @@
 #ifndef liblldb_File_h_
 #define liblldb_File_h_
 
+// C Includes
+// C++ Includes
 #include <stdarg.h>
 #include <stdio.h>
 #include <sys/types.h>
 
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Host/IOObject.h"
 
@@ -72,13 +76,11 @@ public:
 
     File (const File &rhs);
     
-    File &
-    operator= (const File &rhs);
     //------------------------------------------------------------------
     /// Constructor with path.
     ///
     /// Takes a path to a file which can be just a filename, or a full
-    /// path. If \a path is not NULL or empty, this function will call
+    /// path. If \a path is not nullptr or empty, this function will call
     /// File::Open (const char *path, uint32_t options, uint32_t permissions).
     ///
     /// @param[in] path
@@ -100,7 +102,7 @@ public:
     /// Constructor with FileSpec.
     ///
     /// Takes a FileSpec pointing to a file which can be just a filename, or a full
-    /// path. If \a path is not NULL or empty, this function will call
+    /// path. If \a path is not nullptr or empty, this function will call
     /// File::Open (const char *path, uint32_t options, uint32_t permissions).
     ///
     /// @param[in] filespec
@@ -134,6 +136,9 @@ public:
     //------------------------------------------------------------------
     ~File() override;
 
+    File &
+    operator= (const File &rhs);
+
     bool
     IsValid() const override
     {
@@ -154,7 +159,7 @@ public:
     ///
     /// @return
     ///     A pointer to this object if either the directory or filename
-    ///     is valid, NULL otherwise.
+    ///     is valid, nullptr otherwise.
     //------------------------------------------------------------------
     operator
     bool () const
@@ -292,13 +297,13 @@ public:
     ///
     /// @param[in] error_ptr
     ///     A pointer to a lldb_private::Error object that will be
-    ///     filled in if non-NULL.
+    ///     filled in if non-nullptr.
     ///
     /// @return
     ///     The resulting seek offset, or -1 on error.
     //------------------------------------------------------------------
     off_t
-    SeekFromStart (off_t offset, Error *error_ptr = NULL);
+    SeekFromStart(off_t offset, Error *error_ptr = nullptr);
     
     //------------------------------------------------------------------
     /// Seek to an offset relative to the current file position.
@@ -315,13 +320,13 @@ public:
     ///
     /// @param[in] error_ptr
     ///     A pointer to a lldb_private::Error object that will be
-    ///     filled in if non-NULL.
+    ///     filled in if non-nullptr.
     ///
     /// @return
     ///     The resulting seek offset, or -1 on error.
     //------------------------------------------------------------------
     off_t
-    SeekFromCurrent (off_t offset, Error *error_ptr = NULL);
+    SeekFromCurrent(off_t offset, Error *error_ptr = nullptr);
     
     //------------------------------------------------------------------
     /// Seek to an offset relative to the end of the file.
@@ -339,13 +344,13 @@ public:
     ///
     /// @param[in] error_ptr
     ///     A pointer to a lldb_private::Error object that will be
-    ///     filled in if non-NULL.
+    ///     filled in if non-nullptr.
     ///
     /// @return
     ///     The resulting seek offset, or -1 on error.
     //------------------------------------------------------------------
     off_t
-    SeekFromEnd (off_t offset, Error *error_ptr = NULL);
+    SeekFromEnd(off_t offset, Error *error_ptr = nullptr);
 
     //------------------------------------------------------------------
     /// Read bytes from a file from the specified file offset.
@@ -469,7 +474,6 @@ public:
     static uint32_t
     GetPermissions(const FileSpec &file_spec, Error &error);
 
-    
     //------------------------------------------------------------------
     /// Return true if this file is interactive.
     ///
@@ -516,15 +520,13 @@ public:
     size_t
     PrintfVarArg(const char *format, va_list args);
 
-    
     void
     SetOptions (uint32_t options)
     {
         m_options = options;
     }
+
 protected:
-    
-    
     bool
     DescriptorIsValid () const
     {

Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Wed Oct 28 19:27:24 2015
@@ -9,10 +9,14 @@
 
 #ifndef liblldb_FileSpec_h_
 #define liblldb_FileSpec_h_
-#if defined(__cplusplus)
 
+// C Includes
+// C++ Includes
 #include <functional>
+#include <string>
 
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/STLUtils.h"
@@ -66,7 +70,7 @@ public:
     /// Constructor with path.
     ///
     /// Takes a path to a file which can be just a filename, or a full
-    /// path. If \a path is not NULL or empty, this function will call
+    /// path. If \a path is not nullptr or empty, this function will call
     /// FileSpec::SetFile (const char *path, bool resolve).
     ///
     /// @param[in] path
@@ -101,10 +105,10 @@ public:
     /// Copy constructor
     ///
     /// Makes a copy of the uniqued directory and filename strings from
-    /// \a rhs if it is not NULL.
+    /// \a rhs if it is not nullptr.
     ///
     /// @param[in] rhs
-    ///     A const FileSpec object pointer to copy if non-NULL.
+    ///     A const FileSpec object pointer to copy if non-nullptr.
     //------------------------------------------------------------------
     FileSpec (const FileSpec* rhs);
 
@@ -190,7 +194,7 @@ public:
     ///
     /// @return
     ///     A pointer to this object if either the directory or filename
-    ///     is valid, NULL otherwise.
+    ///     is valid, nullptr otherwise.
     //------------------------------------------------------------------
     explicit operator bool() const;
 
@@ -444,7 +448,7 @@ public:
     ///
     /// Returns a ConstString that represents the extension of the filename
     /// for this FileSpec object. If this object does not represent a file,
-    /// or the filename has no extension, ConstString(NULL) is returned.
+    /// or the filename has no extension, ConstString(nullptr) is returned.
     /// The dot ('.') character is not returned as part of the extension
     ///
     /// @return
@@ -552,13 +556,12 @@ public:
     ///
     /// @return
     ///     A shared pointer to the memory mapped data. This shared
-    ///     pointer can contain a NULL DataBuffer pointer, so the contained
+    ///     pointer can contain a nullptr DataBuffer pointer, so the contained
     ///     pointer must be checked prior to using it.
     //------------------------------------------------------------------
     lldb::DataBufferSP
     MemoryMapFileContents (off_t offset = 0, size_t length = SIZE_MAX) const;
 
-
     //------------------------------------------------------------------
     /// Memory map part of, or the entire contents of, a file only if
     /// the file is local (not on a network mount).
@@ -591,7 +594,7 @@ public:
     ///
     /// @return
     ///     A shared pointer to the memory mapped data. This shared
-    ///     pointer can contain a NULL DataBuffer pointer, so the contained
+    ///     pointer can contain a nullptr DataBuffer pointer, so the contained
     ///     pointer must be checked prior to using it.
     //------------------------------------------------------------------
     lldb::DataBufferSP
@@ -621,16 +624,15 @@ public:
     ///
     /// @return
     ///     A shared pointer to the memory mapped data. This shared
-    ///     pointer can contain a NULL DataBuffer pointer, so the contained
+    ///     pointer can contain a nullptr DataBuffer pointer, so the contained
     ///     pointer must be checked prior to using it.
     //------------------------------------------------------------------
     lldb::DataBufferSP
-    ReadFileContents (off_t offset = 0, size_t length = SIZE_MAX, Error *error_ptr = NULL) const;
+    ReadFileContents(off_t offset = 0, size_t length = SIZE_MAX, Error *error_ptr = nullptr) const;
 
     size_t
     ReadFileContents (off_t file_offset, void *dst, size_t dst_len, Error *error_ptr) const;
 
-    
     //------------------------------------------------------------------
     /// Read the entire contents of a file as data that can be used
     /// as a C string.
@@ -640,11 +642,11 @@ public:
     ///
     /// @return
     ///     A shared pointer to the data. This shared pointer can
-    ///     contain a NULL DataBuffer pointer, so the contained pointer
+    ///     contain a nullptr DataBuffer pointer, so the contained pointer
     ///     must be checked prior to using it.
     //------------------------------------------------------------------
     lldb::DataBufferSP
-    ReadFileContentsAsCString(Error *error_ptr = NULL);
+    ReadFileContentsAsCString(Error *error_ptr = nullptr);
 
     //------------------------------------------------------------------
     /// Normalize a pathname by collapsing redundant separators and
@@ -716,6 +718,7 @@ public:
     {
         m_is_resolved = is_resolved;
     }
+
     //------------------------------------------------------------------
     /// Read the file into an array of strings, one per line.
     ///
@@ -832,5 +835,4 @@ Stream& operator << (Stream& s, const Fi
 
 } // namespace lldb_private
 
-#endif  // #if defined(__cplusplus)
-#endif  // liblldb_FileSpec_h_
+#endif // liblldb_FileSpec_h_

Modified: lldb/trunk/include/lldb/Host/Mutex.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Mutex.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Mutex.h (original)
+++ lldb/trunk/include/lldb/Host/Mutex.h Wed Oct 28 19:27:24 2015
@@ -9,15 +9,17 @@
 
 #ifndef liblldb_Mutex_h_
 #define liblldb_Mutex_h_
-#if defined(__cplusplus)
-
-#include "lldb/lldb-types.h"
-#include <assert.h>
 
+// C Includes
+// C++ Includes
 #ifdef LLDB_CONFIGURATION_DEBUG
 #include <string>
 #endif
 
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-types.h"
+
 namespace lldb_private {
 
 //----------------------------------------------------------------------
@@ -97,7 +99,7 @@ public:
         ///
         /// Unlock the current mutex in this object (if it contains a
         /// valid mutex) and lock the new \a mutex object if it is
-        /// non-NULL.
+        /// non-nullptr.
         //--------------------------------------------------------------
         void
         Lock (Mutex &mutex);
@@ -125,10 +127,10 @@ public:
         ///     returns \b false otherwise.
         //--------------------------------------------------------------
         bool
-        TryLock (Mutex &mutex, const char *failure_message = NULL);
+        TryLock(Mutex &mutex, const char *failure_message = nullptr);
         
         bool
-        TryLock (Mutex *mutex, const char *failure_message = NULL)
+        TryLock(Mutex *mutex, const char *failure_message = nullptr)
         {
             if (mutex)
                 return TryLock(*mutex, failure_message);
@@ -150,7 +152,6 @@ public:
         const Locker& operator=(const Locker&);
     };
 
-
     //------------------------------------------------------------------
     /// Default constructor.
     ///
@@ -213,7 +214,7 @@ public:
     virtual
 #endif
     int
-    TryLock(const char *failure_message = NULL);
+    TryLock(const char *failure_message = nullptr);
 
     //------------------------------------------------------------------
     /// Unlock the mutex.
@@ -262,16 +263,16 @@ public:
     TrackingMutex(Mutex::Type type) : Mutex (type) {}
     
     virtual
-    ~TrackingMutex() {}
+    ~TrackingMutex() = default;
     
     virtual int
     Unlock ();
 
     virtual int
-    TryLock (const char *failure_message = NULL)
+    TryLock(const char *failure_message = nullptr)
     {
         int return_value = Mutex::TryLock();
-        if (return_value != 0 && failure_message != NULL)
+        if (return_value != 0 && failure_message != nullptr)
         {
             m_failure_message.assign(failure_message);
             m_thread_that_tried = pthread_self();
@@ -291,7 +292,7 @@ public:
     LoggingMutex(Mutex::Type type) : Mutex (type),m_locked(false) {}
     
     virtual
-    ~LoggingMutex() {}
+    ~LoggingMutex() = default;
     
     virtual int
     Lock ();
@@ -300,13 +301,13 @@ public:
     Unlock ();
     
     virtual int
-    TryLock (const char *failure_message = NULL);
+    TryLock(const char *failure_message = nullptr);
+
 protected:
     bool m_locked;
 };
-#endif
+#endif // LLDB_CONFIGURATION_DEBUG
 
 } // namespace lldb_private
 
-#endif  // #if defined(__cplusplus)
-#endif
+#endif // liblldb_Mutex_h_

Modified: lldb/trunk/include/lldb/Host/Predicate.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Predicate.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Predicate.h (original)
+++ lldb/trunk/include/lldb/Host/Predicate.h Wed Oct 28 19:27:24 2015
@@ -9,13 +9,17 @@
 
 #ifndef liblldb_Predicate_h_
 #define liblldb_Predicate_h_
-#if defined(__cplusplus)
 
+// C Includes
+#include <stdint.h>
+#include <time.h>
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-defines.h"
 #include "lldb/Host/Mutex.h"
 #include "lldb/Host/Condition.h"
-#include <stdint.h>
-#include <time.h>
 
 //#define DB_PTHREAD_LOG_EVENTS
 
@@ -29,7 +33,6 @@ typedef enum
     eBroadcastNever,    ///< No broadcast will be sent when the value is modified.
     eBroadcastAlways,   ///< Always send a broadcast when the value is modified.
     eBroadcastOnChange  ///< Only broadcast if the value changes when the value is modified.
-
 } PredicateBroadcastType;
 
 //----------------------------------------------------------------------
@@ -46,7 +49,6 @@ template <class T>
 class Predicate
 {
 public:
-
     //------------------------------------------------------------------
     /// Default constructor.
     ///
@@ -81,10 +83,7 @@ public:
     ///
     /// Destroy the condition, mutex, and T objects.
     //------------------------------------------------------------------
-    ~Predicate ()
-    {
-    }
-
+    ~Predicate() = default;
 
     //------------------------------------------------------------------
     /// Value get accessor.
@@ -205,7 +204,7 @@ public:
     ///     The bits we are waiting to be set in \a m_value.
     ///
     /// @param[in] abstime
-    ///     If non-NULL, the absolute time at which we should stop
+    ///     If non-nullptr, the absolute time at which we should stop
     ///     waiting, else wait an infinite amount of time.
     ///
     /// @return
@@ -214,7 +213,7 @@ public:
     ///     occurred.
     //------------------------------------------------------------------
     T
-    WaitForSetValueBits (T bits, const TimeValue *abstime = NULL)
+    WaitForSetValueBits(T bits, const TimeValue *abstime = nullptr)
     {
         int err = 0;
         // pthread_cond_timedwait() or pthread_cond_wait() will atomically
@@ -255,7 +254,7 @@ public:
     ///     The bits we are waiting to be reset in \a m_value.
     ///
     /// @param[in] abstime
-    ///     If non-NULL, the absolute time at which we should stop
+    ///     If non-nullptr, the absolute time at which we should stop
     ///     waiting, else wait an infinite amount of time.
     ///
     /// @return
@@ -263,7 +262,7 @@ public:
     ///     unrecoverable error occurs.
     //------------------------------------------------------------------
     T
-    WaitForResetValueBits (T bits, const TimeValue *abstime = NULL)
+    WaitForResetValueBits(T bits, const TimeValue *abstime = nullptr)
     {
         int err = 0;
 
@@ -306,7 +305,7 @@ public:
     ///     The value we want \a m_value to be equal to.
     ///
     /// @param[in] abstime
-    ///     If non-NULL, the absolute time at which we should stop
+    ///     If non-nullptr, the absolute time at which we should stop
     ///     waiting, else wait an infinite amount of time.
     ///
     /// @param[out] timed_out
@@ -318,7 +317,7 @@ public:
     ///     @li \b false otherwise
     //------------------------------------------------------------------
     bool
-    WaitForValueEqualTo (T value, const TimeValue *abstime = NULL, bool *timed_out = NULL)
+    WaitForValueEqualTo(T value, const TimeValue *abstime = nullptr, bool *timed_out = nullptr)
     {
         int err = 0;
         // pthread_cond_timedwait() or pthread_cond_wait() will atomically
@@ -366,7 +365,7 @@ public:
     ///     returned.
     ///
     /// @param[in] abstime
-    ///     If non-NULL, the absolute time at which we should stop
+    ///     If non-nullptr, the absolute time at which we should stop
     ///     waiting, else wait an infinite amount of time.
     ///
     /// @param[out] timed_out
@@ -378,7 +377,9 @@ public:
     ///     @li \b false otherwise
     //------------------------------------------------------------------
     bool
-    WaitForValueEqualToAndSetValueTo (T wait_value, T new_value, const TimeValue *abstime = NULL, bool *timed_out = NULL)
+    WaitForValueEqualToAndSetValueTo(T wait_value, T new_value,
+                                     const TimeValue *abstime = nullptr,
+                                     bool *timed_out = nullptr)
     {
         int err = 0;
         // pthread_cond_timedwait() or pthread_cond_wait() will atomically
@@ -408,7 +409,6 @@ public:
         return false;
     }
 
-
     //------------------------------------------------------------------
     /// Wait for \a m_value to not be equal to \a value.
     ///
@@ -430,7 +430,7 @@ public:
     ///     The new value if \b true is returned.
     ///
     /// @param[in] abstime
-    ///     If non-NULL, the absolute time at which we should stop
+    ///     If non-nullptr, the absolute time at which we should stop
     ///     waiting, else wait an infinite amount of time.
     ///
     /// @return
@@ -438,7 +438,7 @@ public:
     ///     @li \b false otherwise
     //------------------------------------------------------------------
     bool
-    WaitForValueNotEqualTo (T value, T &new_value, const TimeValue *abstime = NULL)
+    WaitForValueNotEqualTo(T value, T &new_value, const TimeValue *abstime = nullptr)
     {
         int err = 0;
         // pthread_cond_timedwait() or pthread_cond_wait() will atomically
@@ -473,7 +473,6 @@ protected:
     Condition   m_condition;    ///< The pthread condition variable to use for signaling that data available or changed.
 
 private:
-
     //------------------------------------------------------------------
     /// Broadcast if needed.
     ///
@@ -500,11 +499,9 @@ private:
             m_condition.Broadcast();
     }
 
-
     DISALLOW_COPY_AND_ASSIGN(Predicate);
 };
 
 } // namespace lldb_private
 
-#endif  // #if defined(__cplusplus)
-#endif // #ifndef liblldb_Predicate_h_
+#endif // liblldb_Predicate_h_

Modified: lldb/trunk/include/lldb/Host/ProcessRunLock.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/ProcessRunLock.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/ProcessRunLock.h (original)
+++ lldb/trunk/include/lldb/Host/ProcessRunLock.h Wed Oct 28 19:27:24 2015
@@ -9,13 +9,17 @@
 
 #ifndef liblldb_ProcessRunLock_h_
 #define liblldb_ProcessRunLock_h_
-#if defined(__cplusplus)
 
+// C Includes
+#include <stdint.h>
+#include <time.h>
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-defines.h"
 #include "lldb/Host/Mutex.h"
 #include "lldb/Host/Condition.h"
-#include <stdint.h>
-#include <time.h>
 
 //----------------------------------------------------------------------
 /// Enumerations for broadcasting.
@@ -34,17 +38,18 @@ class ProcessRunLock
 public:
     ProcessRunLock();
     ~ProcessRunLock();
+
     bool ReadTryLock ();
     bool ReadUnlock ();
     bool SetRunning ();
     bool TrySetRunning ();
     bool SetStopped ();
-public:
+
     class ProcessRunLocker
     {
     public:
         ProcessRunLocker () :
-            m_lock (NULL)
+            m_lock (nullptr)
         {
         }
 
@@ -82,11 +87,12 @@ public:
             if (m_lock)
             {
                 m_lock->ReadUnlock();
-                m_lock = NULL;
+                m_lock = nullptr;
             }
         }
         
         ProcessRunLock *m_lock;
+
     private:
         DISALLOW_COPY_AND_ASSIGN(ProcessRunLocker);
     };
@@ -94,11 +100,11 @@ public:
 protected:
     lldb::rwlock_t m_rwlock;
     bool m_running;
+
 private:
     DISALLOW_COPY_AND_ASSIGN(ProcessRunLock);
 };
 
 } // namespace lldb_private
 
-#endif  // #if defined(__cplusplus)
-#endif // #ifndef liblldb_ProcessRunLock_h_
+#endif // liblldb_ProcessRunLock_h_

Modified: lldb/trunk/include/lldb/Host/XML.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/XML.h?rev=251587&r1=251586&r2=251587&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/XML.h (original)
+++ lldb/trunk/include/lldb/Host/XML.h Wed Oct 28 19:27:24 2015
@@ -11,25 +11,23 @@
 #define liblldb_XML_h_
 
 // C Includes
-
 #if defined( LIBXML2_DEFINED )
 #include <libxml/xmlreader.h>
 #endif
 
 // C++ Includes
-
 #include <functional>
 #include <string>
 #include <vector>
 
 // Other libraries and framework includes
+#include "llvm/ADT/StringRef.h"
+
 // Project includes
 #include "lldb/lldb-private.h"
-#include "llvm/ADT/StringRef.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/StructuredData.h"
 
-
 namespace lldb_private {
 
 #if defined( LIBXML2_DEFINED )
@@ -94,7 +92,7 @@ namespace lldb_private {
         GetChild () const;
         
         llvm::StringRef
-        GetAttributeValue(const char *name, const char *fail_value = NULL) const;
+        GetAttributeValue(const char *name, const char *fail_value = nullptr) const;
         
         XMLNode
         FindFirstChildElementWithName (const char *name) const;
@@ -140,7 +138,6 @@ namespace lldb_private {
     class XMLDocument
     {
     public:
-        
         XMLDocument ();
         
         ~XMLDocument ();
@@ -163,7 +160,7 @@ namespace lldb_private {
         ParseMemory (const char *xml, size_t xml_length, const char *url = "untitled.xml");
 
         //----------------------------------------------------------------------
-        // If \a name is NULL, just get the root element node, else only return
+        // If \a name is nullptr, just get the root element node, else only return
         // a value XMLNode if the name of the root element matches \a name.
         //----------------------------------------------------------------------
         XMLNode
@@ -216,7 +213,6 @@ namespace lldb_private {
         GetStructuredData();
 
     protected:
-
         // Using a node returned from GetValueNode() extract its value as a
         // string (if possible). Array and dictionary nodes will return false
         // as they have no string value. Boolean nodes will return true and
@@ -229,6 +225,7 @@ namespace lldb_private {
         XMLDocument m_xml_doc;
         XMLNode m_dict_node;
     };
+
 } // namespace lldb_private
 
 #endif  // liblldb_XML_h_




More information about the lldb-commits mailing list