Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented May 13, 2025

@llvm/pr-subscribers-clangd

@llvm/pr-subscribers-clang-tools-extra

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/139663.diff

3 Files Affected:

  • (modified) clang-tools-extra/clangd/Hover.cpp (+2-3)
  • (modified) clang-tools-extra/include-cleaner/lib/HTMLReport.cpp (+1-2)
  • (modified) clang-tools-extra/include-cleaner/lib/Record.cpp (+1-3)
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));
   }

@kazutakahirata kazutakahirata merged commit 75e0865 into llvm:main May 13, 2025
14 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_range_std_unique_clang_tools branch May 13, 2025 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants