[clang-tools-extra] Use llvm::unique (NFC) (#136514)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user