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

This commit is contained in:
Kazu Hirata
2025-04-20 18:30:05 -07:00
committed by GitHub
parent c6e7bb19f7
commit be48727b95
3 changed files with 12 additions and 13 deletions

View File

@@ -200,7 +200,7 @@ void Info::mergeBase(Info &&Other) {
std::move(Other.Description.begin(), Other.Description.end(),
std::back_inserter(Description));
llvm::sort(Description);
auto Last = std::unique(Description.begin(), Description.end());
auto Last = llvm::unique(Description);
Description.erase(Last, Description.end());
}
@@ -215,7 +215,7 @@ void SymbolInfo::merge(SymbolInfo &&Other) {
// Unconditionally extend the list of locations, since we want all of them.
std::move(Other.Loc.begin(), Other.Loc.end(), std::back_inserter(Loc));
llvm::sort(Loc);
auto *Last = std::unique(Loc.begin(), Loc.end());
auto *Last = llvm::unique(Loc);
Loc.erase(Last, Loc.end());
mergeBase(std::move(Other));
}

View File

@@ -90,10 +90,10 @@ IncludeFixerContext::IncludeFixerContext(
std::make_pair(B.Range.getOffset(), B.Range.getLength());
});
QuerySymbolInfos.erase(
std::unique(QuerySymbolInfos.begin(), QuerySymbolInfos.end(),
[](const QuerySymbolInfo &A, const QuerySymbolInfo &B) {
return A.Range == B.Range;
}),
llvm::unique(QuerySymbolInfos,
[](const QuerySymbolInfo &A, const QuerySymbolInfo &B) {
return A.Range == B.Range;
}),
QuerySymbolInfos.end());
for (const auto &Symbol : MatchedSymbols) {
HeaderInfos.push_back(
@@ -103,11 +103,11 @@ IncludeFixerContext::IncludeFixerContext(
QuerySymbolInfos.front().ScopedQualifiers, Symbol)});
}
// Deduplicate header infos.
HeaderInfos.erase(std::unique(HeaderInfos.begin(), HeaderInfos.end(),
[](const HeaderInfo &A, const HeaderInfo &B) {
return A.Header == B.Header &&
A.QualifiedName == B.QualifiedName;
}),
HeaderInfos.erase(llvm::unique(HeaderInfos,
[](const HeaderInfo &A, const HeaderInfo &B) {
return A.Header == B.Header &&
A.QualifiedName == B.QualifiedName;
}),
HeaderInfos.end());
}

View File

@@ -754,8 +754,7 @@ std::vector<ClangTidyError> ClangTidyDiagnosticConsumer::take() {
finalizeLastError();
llvm::stable_sort(Errors, LessClangTidyError());
Errors.erase(std::unique(Errors.begin(), Errors.end(), EqualClangTidyError()),
Errors.end());
Errors.erase(llvm::unique(Errors, EqualClangTidyError()), Errors.end());
if (RemoveIncompatibleErrors)
removeIncompatibleErrors();
return std::move(Errors);