forked from OSchip/llvm-project
Include llvm/ADT/STLExtras.h from lldb/Utility/Utils.h and use llvm::array_lengthof(), instead.
llvm-svn: 156876
This commit is contained in:
parent
7a0d86be26
commit
6ebc8c4598
|
@ -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
|
||||
|
|
|
@ -36,7 +36,7 @@ g_option_table[] =
|
|||
uint32_t
|
||||
OptionGroupArchitecture::GetNumDefinitions ()
|
||||
{
|
||||
return arraysize(g_option_table);
|
||||
return llvm::array_lengthof(g_option_table);
|
||||
}
|
||||
|
||||
const OptionDefinition *
|
||||
|
|
|
@ -38,7 +38,7 @@ g_option_table[] =
|
|||
uint32_t
|
||||
OptionGroupOutputFile::GetNumDefinitions ()
|
||||
{
|
||||
return arraysize(g_option_table);
|
||||
return llvm::array_lengthof(g_option_table);
|
||||
}
|
||||
|
||||
const OptionDefinition *
|
||||
|
|
|
@ -99,8 +99,8 @@ uint32_t
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ g_option_table[] =
|
|||
uint32_t
|
||||
OptionGroupUUID::GetNumDefinitions ()
|
||||
{
|
||||
return arraysize(g_option_table);
|
||||
return llvm::array_lengthof(g_option_table);
|
||||
}
|
||||
|
||||
const OptionDefinition *
|
||||
|
|
|
@ -49,7 +49,7 @@ g_option_table[] =
|
|||
uint32_t
|
||||
OptionGroupValueObjectDisplay::GetNumDefinitions ()
|
||||
{
|
||||
return arraysize(g_option_table);
|
||||
return llvm::array_lengthof(g_option_table);
|
||||
}
|
||||
|
||||
const OptionDefinition *
|
||||
|
|
|
@ -107,9 +107,9 @@ OptionGroupVariable::GetNumDefinitions ()
|
|||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -99,5 +99,5 @@ OptionGroupWatchpoint::GetDefinitions ()
|
|||
uint32_t
|
||||
OptionGroupWatchpoint::GetNumDefinitions ()
|
||||
{
|
||||
return arraysize(g_option_table);
|
||||
return llvm::array_lengthof(g_option_table);
|
||||
}
|
||||
|
|
|
@ -848,7 +848,7 @@ GDBRemoteDynamicRegisterInfo::HardcodeARMRegisters(bool from_scratch)
|
|||
{ "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 @@ GDBRemoteDynamicRegisterInfo::HardcodeARMRegisters(bool from_scratch)
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue