Skip to content

Commit be48727

Browse files
[clang-tools-extra] Use llvm::unique (NFC) (#136514)
1 parent c6e7bb1 commit be48727

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void Info::mergeBase(Info &&Other) {
200200
std::move(Other.Description.begin(), Other.Description.end(),
201201
std::back_inserter(Description));
202202
llvm::sort(Description);
203-
auto Last = std::unique(Description.begin(), Description.end());
203+
auto Last = llvm::unique(Description);
204204
Description.erase(Last, Description.end());
205205
}
206206

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

clang-tools-extra/clang-include-fixer/IncludeFixerContext.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ IncludeFixerContext::IncludeFixerContext(
9090
std::make_pair(B.Range.getOffset(), B.Range.getLength());
9191
});
9292
QuerySymbolInfos.erase(
93-
std::unique(QuerySymbolInfos.begin(), QuerySymbolInfos.end(),
94-
[](const QuerySymbolInfo &A, const QuerySymbolInfo &B) {
95-
return A.Range == B.Range;
96-
}),
93+
llvm::unique(QuerySymbolInfos,
94+
[](const QuerySymbolInfo &A, const QuerySymbolInfo &B) {
95+
return A.Range == B.Range;
96+
}),
9797
QuerySymbolInfos.end());
9898
for (const auto &Symbol : MatchedSymbols) {
9999
HeaderInfos.push_back(
@@ -103,11 +103,11 @@ IncludeFixerContext::IncludeFixerContext(
103103
QuerySymbolInfos.front().ScopedQualifiers, Symbol)});
104104
}
105105
// Deduplicate header infos.
106-
HeaderInfos.erase(std::unique(HeaderInfos.begin(), HeaderInfos.end(),
107-
[](const HeaderInfo &A, const HeaderInfo &B) {
108-
return A.Header == B.Header &&
109-
A.QualifiedName == B.QualifiedName;
110-
}),
106+
HeaderInfos.erase(llvm::unique(HeaderInfos,
107+
[](const HeaderInfo &A, const HeaderInfo &B) {
108+
return A.Header == B.Header &&
109+
A.QualifiedName == B.QualifiedName;
110+
}),
111111
HeaderInfos.end());
112112
}
113113

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,7 @@ std::vector<ClangTidyError> ClangTidyDiagnosticConsumer::take() {
754754
finalizeLastError();
755755

756756
llvm::stable_sort(Errors, LessClangTidyError());
757-
Errors.erase(std::unique(Errors.begin(), Errors.end(), EqualClangTidyError()),
758-
Errors.end());
757+
Errors.erase(llvm::unique(Errors, EqualClangTidyError()), Errors.end());
759758
if (RemoveIncompatibleErrors)
760759
removeIncompatibleErrors();
761760
return std::move(Errors);

0 commit comments

Comments
 (0)