[Lldb-commits] [lldb] [lldb] Use llvm::unique (NFC) (PR #136527)

Kazu Hirata via lldb-commits lldb-commits at lists.llvm.org
Sun Apr 20 18:44:56 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/136527

None

>From a053656528fc7c1495b971fb77da030215aeb0e5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 20 Apr 2025 18:31:31 -0700
Subject: [PATCH] [lldb] Use llvm::unique (NFC)

---
 lldb/source/Symbol/Symtab.cpp                              | 6 ++----
 lldb/source/Target/Target.cpp                              | 5 ++---
 lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp | 3 +--
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index 3c5075d9bb18b..9aee5d3e813d8 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -642,7 +642,7 @@ void Symtab::SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
 
   // Remove any duplicates if requested
   if (remove_duplicates) {
-    auto last = std::unique(indexes.begin(), indexes.end());
+    auto last = llvm::unique(indexes);
     indexes.erase(last, indexes.end());
   }
 }
@@ -1151,9 +1151,7 @@ void Symtab::FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
 
   if (!symbol_indexes.empty()) {
     llvm::sort(symbol_indexes);
-    symbol_indexes.erase(
-        std::unique(symbol_indexes.begin(), symbol_indexes.end()),
-        symbol_indexes.end());
+    symbol_indexes.erase(llvm::unique(symbol_indexes), symbol_indexes.end());
     SymbolIndicesToSymbolContextList(symbol_indexes, sc_list);
   }
 }
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index b6186b76d6236..0fa61b20e19b9 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2641,9 +2641,8 @@ Target::GetScratchTypeSystems(bool create_on_demand) {
   }
 
   std::sort(scratch_type_systems.begin(), scratch_type_systems.end());
-  scratch_type_systems.erase(
-      std::unique(scratch_type_systems.begin(), scratch_type_systems.end()),
-      scratch_type_systems.end());
+  scratch_type_systems.erase(llvm::unique(scratch_type_systems),
+                             scratch_type_systems.end());
   return scratch_type_systems;
 }
 
diff --git a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
index 022baf77458d0..7a477f3e97875 100644
--- a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
@@ -189,8 +189,7 @@ void BreakpointLocationsRequestHandler::operator()(
   // The line entries are sorted by addresses, but we must return the list
   // ordered by line / column position.
   std::sort(locations.begin(), locations.end());
-  locations.erase(std::unique(locations.begin(), locations.end()),
-                  locations.end());
+  locations.erase(llvm::unique(locations), locations.end());
 
   llvm::json::Array locations_json;
   for (auto &l : locations) {



More information about the lldb-commits mailing list