https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/133548
This patch uses *Set::insert_range and a range constructor of DenseSet to clean up the code to populate sets. >From 41505bad0af11b0ee9fa8d92408facbe2445ea75 Mon Sep 17 00:00:00 2001 From: Kazu Hirata <k...@google.com> Date: Thu, 27 Mar 2025 20:27:46 -0700 Subject: [PATCH] [lldb] Use *Set::insert_range and a range constructor (NFC) This patch uses *Set::insert_range and a range constructor of DenseSet to clean up the code to populate sets. --- lldb/source/Host/common/NativeProcessProtocol.cpp | 2 +- .../Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp | 2 +- .../Handler/SetInstructionBreakpointsRequestHandler.cpp | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index e36eefaa6f4a4..405acbb5662d6 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -43,7 +43,7 @@ lldb_private::Status NativeProcessProtocol::Interrupt() { Status NativeProcessProtocol::IgnoreSignals(llvm::ArrayRef<int> signals) { m_signals_to_ignore.clear(); - m_signals_to_ignore.insert(signals.begin(), signals.end()); + m_signals_to_ignore.insert_range(signals); return Status(); } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp index 3ae32d4afd27a..9381a29f56f43 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp @@ -42,7 +42,7 @@ CxxModuleHandler::CxxModuleHandler(ASTImporter &importer, ASTContext *target) "allocator", "pair", }; - m_supported_templates.insert(supported_names.begin(), supported_names.end()); + m_supported_templates.insert_range(supported_names); } /// Builds a list of scopes that point into the given context. diff --git a/lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp index ec9576d4ab415..b1e47942de8e6 100644 --- a/lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp @@ -213,9 +213,8 @@ void SetInstructionBreakpointsRequestHandler::operator()( // Disable any instruction breakpoints that aren't in this request. // There is no call to remove instruction breakpoints other than calling this // function with a smaller or empty "breakpoints" list. - llvm::DenseSet<lldb::addr_t> seen; - for (const auto &addr : dap.instruction_breakpoints) - seen.insert(addr.first); + llvm::DenseSet<lldb::addr_t> seen( + llvm::from_range, llvm::make_first_range(dap.instruction_breakpoints)); for (const auto &bp : *breakpoints) { const auto *bp_obj = bp.getAsObject(); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits