Skip to content

[clang] Use llvm::unique (NFC) #140459

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/include/clang/Serialization/ContinuousRangeMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ class ContinuousRangeMap {
~Builder() {
llvm::sort(Self.Rep, Compare());
Self.Rep.erase(
std::unique(
Self.Rep.begin(), Self.Rep.end(),
llvm::unique(
Self.Rep,
[](const_reference A, const_reference B) {
// FIXME: we should not allow any duplicate keys, but there are
// a lot of duplicate 0 -> 0 mappings to remove first.
Expand Down
9 changes: 4 additions & 5 deletions clang/lib/Format/UsingDeclarationsSorter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,10 @@ void endUsingDeclarationBlock(
};
llvm::stable_sort(SortedUsingDeclarations, Comp);
SortedUsingDeclarations.erase(
std::unique(SortedUsingDeclarations.begin(),
SortedUsingDeclarations.end(),
[](const UsingDeclaration &a, const UsingDeclaration &b) {
return a.Label == b.Label;
}),
llvm::unique(SortedUsingDeclarations,
[](const UsingDeclaration &a, const UsingDeclaration &b) {
return a.Label == b.Label;
}),
SortedUsingDeclarations.end());
for (size_t I = 0, E = UsingDeclarations->size(); I < E; ++I) {
if (I >= SortedUsingDeclarations.size()) {
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaLambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1633,8 +1633,8 @@ static void repeatForLambdaConversionFunctionCallingConvs(
CC_C, CC_X86StdCall, CC_X86FastCall, CC_X86VectorCall,
DefaultFree, DefaultMember, CallOpCC};
llvm::sort(Convs);
llvm::iterator_range<CallingConv *> Range(
std::begin(Convs), std::unique(std::begin(Convs), std::end(Convs)));
llvm::iterator_range<CallingConv *> Range(std::begin(Convs),
llvm::unique(Convs));
const TargetInfo &TI = S.getASTContext().getTargetInfo();

for (CallingConv C : Range) {
Expand Down
5 changes: 2 additions & 3 deletions clang/tools/libclang/CIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8872,9 +8872,8 @@ static void getCursorPlatformAvailabilityForDecl(
return LHS->getPlatform()->getName() < RHS->getPlatform()->getName();
});
ASTContext &Ctx = D->getASTContext();
auto It = std::unique(
AvailabilityAttrs.begin(), AvailabilityAttrs.end(),
[&Ctx](AvailabilityAttr *LHS, AvailabilityAttr *RHS) {
auto It = llvm::unique(
AvailabilityAttrs, [&Ctx](AvailabilityAttr *LHS, AvailabilityAttr *RHS) {
if (LHS->getPlatform() != RHS->getPlatform())
return false;

Expand Down