Skip to content

Commit

Permalink
Use llvm::erase_value (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Oct 17, 2021
1 parent 6176fda commit 1072699
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Analysis/Analyses/Dominators.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ struct ChildrenGetterTy<clang::CFGBlock, IsPostDom> {

auto Children = children<OrderedNodeTy>(N);
ChildrenTy Ret{Children.begin(), Children.end()};
Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
llvm::erase_value(Ret, nullptr);
return Ret;
}
};
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/JsonSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ inline std::string JsonFormat(StringRef RawSR, bool AddQuotes) {
}

// Remove new-lines.
Str.erase(std::remove(Str.begin(), Str.end(), '\n'), Str.end());
llvm::erase_value(Str, '\n');

if (!AddQuotes)
return Str;
Expand Down
5 changes: 1 addition & 4 deletions clang/include/clang/Sema/ScopeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1001,10 +1001,7 @@ class LambdaScopeInfo final :
return NonODRUsedCapturingExprs.count(CapturingVarExpr);
}
void removePotentialCapture(Expr *E) {
PotentiallyCapturingExprs.erase(
std::remove(PotentiallyCapturingExprs.begin(),
PotentiallyCapturingExprs.end(), E),
PotentiallyCapturingExprs.end());
llvm::erase_value(PotentiallyCapturingExprs, E);
}
void clearPotentialCaptures() {
PotentiallyCapturingExprs.clear();
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ void ASTContext::deduplicateMergedDefinitonsFor(NamedDecl *ND) {
for (Module *&M : Merged)
if (!Found.insert(M).second)
M = nullptr;
Merged.erase(std::remove(Merged.begin(), Merged.end(), nullptr), Merged.end());
llvm::erase_value(Merged, nullptr);
}

ArrayRef<Module *>
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Sema/SemaExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16641,8 +16641,7 @@ void Sema::CheckUnusedVolatileAssignment(Expr *E) {
if (auto *BO = dyn_cast<BinaryOperator>(E->IgnoreParenImpCasts())) {
if (BO->getOpcode() == BO_Assign) {
auto &LHSs = ExprEvalContexts.back().VolatileAssignmentLHSs;
LHSs.erase(std::remove(LHSs.begin(), LHSs.end(), BO->getLHS()),
LHSs.end());
llvm::erase_value(LHSs, BO->getLHS());
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions lld/ELF/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ void elf::combineEhSections() {
}
}

std::vector<InputSectionBase *> &v = inputSections;
v.erase(std::remove(v.begin(), v.end(), nullptr), v.end());
llvm::erase_value(inputSections, nullptr);
}

static Defined *addOptionalRegular(StringRef name, SectionBase *sec,
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/TableGen/DirectiveEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class Clause : public BaseRecord {
}
return C;
});
N.erase(std::remove(N.begin(), N.end(), '_'), N.end());
llvm::erase_value(N, '_');
return N;
}

Expand Down

0 comments on commit 1072699

Please sign in to comment.