Skip to content

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

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-doc/Representation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand All @@ -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));
}
Expand Down
18 changes: 9 additions & 9 deletions clang-tools-extra/clang-include-fixer/IncludeFixerContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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());
}

Expand Down
3 changes: 1 addition & 2 deletions clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading