Use llvm::erase_value (NFC)

This commit is contained in:
Kazu Hirata 2021-10-16 23:31:20 -07:00
parent 6176fda3f9
commit 10726992fa
7 changed files with 7 additions and 12 deletions

View File

@ -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;
}
};

View File

@ -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;

View File

@ -1001,10 +1001,7 @@ public:
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();

View File

@ -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 *>

View File

@ -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());
}
}
}

View File

@ -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,

View File

@ -152,7 +152,7 @@ public:
}
return C;
});
N.erase(std::remove(N.begin(), N.end(), '_'), N.end());
llvm::erase_value(N, '_');
return N;
}