diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -76,7 +76,7 @@ kNumFormats, "All formats must have a corresponding info entry."); -static uint32_t g_num_format_infos = llvm::array_lengthof(g_format_infos); +static uint32_t g_num_format_infos = std::size(g_format_infos); static bool GetFormatFromFormatChar(char format_char, Format &format) { for (uint32_t i = 0; i < g_num_format_infos; ++i) { diff --git a/lldb/source/Host/posix/MainLoopPosix.cpp b/lldb/source/Host/posix/MainLoopPosix.cpp --- a/lldb/source/Host/posix/MainLoopPosix.cpp +++ b/lldb/source/Host/posix/MainLoopPosix.cpp @@ -81,7 +81,7 @@ EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), - out_events, llvm::array_lengthof(out_events), nullptr); + out_events, std::size(out_events), nullptr); if (num_events < 0) { if (errno == EINTR) { diff --git a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp --- a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp +++ b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp @@ -188,9 +188,8 @@ ? std::chrono::duration_cast(*timeout) .count() : INFINITE; - DWORD wait_result = - ::WaitForMultipleObjects(llvm::array_lengthof(m_event_handles), - m_event_handles, FALSE, milliseconds); + DWORD wait_result = ::WaitForMultipleObjects( + std::size(m_event_handles), m_event_handles, FALSE, milliseconds); // All of the events are manual reset events, so make sure we reset them // to non-signalled. switch (wait_result) { diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -561,7 +561,7 @@ "breakpoint set --name '%1'"}}; // clang-format on - size_t num_regexes = llvm::array_lengthof(break_regexes); + size_t num_regexes = std::size(break_regexes); std::unique_ptr break_regex_cmd_up( new CommandObjectRegexCommand( diff --git a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp --- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp +++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp @@ -1186,8 +1186,7 @@ nullptr, }}; -static const uint32_t k_num_register_infos = - llvm::array_lengthof(g_register_infos); +static const uint32_t k_num_register_infos = std::size(g_register_infos); const lldb_private::RegisterInfo * ABIMacOSX_arm::GetRegisterInfoArray(uint32_t &count) { @@ -1235,7 +1234,7 @@ llvm::ArrayRef::iterator ai = args.begin(), ae = args.end(); - for (size_t i = 0; i < llvm::array_lengthof(reg_names); ++i) { + for (size_t i = 0; i < std::size(reg_names); ++i) { if (ai == ae) break; diff --git a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp --- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp +++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp @@ -1189,8 +1189,7 @@ nullptr, }}; -static const uint32_t k_num_register_infos = - llvm::array_lengthof(g_register_infos); +static const uint32_t k_num_register_infos = std::size(g_register_infos); const lldb_private::RegisterInfo * ABISysV_arm::GetRegisterInfoArray(uint32_t &count) { @@ -1240,7 +1239,7 @@ llvm::ArrayRef::iterator ai = args.begin(), ae = args.end(); - for (size_t i = 0; i < llvm::array_lengthof(reg_names); ++i) { + for (size_t i = 0; i < std::size(reg_names); ++i) { if (ai == ae) break; diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp @@ -503,8 +503,7 @@ }, }; -static const uint32_t k_num_register_infos = - llvm::array_lengthof(g_register_infos); +static const uint32_t k_num_register_infos = std::size(g_register_infos); const lldb_private::RegisterInfo * ABISysV_mips::GetRegisterInfoArray(uint32_t &count) { @@ -560,7 +559,7 @@ llvm::ArrayRef::iterator ai = args.begin(), ae = args.end(); // Write arguments to registers - for (size_t i = 0; i < llvm::array_lengthof(reg_names); ++i) { + for (size_t i = 0; i < std::size(reg_names); ++i) { if (ai == ae) break; diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp @@ -503,8 +503,7 @@ }, }; -static const uint32_t k_num_register_infos = - llvm::array_lengthof(g_register_infos_mips64); +static const uint32_t k_num_register_infos = std::size(g_register_infos_mips64); const lldb_private::RegisterInfo * ABISysV_mips64::GetRegisterInfoArray(uint32_t &count) { diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp @@ -204,8 +204,7 @@ nullptr, }}; -static const uint32_t k_num_register_infos = - llvm::array_lengthof(g_register_infos); +static const uint32_t k_num_register_infos = std::size(g_register_infos); const lldb_private::RegisterInfo * ABISysV_ppc::GetRegisterInfoArray(uint32_t &count) { diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp @@ -53,10 +53,10 @@ const lldb_private::RegisterInfo * ABISysV_ppc64::GetRegisterInfoArray(uint32_t &count) { if (GetByteOrder() == lldb::eByteOrderLittle) { - count = llvm::array_lengthof(g_register_infos_ppc64le); + count = std::size(g_register_infos_ppc64le); return g_register_infos_ppc64le; } else { - count = llvm::array_lengthof(g_register_infos_ppc64); + count = std::size(g_register_infos_ppc64); return g_register_infos_ppc64; } } diff --git a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp --- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp +++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp @@ -172,8 +172,7 @@ DEFINE_REG(f15, 8, nullptr, LLDB_INVALID_REGNUM), }; -static const uint32_t k_num_register_infos = - llvm::array_lengthof(g_register_infos); +static const uint32_t k_num_register_infos = std::size(g_register_infos); const lldb_private::RegisterInfo * ABISysV_s390x::GetRegisterInfoArray(uint32_t &count) { diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -406,7 +406,7 @@ const uint32_t magicks[] = { llvm::MachO::MH_MAGIC_64, llvm::MachO::MH_MAGIC, llvm::MachO::MH_CIGAM, llvm::MachO::MH_CIGAM_64}; bool found_matching_pattern = false; - for (size_t i = 0; i < llvm::array_lengthof (magicks); i++) + for (size_t i = 0; i < std::size(magicks); i++) if (::memcmp (&header.magic, &magicks[i], sizeof (uint32_t)) == 0) found_matching_pattern = true; diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -13188,7 +13188,7 @@ &EmulateInstructionARM::EmulateRFE, "rfe{} {!}"} }; - static const size_t k_num_arm_opcodes = llvm::array_lengthof(g_arm_opcodes); + static const size_t k_num_arm_opcodes = std::size(g_arm_opcodes); for (size_t i = 0; i < k_num_arm_opcodes; ++i) { if ((g_arm_opcodes[i].mask & opcode) == g_arm_opcodes[i].value && @@ -13739,7 +13739,7 @@ &EmulateInstructionARM::EmulateUXTH, "uxth.w ,{,}"}, }; - const size_t k_num_thumb_opcodes = llvm::array_lengthof(g_thumb_opcodes); + const size_t k_num_thumb_opcodes = std::size(g_thumb_opcodes); for (size_t i = 0; i < k_num_thumb_opcodes; ++i) { if ((g_thumb_opcodes[i].mask & opcode) == g_thumb_opcodes[i].value && (g_thumb_opcodes[i].variants & arm_isa) != 0) diff --git a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp --- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp +++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp @@ -52,7 +52,7 @@ LLDB_PLUGIN_DEFINE_ADV(EmulateInstructionARM64, InstructionARM64) static bool LLDBTableGetRegisterInfo(uint32_t reg_num, RegisterInfo ®_info) { - if (reg_num >= llvm::array_lengthof(g_register_infos_arm64_le)) + if (reg_num >= std::size(g_register_infos_arm64_le)) return false; reg_info = g_register_infos_arm64_le[reg_num]; return true; @@ -360,7 +360,7 @@ "TBNZ , #,