[Lldb-commits] [lldb] r156876 - in /lldb/trunk: include/lldb/Utility/Utils.h source/Interpreter/OptionGroupArchitecture.cpp source/Interpreter/OptionGroupOutputFile.cpp source/Interpreter/OptionGroupPlatform.cpp source/Interpreter/OptionGroupUUID.cpp source/Interpreter/OptionGroupValueObjectDisplay.cpp source/Interpreter/OptionGroupVariable.cpp source/Interpreter/OptionGroupWatchpoint.cpp source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Johnny Chen johnny.chen at apple.com
Tue May 15 16:21:36 PDT 2012


Author: johnny
Date: Tue May 15 18:21:36 2012
New Revision: 156876

URL: http://llvm.org/viewvc/llvm-project?rev=156876&view=rev
Log:
Include llvm/ADT/STLExtras.h from lldb/Utility/Utils.h and use llvm::array_lengthof(), instead.

Modified:
    lldb/trunk/include/lldb/Utility/Utils.h
    lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
    lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
    lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
    lldb/trunk/source/Interpreter/OptionGroupUUID.cpp
    lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
    lldb/trunk/source/Interpreter/OptionGroupVariable.cpp
    lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Modified: lldb/trunk/include/lldb/Utility/Utils.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Utils.h?rev=156876&r1=156875&r2=156876&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/Utils.h (original)
+++ lldb/trunk/include/lldb/Utility/Utils.h Tue May 15 18:21:36 2012
@@ -10,11 +10,13 @@
 #ifndef utility_Utils_h_
 #define utility_Utils_h_
 
+// These utilities have llvm namespace.
+#include "llvm/ADT/STLExtras.h"
+
 namespace lldb_private {
 
-// Return the number of elements of a static array.
-template <typename T, unsigned size>
-inline unsigned arraysize(T (&v)[size]) { return size; }
+// Add lldb utilities here.
 
 } // namespace lldb_private
+
 #endif // utility_Utils

Modified: lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp?rev=156876&r1=156875&r2=156876&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp Tue May 15 18:21:36 2012
@@ -36,7 +36,7 @@
 uint32_t
 OptionGroupArchitecture::GetNumDefinitions ()
 {
-    return arraysize(g_option_table);
+    return llvm::array_lengthof(g_option_table);
 }
 
 const OptionDefinition *

Modified: lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp?rev=156876&r1=156875&r2=156876&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp Tue May 15 18:21:36 2012
@@ -38,7 +38,7 @@
 uint32_t
 OptionGroupOutputFile::GetNumDefinitions ()
 {
-    return arraysize(g_option_table);
+    return llvm::array_lengthof(g_option_table);
 }
 
 const OptionDefinition *

Modified: lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp?rev=156876&r1=156875&r2=156876&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp Tue May 15 18:21:36 2012
@@ -99,8 +99,8 @@
 OptionGroupPlatform::GetNumDefinitions ()
 {
     if (m_include_platform_option)
-        return arraysize(g_option_table);
-    return arraysize(g_option_table) - 1;
+        return llvm::array_lengthof(g_option_table);
+    return llvm::array_lengthof(g_option_table) - 1;
 }
 
 

Modified: lldb/trunk/source/Interpreter/OptionGroupUUID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupUUID.cpp?rev=156876&r1=156875&r2=156876&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupUUID.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupUUID.cpp Tue May 15 18:21:36 2012
@@ -36,7 +36,7 @@
 uint32_t
 OptionGroupUUID::GetNumDefinitions ()
 {
-    return arraysize(g_option_table);
+    return llvm::array_lengthof(g_option_table);
 }
 
 const OptionDefinition *

Modified: lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp?rev=156876&r1=156875&r2=156876&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp Tue May 15 18:21:36 2012
@@ -49,7 +49,7 @@
 uint32_t
 OptionGroupValueObjectDisplay::GetNumDefinitions ()
 {
-    return arraysize(g_option_table);
+    return llvm::array_lengthof(g_option_table);
 }
 
 const OptionDefinition *

Modified: lldb/trunk/source/Interpreter/OptionGroupVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupVariable.cpp?rev=156876&r1=156875&r2=156876&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupVariable.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupVariable.cpp Tue May 15 18:21:36 2012
@@ -107,9 +107,9 @@
     // Count the "--no-args", "--no-locals" and "--show-globals" 
     // options if we are showing frame specific options.
     if (include_frame_options)
-        return arraysize(g_option_table);
+        return llvm::array_lengthof(g_option_table);
     else
-        return arraysize(g_option_table) - NUM_FRAME_OPTS;
+        return llvm::array_lengthof(g_option_table) - NUM_FRAME_OPTS;
 }
 
 

Modified: lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp?rev=156876&r1=156875&r2=156876&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp Tue May 15 18:21:36 2012
@@ -99,5 +99,5 @@
 uint32_t
 OptionGroupWatchpoint::GetNumDefinitions ()
 {
-    return arraysize(g_option_table);
+    return llvm::array_lengthof(g_option_table);
 }

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=156876&r1=156875&r2=156876&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Tue May 15 18:21:36 2012
@@ -848,7 +848,7 @@
     { "q15",  NULL,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q15,   LLDB_INVALID_REGNUM,   106,    106 },  g_q15_regs,              NULL}
     };
 
-    static const uint32_t num_registers = arraysize(g_register_infos);
+    static const uint32_t num_registers = llvm::array_lengthof(g_register_infos);
     static ConstString gpr_reg_set ("General Purpose Registers");
     static ConstString sfp_reg_set ("Software Floating Point Registers");
     static ConstString vfp_reg_set ("Floating Point Registers");
@@ -900,7 +900,7 @@
     else
     {
         // Add composite registers to our primordial registers, then.
-        const uint32_t num_composites = arraysize(g_composites);
+        const uint32_t num_composites = llvm::array_lengthof(g_composites);
         const uint32_t num_primordials = GetNumRegisters();
         RegisterInfo *g_comp_register_infos = g_register_infos + (num_registers - num_composites);
         for (i=0; i<num_composites; ++i)





More information about the lldb-commits mailing list