llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangd

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

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


10 Files Affected:

- (modified) clang-tools-extra/clangd/IncludeFixer.cpp (+1-1) 
- (modified) clang-tools-extra/clangd/InlayHints.cpp (+1-1) 
- (modified) clang-tools-extra/clangd/SemanticHighlighting.cpp (+1-1) 
- (modified) clang-tools-extra/clangd/SourceCode.cpp (+1-1) 
- (modified) clang-tools-extra/clangd/XRefs.cpp (+13-13) 
- (modified) clang-tools-extra/clangd/index/FileIndex.cpp (+1-2) 
- (modified) clang-tools-extra/clangd/index/Relation.cpp (+1-2) 
- (modified) clang-tools-extra/clangd/index/dex/Trigram.cpp (+1-1) 
- (modified) clang-tools-extra/clangd/refactor/Rename.cpp (+2-3) 
- (modified) clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp 
(+1-3) 


``````````diff
diff --git a/clang-tools-extra/clangd/IncludeFixer.cpp 
b/clang-tools-extra/clangd/IncludeFixer.cpp
index 8b74c761d23ca..4ff021c4c390a 100644
--- a/clang-tools-extra/clangd/IncludeFixer.cpp
+++ b/clang-tools-extra/clangd/IncludeFixer.cpp
@@ -484,7 +484,7 @@ collectAccessibleScopes(Sema &Sem, const 
DeclarationNameInfo &Typo, Scope *S,
                          /*IncludeGlobalScope=*/false,
                          /*LoadExternal=*/false);
   llvm::sort(Scopes);
-  Scopes.erase(std::unique(Scopes.begin(), Scopes.end()), Scopes.end());
+  Scopes.erase(llvm::unique(Scopes), Scopes.end());
   return Scopes;
 }
 
diff --git a/clang-tools-extra/clangd/InlayHints.cpp 
b/clang-tools-extra/clangd/InlayHints.cpp
index 1b1bcf78c9855..40a824618f782 100644
--- a/clang-tools-extra/clangd/InlayHints.cpp
+++ b/clang-tools-extra/clangd/InlayHints.cpp
@@ -1194,7 +1194,7 @@ std::vector<InlayHint> inlayHints(ParsedAST &AST,
   // De-duplicate hints. Duplicates can sometimes occur due to e.g. explicit
   // template instantiations.
   llvm::sort(Results);
-  Results.erase(std::unique(Results.begin(), Results.end()), Results.end());
+  Results.erase(llvm::unique(Results), Results.end());
 
   return Results;
 }
diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index 86ca05644c703..dc574dcd11703 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -489,7 +489,7 @@ class HighlightingsBuilder {
     // Initializer lists can give duplicates of tokens, therefore all tokens
     // must be deduplicated.
     llvm::sort(Tokens);
-    auto Last = std::unique(Tokens.begin(), Tokens.end());
+    auto Last = llvm::unique(Tokens);
     Tokens.erase(Last, Tokens.end());
 
     // Macros can give tokens that have the same source range but conflicting
diff --git a/clang-tools-extra/clangd/SourceCode.cpp 
b/clang-tools-extra/clangd/SourceCode.cpp
index 780aaa471dc8b..1e1f7c68350ea 100644
--- a/clang-tools-extra/clangd/SourceCode.cpp
+++ b/clang-tools-extra/clangd/SourceCode.cpp
@@ -864,7 +864,7 @@ std::vector<std::string> visibleNamespaces(llvm::StringRef 
Code,
       return true;
     return LHS < RHS;
   });
-  Found.erase(std::unique(Found.begin(), Found.end()), Found.end());
+  Found.erase(llvm::unique(Found), Found.end());
   return Found;
 }
 
diff --git a/clang-tools-extra/clangd/XRefs.cpp 
b/clang-tools-extra/clangd/XRefs.cpp
index 8b9fffa3f64cd..053e2c044c774 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -909,13 +909,13 @@ class ReferenceFinder : public index::IndexDataConsumer {
       return std::tie(LTok, L.Role) < std::tie(RTok, R.Role);
     });
     // We sometimes see duplicates when parts of the AST get traversed twice.
-    References.erase(std::unique(References.begin(), References.end(),
-                                 [](const Reference &L, const Reference &R) {
-                                   auto LTok = L.SpelledTok.location();
-                                   auto RTok = R.SpelledTok.location();
-                                   return std::tie(LTok, L.Role) ==
-                                          std::tie(RTok, R.Role);
-                                 }),
+    References.erase(llvm::unique(References,
+                                  [](const Reference &L, const Reference &R) {
+                                    auto LTok = L.SpelledTok.location();
+                                    auto RTok = R.SpelledTok.location();
+                                    return std::tie(LTok, L.Role) ==
+                                           std::tie(RTok, R.Role);
+                                  }),
                      References.end());
     return std::move(References);
   }
@@ -1502,12 +1502,12 @@ ReferencesResult findReferences(ParsedAST &AST, 
Position Pos, uint32_t Limit,
     // We may get multiple refs with the same location and different Roles, as
     // cross-reference is only interested in locations, we deduplicate them
     // by the location to avoid emitting duplicated locations.
-    MainFileRefs.erase(std::unique(MainFileRefs.begin(), MainFileRefs.end(),
-                                   [](const ReferenceFinder::Reference &L,
-                                      const ReferenceFinder::Reference &R) {
-                                     return L.SpelledTok.location() ==
-                                            R.SpelledTok.location();
-                                   }),
+    MainFileRefs.erase(llvm::unique(MainFileRefs,
+                                    [](const ReferenceFinder::Reference &L,
+                                       const ReferenceFinder::Reference &R) {
+                                      return L.SpelledTok.location() ==
+                                             R.SpelledTok.location();
+                                    }),
                        MainFileRefs.end());
     for (const auto &Ref : MainFileRefs) {
       ReferencesResult::Reference Result;
diff --git a/clang-tools-extra/clangd/index/FileIndex.cpp 
b/clang-tools-extra/clangd/index/FileIndex.cpp
index aa573e312a756..c8f354de3c00f 100644
--- a/clang-tools-extra/clangd/index/FileIndex.cpp
+++ b/clang-tools-extra/clangd/index/FileIndex.cpp
@@ -370,8 +370,7 @@ FileSymbols::buildIndex(IndexType Type, DuplicateHandling 
DuplicateHandle,
   // relations being stored in both the shards containing their
   // subject and object.
   llvm::sort(AllRelations);
-  AllRelations.erase(std::unique(AllRelations.begin(), AllRelations.end()),
-                     AllRelations.end());
+  AllRelations.erase(llvm::unique(AllRelations), AllRelations.end());
 
   size_t StorageSize =
       RefsStorage.size() * sizeof(Ref) + SymsStorage.size() * sizeof(Symbol);
diff --git a/clang-tools-extra/clangd/index/Relation.cpp 
b/clang-tools-extra/clangd/index/Relation.cpp
index 2e5ae33939b0e..3b3e0ddc6d375 100644
--- a/clang-tools-extra/clangd/index/Relation.cpp
+++ b/clang-tools-extra/clangd/index/Relation.cpp
@@ -43,8 +43,7 @@ RelationSlab RelationSlab::Builder::build() && {
   llvm::sort(Relations);
 
   // Remove duplicates.
-  Relations.erase(std::unique(Relations.begin(), Relations.end()),
-                  Relations.end());
+  Relations.erase(llvm::unique(Relations), Relations.end());
 
   return RelationSlab{std::move(Relations)};
 }
diff --git a/clang-tools-extra/clangd/index/dex/Trigram.cpp 
b/clang-tools-extra/clangd/index/dex/Trigram.cpp
index c52af4e275a42..8a07086ff23e7 100644
--- a/clang-tools-extra/clangd/index/dex/Trigram.cpp
+++ b/clang-tools-extra/clangd/index/dex/Trigram.cpp
@@ -116,7 +116,7 @@ void generateIdentifierTrigrams(llvm::StringRef Identifier,
   } else {
     identifierTrigrams(Identifier, [&](Trigram T) { Result.push_back(T); });
     llvm::sort(Result);
-    Result.erase(std::unique(Result.begin(), Result.end()), Result.end());
+    Result.erase(llvm::unique(Result), Result.end());
   }
 }
 
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp 
b/clang-tools-extra/clangd/refactor/Rename.cpp
index 26059167208aa..e464f1ad45c52 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -906,7 +906,7 @@ findOccurrencesOutsideFile(const NamedDecl &RenameDecl,
   for (auto &FileAndOccurrences : AffectedFiles) {
     auto &Ranges = FileAndOccurrences.getValue();
     llvm::sort(Ranges);
-    Ranges.erase(std::unique(Ranges.begin(), Ranges.end()), Ranges.end());
+    Ranges.erase(llvm::unique(Ranges), Ranges.end());
 
     SPAN_ATTACH(Tracer, FileAndOccurrences.first(),
                 static_cast<int64_t>(Ranges.size()));
@@ -1210,8 +1210,7 @@ llvm::Expected<Edit> buildRenameEdit(llvm::StringRef 
AbsFilePath,
               static_cast<int64_t>(Occurrences.size()));
 
   assert(llvm::is_sorted(Occurrences));
-  assert(std::unique(Occurrences.begin(), Occurrences.end()) ==
-             Occurrences.end() &&
+  assert(llvm::unique(Occurrences) == Occurrences.end() &&
          "Occurrences must be unique");
 
   // These two always correspond to the same position.
diff --git a/clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp 
b/clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp
index da32e00a0ee06..5baa970bcb0c5 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp
@@ -196,9 +196,7 @@ Expected<Tweak::Effect> RemoveUsingNamespace::apply(const 
Selection &Inputs) {
   }
   // Remove duplicates.
   llvm::sort(IdentsToQualify);
-  IdentsToQualify.erase(
-      std::unique(IdentsToQualify.begin(), IdentsToQualify.end()),
-      IdentsToQualify.end());
+  IdentsToQualify.erase(llvm::unique(IdentsToQualify), IdentsToQualify.end());
 
   // Produce replacements to remove the using directives.
   tooling::Replacements R;

``````````

</details>


https://github.com/llvm/llvm-project/pull/136470
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to