[Lldb-commits] [lldb] r251556 - Fix Clang-tidy modernize-use-nullptr warnings in some files in include/lldb/Core; other minor fixes.

Eugene Zelenko via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 28 13:53:04 PDT 2015


Author: eugenezelenko
Date: Wed Oct 28 15:53:04 2015
New Revision: 251556

URL: http://llvm.org/viewvc/llvm-project?rev=251556&view=rev
Log:
Fix Clang-tidy modernize-use-nullptr warnings in some files in include/lldb/Core; other minor fixes.

Modified:
    lldb/trunk/include/lldb/Core/ModuleSpec.h
    lldb/trunk/include/lldb/Core/Opcode.h
    lldb/trunk/include/lldb/Core/PluginManager.h
    lldb/trunk/include/lldb/Core/RangeMap.h
    lldb/trunk/include/lldb/Core/RegisterValue.h
    lldb/trunk/include/lldb/Core/RegularExpression.h

Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleSpec.h?rev=251556&r1=251555&r2=251556&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleSpec.h Wed Oct 28 15:53:04 2015
@@ -10,6 +10,12 @@
 #ifndef liblldb_ModuleSpec_h_
 #define liblldb_ModuleSpec_h_
 
+// C Includes
+// C++ Includes
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/UUID.h"
@@ -100,17 +106,13 @@ public:
     FileSpec *
     GetFileSpecPtr ()
     {
-        if (m_file)
-            return &m_file;
-        return NULL;
+        return (m_file ? &m_file : nullptr);
     }
 
     const FileSpec *
     GetFileSpecPtr () const
     {
-        if (m_file)
-            return &m_file;
-        return NULL;
+        return (m_file ? &m_file : nullptr);
     }
     
     FileSpec &
@@ -118,6 +120,7 @@ public:
     {
         return m_file;
     }
+
     const FileSpec &
     GetFileSpec () const
     {
@@ -127,17 +130,13 @@ public:
     FileSpec *
     GetPlatformFileSpecPtr ()
     {
-        if (m_platform_file)
-            return &m_platform_file;
-        return NULL;
+        return (m_platform_file ? &m_platform_file : nullptr);
     }
 
     const FileSpec *
     GetPlatformFileSpecPtr () const
     {
-        if (m_platform_file)
-            return &m_platform_file;
-        return NULL;
+        return (m_platform_file ? &m_platform_file : nullptr);
     }
 
     FileSpec &
@@ -155,17 +154,13 @@ public:
     FileSpec *
     GetSymbolFileSpecPtr ()
     {
-        if (m_symbol_file)
-            return &m_symbol_file;
-        return NULL;
+        return (m_symbol_file ? &m_symbol_file : nullptr);
     }
     
     const FileSpec *
     GetSymbolFileSpecPtr () const
     {
-        if (m_symbol_file)
-            return &m_symbol_file;
-        return NULL;
+        return (m_symbol_file ? &m_symbol_file : nullptr);
     }
     
     FileSpec &
@@ -180,21 +175,16 @@ public:
         return m_symbol_file;
     }
 
-    
     ArchSpec *
     GetArchitecturePtr ()
     {
-        if (m_arch.IsValid())
-            return &m_arch;
-        return NULL;
+        return (m_arch.IsValid() ? &m_arch : nullptr);
     }
     
     const ArchSpec *
     GetArchitecturePtr () const
     {
-        if (m_arch.IsValid())
-            return &m_arch;
-        return NULL;
+        return (m_arch.IsValid() ? &m_arch : nullptr);
     }
     
     ArchSpec &
@@ -212,17 +202,13 @@ public:
     UUID *
     GetUUIDPtr ()
     {
-        if (m_uuid.IsValid())
-            return &m_uuid;
-        return NULL;
+        return (m_uuid.IsValid() ? &m_uuid : nullptr);
     }
     
     const UUID *
     GetUUIDPtr () const
     {
-        if (m_uuid.IsValid())
-            return &m_uuid;
-        return NULL;
+        return (m_uuid.IsValid() ? &m_uuid : nullptr);
     }
     
     UUID &
@@ -306,7 +292,6 @@ public:
         m_object_mod_time.Clear();
     }
 
-    
     explicit operator bool () const
     {
         if (m_file)
@@ -477,9 +462,7 @@ public:
         m_specs = rhs.m_specs;
     }
 
-    ~ModuleSpecList ()
-    {
-    }
+    ~ModuleSpecList() = default;
 
     ModuleSpecList &
     operator = (const ModuleSpecList &rhs)
@@ -529,6 +512,7 @@ public:
     {
         return m_specs[i];
     }
+
     bool
     GetModuleSpecAtIndex (size_t i, ModuleSpec &module_spec) const
     {
@@ -541,8 +525,7 @@ public:
         module_spec.Clear();
         return false;
     }
-    
-    
+
     bool
     FindMatchingModuleSpec (const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
     {
@@ -621,4 +604,4 @@ protected:
 
 } // namespace lldb_private
 
-#endif  // liblldb_ModuleSpec_h_
+#endif // liblldb_ModuleSpec_h_

Modified: lldb/trunk/include/lldb/Core/Opcode.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Opcode.h?rev=251556&r1=251555&r2=251556&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Opcode.h (original)
+++ lldb/trunk/include/lldb/Core/Opcode.h Wed Oct 28 15:53:04 2015
@@ -16,6 +16,7 @@
 // C++ Includes
 // Other libraries and framework includes
 #include "llvm/Support/MathExtras.h"
+
 // Project includes
 #include "lldb/Host/Endian.h"
 #include "lldb/lldb-public.h"
@@ -23,7 +24,7 @@
 namespace lldb
 {
     class SBInstruction;
-}
+} // namespace lldb
 
 namespace lldb_private {
 
@@ -76,6 +77,7 @@ namespace lldb_private {
             m_byte_order = lldb::eByteOrderInvalid;
             m_type = Opcode::eTypeInvalid;
         }
+
         Opcode::Type
         GetType () const
         {
@@ -189,7 +191,7 @@ namespace lldb_private {
         void
         SetOpcodeBytes (const void *bytes, size_t length)
         {
-            if (bytes && length > 0)
+            if (bytes != nullptr && length > 0)
             {
                 m_type = eTypeBytes;
                 m_data.inst.length = length;
@@ -210,9 +212,7 @@ namespace lldb_private {
         const void *
         GetOpcodeBytes () const
         {
-            if (m_type == Opcode::eTypeBytes)
-                return m_data.inst.bytes;
-            return NULL;
+            return ((m_type == Opcode::eTypeBytes) ? m_data.inst.bytes : nullptr);
         }
 
         uint32_t
@@ -252,7 +252,7 @@ namespace lldb_private {
                 case Opcode::eType64:    return &m_data.inst64;
                 case Opcode::eTypeBytes: return m_data.inst.bytes;
             }
-            return NULL;
+            return nullptr;
         }
 
         lldb::ByteOrder
@@ -284,4 +284,4 @@ namespace lldb_private {
 
 } // namespace lldb_private
 
-#endif	// lldb_Opcode_h
+#endif // lldb_Opcode_h

Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=251556&r1=251555&r2=251556&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Wed Oct 28 15:53:04 2015
@@ -7,10 +7,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #ifndef liblldb_PluginManager_h_
 #define liblldb_PluginManager_h_
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Host/FileSpec.h"
 
@@ -42,7 +45,6 @@ public:
     static ABICreateInstance
     GetABICreateCallbackForPluginName (const ConstString &name);
 
-
     //------------------------------------------------------------------
     // Disassembler
     //------------------------------------------------------------------
@@ -60,15 +62,14 @@ public:
     static DisassemblerCreateInstance
     GetDisassemblerCreateCallbackForPluginName (const ConstString &name);
 
-
     //------------------------------------------------------------------
     // DynamicLoader
     //------------------------------------------------------------------
     static bool
-    RegisterPlugin (const ConstString &name,
-                    const char *description,
-                    DynamicLoaderCreateInstance create_callback,
-                    DebuggerInitializeCallback debugger_init_callback = NULL);
+    RegisterPlugin(const ConstString &name,
+                   const char *description,
+                   DynamicLoaderCreateInstance create_callback,
+                   DebuggerInitializeCallback debugger_init_callback = nullptr);
 
     static bool
     UnregisterPlugin (DynamicLoaderCreateInstance create_callback);
@@ -83,10 +84,10 @@ public:
     // JITLoader
     //------------------------------------------------------------------
     static bool
-    RegisterPlugin (const ConstString &name,
-                    const char *description,
-                    JITLoaderCreateInstance create_callback,
-                    DebuggerInitializeCallback debugger_init_callback = NULL);
+    RegisterPlugin(const ConstString &name,
+                   const char *description,
+                   JITLoaderCreateInstance create_callback,
+                   DebuggerInitializeCallback debugger_init_callback = nullptr);
 
     static bool
     UnregisterPlugin (JITLoaderCreateInstance create_callback);
@@ -168,7 +169,6 @@ public:
     static LanguageRuntimeCreateInstance
     GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name);
 
-
     //------------------------------------------------------------------
     // SystemRuntime
     //------------------------------------------------------------------
@@ -186,17 +186,16 @@ public:
     static SystemRuntimeCreateInstance
     GetSystemRuntimeCreateCallbackForPluginName (const ConstString &name);
 
-
     //------------------------------------------------------------------
     // ObjectFile
     //------------------------------------------------------------------
     static bool
-    RegisterPlugin (const ConstString &name,
-                    const char *description,
-                    ObjectFileCreateInstance create_callback,
-                    ObjectFileCreateMemoryInstance create_memory_callback,
-                    ObjectFileGetModuleSpecifications get_module_specifications,
-                    ObjectFileSaveCore save_core = NULL);
+    RegisterPlugin(const ConstString &name,
+                   const char *description,
+                   ObjectFileCreateInstance create_callback,
+                   ObjectFileCreateMemoryInstance create_memory_callback,
+                   ObjectFileGetModuleSpecifications get_module_specifications,
+                   ObjectFileSaveCore save_core = nullptr);
 
     static bool
     UnregisterPlugin (ObjectFileCreateInstance create_callback);
@@ -264,10 +263,10 @@ public:
     // Platform
     //------------------------------------------------------------------
     static bool
-    RegisterPlugin (const ConstString &name,
-                    const char *description,
-                    PlatformCreateInstance create_callback,
-                    DebuggerInitializeCallback debugger_init_callback = NULL);
+    RegisterPlugin(const ConstString &name,
+                   const char *description,
+                   PlatformCreateInstance create_callback,
+                   DebuggerInitializeCallback debugger_init_callback = nullptr);
 
     static bool
     UnregisterPlugin (PlatformCreateInstance create_callback);
@@ -291,10 +290,10 @@ public:
     // Process
     //------------------------------------------------------------------
     static bool
-    RegisterPlugin (const ConstString &name,
-                    const char *description,
-                    ProcessCreateInstance create_callback,
-                    DebuggerInitializeCallback debugger_init_callback = NULL);
+    RegisterPlugin(const ConstString &name,
+                   const char *description,
+                   ProcessCreateInstance create_callback,
+                   DebuggerInitializeCallback debugger_init_callback = nullptr);
     
     static bool
     UnregisterPlugin (ProcessCreateInstance create_callback);
@@ -346,7 +345,6 @@ public:
     static SymbolFileCreateInstance
     GetSymbolFileCreateCallbackForPluginName (const ConstString &name);
 
-
     //------------------------------------------------------------------
     // SymbolVendor
     //------------------------------------------------------------------
@@ -535,7 +533,6 @@ public:
                                                       const ConstString &description, bool is_global_property);
 };
 
-
 } // namespace lldb_private
 
-#endif  // liblldb_PluginManager_h_
+#endif // liblldb_PluginManager_h_

Modified: lldb/trunk/include/lldb/Core/RangeMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=251556&r1=251555&r2=251556&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/RangeMap.h (original)
+++ lldb/trunk/include/lldb/Core/RangeMap.h Wed Oct 28 15:53:04 2015
@@ -10,16 +10,21 @@
 #ifndef liblldb_RangeMap_h_
 #define liblldb_RangeMap_h_
 
+// C Includes
+// C++ Includes
+#include <algorithm>
 #include <vector>
 
-#include "lldb/lldb-private.h"
+// Other libraries and framework includes
 #include "llvm/ADT/SmallVector.h"
 
+// Project includes
+#include "lldb/lldb-private.h"
+
 // Uncomment to make sure all Range objects are sorted when needed
 //#define ASSERT_RANGEMAP_ARE_SORTED
 
 namespace lldb_private {
-
     
     //----------------------------------------------------------------------
     // Templatized classes for dealing with generic ranges and also
@@ -187,16 +192,11 @@ namespace lldb_private {
         typedef S SizeType;
         typedef Range<B,S> Entry;
         typedef llvm::SmallVector<Entry, N> Collection;
-        
-        RangeArray () :
-            m_entries ()
-        {
-        }
-        
-        ~RangeArray()
-        {
-        }
-        
+
+        RangeArray() = default;
+
+        ~RangeArray() = default;
+
         void
         Append (const Entry &entry)
         {
@@ -236,6 +236,7 @@ namespace lldb_private {
             return true;
         }
 #endif        
+
         void
         CombineConsecutiveRanges ()
         {
@@ -281,7 +282,6 @@ namespace lldb_private {
             }
         }
 
-        
         BaseType
         GetMinRangeBase (BaseType fail_value) const
         {
@@ -337,9 +337,7 @@ namespace lldb_private {
         const Entry *
         GetEntryAtIndex (size_t i) const
         {
-            if (i<m_entries.size())
-                return &m_entries[i];
-            return NULL;
+            return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
         }
         
         // Clients must ensure that "i" is a valid index prior to calling this function
@@ -352,17 +350,13 @@ namespace lldb_private {
         Entry *
         Back()
         {
-            if (m_entries.empty())
-                return NULL;
-            return &m_entries.back();
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
 
         const Entry *
         Back() const
         {
-            if (m_entries.empty())
-                return NULL;
-            return &m_entries.back();
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
 
         static bool 
@@ -424,7 +418,7 @@ namespace lldb_private {
                     }
                 }
             }
-            return NULL;
+            return nullptr;
         }
 
         const Entry *
@@ -452,7 +446,7 @@ namespace lldb_private {
                     }
                 }
             }
-            return NULL;
+            return nullptr;
         }
 
     protected:
@@ -467,16 +461,11 @@ namespace lldb_private {
         typedef S SizeType;
         typedef Range<B,S> Entry;
         typedef std::vector<Entry> Collection;
-        
-        RangeVector () :
-            m_entries ()
-        {
-        }
-        
-        ~RangeVector()
-        {
-        }
-        
+
+        RangeVector() = default;
+
+        ~RangeVector() = default;
+
         void
         Append (const Entry &entry)
         {
@@ -516,6 +505,7 @@ namespace lldb_private {
             return true;
         }
 #endif
+
         void
         CombineConsecutiveRanges ()
         {
@@ -560,8 +550,7 @@ namespace lldb_private {
                 }
             }
         }
-        
-        
+
         BaseType
         GetMinRangeBase (BaseType fail_value) const
         {
@@ -623,9 +612,7 @@ namespace lldb_private {
         const Entry *
         GetEntryAtIndex (size_t i) const
         {
-            if (i<m_entries.size())
-                return &m_entries[i];
-            return NULL;
+            return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
         }
         
         // Clients must ensure that "i" is a valid index prior to calling this function
@@ -638,17 +625,13 @@ namespace lldb_private {
         Entry *
         Back()
         {
-            if (m_entries.empty())
-                return NULL;
-            return &m_entries.back();
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
         
         const Entry *
         Back() const
         {
-            if (m_entries.empty())
-                return NULL;
-            return &m_entries.back();
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
         
         static bool
@@ -710,7 +693,7 @@ namespace lldb_private {
                     }
                 }
             }
-            return NULL;
+            return nullptr;
         }
         
         const Entry *
@@ -738,7 +721,7 @@ namespace lldb_private {
                     }
                 }
             }
-            return NULL;
+            return nullptr;
         }
         
     protected:
@@ -812,15 +795,10 @@ namespace lldb_private {
         typedef RangeData<B,S,T> Entry;
         typedef llvm::SmallVector<Entry, N> Collection;
 
+        RangeDataArray() = default;
+
+        ~RangeDataArray() = default;
 
-        RangeDataArray ()
-        {
-        }
-        
-        ~RangeDataArray()
-        {
-        }
-        
         void
         Append (const Entry &entry)
         {
@@ -911,9 +889,7 @@ namespace lldb_private {
         const Entry *
         GetEntryAtIndex (size_t i) const
         {
-            if (i<m_entries.size())
-                return &m_entries[i];
-            return NULL;
+            return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
         }
 
         // Clients must ensure that "i" is a valid index prior to calling this function
@@ -984,8 +960,9 @@ namespace lldb_private {
                     }
                 }
             }
-            return NULL;
+            return nullptr;
         }
+
         const Entry *
         FindEntryThatContains (B addr) const
         {
@@ -1014,7 +991,7 @@ namespace lldb_private {
                     }
                 }
             }
-            return NULL;
+            return nullptr;
         }
         
         const Entry *
@@ -1042,23 +1019,19 @@ namespace lldb_private {
                     }
                 }
             }
-            return NULL;
+            return nullptr;
         }
         
         Entry *
         Back()
         {
-            if (!m_entries.empty())
-                return &m_entries.back();
-            return NULL;
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
 
         const Entry *
         Back() const
         {
-            if (!m_entries.empty())
-                return &m_entries.back();
-            return NULL;
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
 
     protected:
@@ -1073,15 +1046,11 @@ namespace lldb_private {
     public:
         typedef RangeData<B,S,T> Entry;
         typedef std::vector<Entry> Collection;
-        
-        RangeDataVector ()
-        {
-        }
-        
-        ~RangeDataVector()
-        {
-        }
-        
+
+        RangeDataVector() = default;
+
+        ~RangeDataVector() = default;
+
         void
         Append (const Entry &entry)
         {
@@ -1181,7 +1150,6 @@ namespace lldb_private {
                     }
                 }
             }
-            
         }
         
         void
@@ -1211,9 +1179,7 @@ namespace lldb_private {
         const Entry *
         GetEntryAtIndex (size_t i) const
         {
-            if (i<m_entries.size())
-                return &m_entries[i];
-            return NULL;
+            return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
         }
         
         // Clients must ensure that "i" is a valid index prior to calling this function
@@ -1272,8 +1238,9 @@ namespace lldb_private {
                 if (pos != end && pos->Contains(addr))
                     return &(*pos);
             }
-            return NULL;
+            return nullptr;
         }
+
         const Entry *
         FindEntryThatContains (B addr) const
         {
@@ -1295,7 +1262,7 @@ namespace lldb_private {
                 if (pos != end && pos->Contains(addr))
                     return &(*pos);
             }
-            return NULL;
+            return nullptr;
         }
         
         const Entry *
@@ -1316,30 +1283,25 @@ namespace lldb_private {
                 if (pos != end && pos->Contains(range))
                     return &(*pos);
             }
-            return NULL;
+            return nullptr;
         }
         
         Entry *
         Back()
         {
-            if (!m_entries.empty())
-                return &m_entries.back();
-            return NULL;
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
         
         const Entry *
         Back() const
         {
-            if (!m_entries.empty())
-                return &m_entries.back();
-            return NULL;
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
         
     protected:
         Collection m_entries;
     };
-                    
-                
+
     //----------------------------------------------------------------------
     // A simple range  with data class where you get to define the type of
     // the range base "B", the type used for the range byte size "S", and
@@ -1389,7 +1351,6 @@ namespace lldb_private {
         }
     };
 
-
     template <typename B, typename T, unsigned N>
     class AddressDataArray
     {
@@ -1397,15 +1358,10 @@ namespace lldb_private {
         typedef AddressData<B,T> Entry;
         typedef llvm::SmallVector<Entry, N> Collection;
 
+        AddressDataArray() = default;
+
+        ~AddressDataArray() = default;
 
-        AddressDataArray ()
-        {
-        }
-        
-        ~AddressDataArray()
-        {
-        }
-        
         void
         Append (const Entry &entry)
         {
@@ -1456,9 +1412,7 @@ namespace lldb_private {
         const Entry *
         GetEntryAtIndex (size_t i) const
         {
-            if (i<m_entries.size())
-                return &m_entries[i];
-            return NULL;
+            return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
         }
 
         // Clients must ensure that "i" is a valid index prior to calling this function
@@ -1497,7 +1451,7 @@ namespace lldb_private {
                         return &(*pos);
                 }
             }
-            return NULL;
+            return nullptr;
         }
         
         const Entry *
@@ -1505,23 +1459,19 @@ namespace lldb_private {
         {
             if (entry >= &*m_entries.begin() && entry + 1 < &*m_entries.end())
                 return entry + 1;
-            return NULL;
+            return nullptr;
         }
         
         Entry *
         Back()
         {
-            if (!m_entries.empty())
-                return &m_entries.back();
-            return NULL;
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
 
         const Entry *
         Back() const
         {
-            if (!m_entries.empty())
-                return &m_entries.back();
-            return NULL;
+            return (m_entries.empty() ? nullptr : &m_entries.back());
         }
 
     protected:
@@ -1530,4 +1480,4 @@ namespace lldb_private {
 
 } // namespace lldb_private
 
-#endif  // liblldb_RangeMap_h_
+#endif // liblldb_RangeMap_h_

Modified: lldb/trunk/include/lldb/Core/RegisterValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RegisterValue.h?rev=251556&r1=251555&r2=251556&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/RegisterValue.h (original)
+++ lldb/trunk/include/lldb/Core/RegisterValue.h Wed Oct 28 15:53:04 2015
@@ -1,4 +1,4 @@
-//===-- RegisterValue.h ------------------------------------------*- C++ -*-===//
+//===-- RegisterValue.h -----------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -15,11 +15,12 @@
 
 // C++ Includes
 // Other libraries and framework includes
+#include "llvm/ADT/APInt.h"
+
 // Project includes
 #include "lldb/lldb-public.h"
 #include "lldb/lldb-private.h"
 #include "lldb/Host/Endian.h"
-#include "llvm/ADT/APInt.h"
 #include "lldb/Core/Scalar.h"
 
 namespace lldb_private {
@@ -31,6 +32,7 @@ namespace lldb_private {
         {
             kMaxRegisterByteSize = 32u
         };
+
         enum Type
         {
             eTypeInvalid,
@@ -85,6 +87,7 @@ namespace lldb_private {
         {
             m_scalar = llvm::APInt(inst);
         }
+
         explicit 
         RegisterValue (float value) : 
             m_type (eTypeFloat)
@@ -159,7 +162,7 @@ namespace lldb_private {
         GetScalarValue (Scalar &scalar) const;
 
         uint8_t
-        GetAsUInt8 (uint8_t fail_value = UINT8_MAX, bool *success_ptr = NULL) const
+        GetAsUInt8(uint8_t fail_value = UINT8_MAX, bool *success_ptr = nullptr) const
         {
             if (m_type == eTypeUInt8)
             {
@@ -173,25 +176,25 @@ namespace lldb_private {
         }
 
         uint16_t
-        GetAsUInt16 (uint16_t fail_value = UINT16_MAX, bool *success_ptr = NULL) const;
+        GetAsUInt16(uint16_t fail_value = UINT16_MAX, bool *success_ptr = nullptr) const;
 
         uint32_t
-        GetAsUInt32 (uint32_t fail_value = UINT32_MAX, bool *success_ptr = NULL) const;
+        GetAsUInt32(uint32_t fail_value = UINT32_MAX, bool *success_ptr = nullptr) const;
 
         uint64_t
-        GetAsUInt64 (uint64_t fail_value = UINT64_MAX, bool *success_ptr = NULL) const;
+        GetAsUInt64(uint64_t fail_value = UINT64_MAX, bool *success_ptr = nullptr) const;
 
         llvm::APInt
-        GetAsUInt128 (const llvm::APInt& fail_value, bool *success_ptr = NULL) const;
+        GetAsUInt128(const llvm::APInt& fail_value, bool *success_ptr = nullptr) const;
 
         float
-        GetAsFloat (float fail_value = 0.0f, bool *success_ptr = NULL) const;
+        GetAsFloat(float fail_value = 0.0f, bool *success_ptr = nullptr) const;
 
         double
-        GetAsDouble (double fail_value = 0.0, bool *success_ptr = NULL) const;
+        GetAsDouble(double fail_value = 0.0, bool *success_ptr = nullptr) const;
 
         long double
-        GetAsLongDouble (long double fail_value = 0.0, bool *success_ptr = NULL) const;
+        GetAsLongDouble(long double fail_value = 0.0, bool *success_ptr = nullptr) const;
 
         void
         SetValueToInvalid ()
@@ -301,6 +304,7 @@ namespace lldb_private {
             m_type = eTypeUInt128;
             m_scalar = uint;
         }
+
         bool
         SetUInt (uint64_t uint, uint32_t byte_size);
     
@@ -377,9 +381,9 @@ namespace lldb_private {
         Clear();
 
     protected:
-
         RegisterValue::Type m_type;
         Scalar m_scalar;
+
         struct
         {
             uint8_t bytes[kMaxRegisterByteSize]; // This must be big enough to hold any register for any supported target.
@@ -390,4 +394,4 @@ namespace lldb_private {
 
 } // namespace lldb_private
 
-#endif	// lldb_RegisterValue_h
+#endif // lldb_RegisterValue_h

Modified: lldb/trunk/include/lldb/Core/RegularExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RegularExpression.h?rev=251556&r1=251555&r2=251556&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/RegularExpression.h (original)
+++ lldb/trunk/include/lldb/Core/RegularExpression.h Wed Oct 28 15:53:04 2015
@@ -7,9 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef liblldb_DBRegex_h_
-#define liblldb_DBRegex_h_
-#if defined(__cplusplus)
+#ifndef liblldb_RegularExpression_h_
+#define liblldb_RegularExpression_h_
 
 #ifdef _WIN32
 #include "../lib/Support/regex_impl.h"
@@ -37,7 +36,6 @@ inline void regfree(llvm_regex_t * a)
 {
     llvm_regfree(a);
 }
-
 #else
 #if __ANDROID_NDK__
 #include <regex>
@@ -52,7 +50,7 @@ inline void regfree(llvm_regex_t * a)
 namespace llvm
 {
     class StringRef;
-}
+} // namespace llvm
 
 namespace lldb_private {
 
@@ -95,9 +93,7 @@ public:
         regmatch_t *
         GetData ()
         {
-            if (m_matches.empty())
-                return NULL;
-            return m_matches.data();
+            return (m_matches.empty() ? nullptr : m_matches.data());
         }
         
         bool
@@ -110,9 +106,9 @@ public:
         GetMatchSpanningIndices (const char* s, uint32_t idx1, uint32_t idx2, llvm::StringRef& match_str) const;
 
     protected:
-        
         std::vector<regmatch_t> m_matches; ///< Where parenthesized subexpressions results are stored
     };
+
     //------------------------------------------------------------------
     /// Default constructor.
     ///
@@ -172,14 +168,14 @@ public:
     /// @param[in] match
     ///     A pointer to a RegularExpression::Match structure that was
     ///     properly initialized with the desired number of maximum
-    ///     matches, or NULL if no parenthesized matching is needed.
+    ///     matches, or nullptr if no parenthesized matching is needed.
     ///
     /// @return
     ///     \b true if \a string matches the compiled regular
     ///     expression, \b false otherwise.
     //------------------------------------------------------------------
     bool
-    Execute (const char* string, Match *match = NULL) const;
+    Execute(const char* string, Match *match = nullptr) const;
 
     size_t
     GetErrorAsCString (char *err_str, size_t err_str_max_len) const;
@@ -246,5 +242,4 @@ private:
 
 } // namespace lldb_private
 
-#endif  // #if defined(__cplusplus)
-#endif  // liblldb_DBRegex_h_
+#endif // liblldb_RegularExpression_h_




More information about the lldb-commits mailing list