[clang-tools-extra] 75e0865 - [clang-tools-extra] Use llvm::unique (NFC) (#139663)

via cfe-commits cfe-commits at lists.llvm.org
Mon May 12 23:24:26 PDT 2025


Author: Kazu Hirata
Date: 2025-05-12T23:24:24-07:00
New Revision: 75e0865837519493c4efaa6f33480e1db8f2e462

URL: https://github.com/llvm/llvm-project/commit/75e0865837519493c4efaa6f33480e1db8f2e462
DIFF: https://github.com/llvm/llvm-project/commit/75e0865837519493c4efaa6f33480e1db8f2e462.diff

LOG: [clang-tools-extra] Use llvm::unique (NFC) (#139663)

Added: 
    

Modified: 
    clang-tools-extra/clangd/Hover.cpp
    clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
    clang-tools-extra/include-cleaner/lib/Record.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp
index 3ab3d89030520..e39d8bfcf83f3 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -1270,9 +1270,8 @@ void maybeAddUsedSymbols(ParsedAST &AST, HoverInfo &HI, const Inclusion &Inc) {
   for (const auto &UsedSymbolDecl : UsedSymbols)
     HI.UsedSymbolNames.push_back(getSymbolName(UsedSymbolDecl));
   llvm::sort(HI.UsedSymbolNames);
-  HI.UsedSymbolNames.erase(
-      std::unique(HI.UsedSymbolNames.begin(), HI.UsedSymbolNames.end()),
-      HI.UsedSymbolNames.end());
+  HI.UsedSymbolNames.erase(llvm::unique(HI.UsedSymbolNames),
+                           HI.UsedSymbolNames.end());
 }
 
 } // namespace

diff  --git a/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp b/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
index 92c7c554ca50c..b0a6c9565befd 100644
--- a/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
+++ b/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
@@ -186,8 +186,7 @@ class Reporter {
       R.Satisfied = true;
     // Include pointers are meaningfully ordered as they are backed by a vector.
     llvm::sort(R.Includes);
-    R.Includes.erase(std::unique(R.Includes.begin(), R.Includes.end()),
-                     R.Includes.end());
+    R.Includes.erase(llvm::unique(R.Includes), R.Includes.end());
 
     if (!R.Headers.empty())
       R.Insert =

diff  --git a/clang-tools-extra/include-cleaner/lib/Record.cpp b/clang-tools-extra/include-cleaner/lib/Record.cpp
index 6b5be956ec108..4dc217d3f41da 100644
--- a/clang-tools-extra/include-cleaner/lib/Record.cpp
+++ b/clang-tools-extra/include-cleaner/lib/Record.cpp
@@ -205,9 +205,7 @@ class PragmaIncludes::RecordPragma : public PPCallbacks, public CommentHandler {
   void EndOfMainFile() override {
     for (auto &It : Out->IWYUExportBy) {
       llvm::sort(It.getSecond());
-      It.getSecond().erase(
-          std::unique(It.getSecond().begin(), It.getSecond().end()),
-          It.getSecond().end());
+      It.getSecond().erase(llvm::unique(It.getSecond()), It.getSecond().end());
     }
     Out->Arena.emplace_back(std::move(Arena));
   }


        


More information about the cfe-commits mailing list