aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2021-10-17 13:50:29 -0700
committerKazu Hirata <kazu@google.com>2021-10-17 13:50:29 -0700
commitd245f2e8597bfb52c34810a328d42b990e4af1a4 (patch)
tree5387f89bbb0e696f24a533c44478b5087353bc1f /clang/lib
parentdc3382dc2c12bd48227361e7f32a37df418f9f5a (diff)
downloadllvm-d245f2e8597bfb52c34810a328d42b990e4af1a4.zip
llvm-d245f2e8597bfb52c34810a328d42b990e4af1a4.tar.gz
llvm-d245f2e8597bfb52c34810a328d42b990e4af1a4.tar.bz2
[clang] Use llvm::erase_if (NFC)
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp20
-rw-r--r--clang/lib/AST/CXXInheritance.cpp4
-rw-r--r--clang/lib/AST/CommentSema.cpp4
-rw-r--r--clang/lib/AST/DeclCXX.cpp9
-rw-r--r--clang/lib/AST/ExprConstant.cpp12
-rw-r--r--clang/lib/AST/ExternalASTMerger.cpp18
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp7
-rw-r--r--clang/lib/Driver/Multilib.cpp2
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp4
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp8
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp7
-rw-r--r--clang/lib/Serialization/ModuleManager.cpp3
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp3
13 files changed, 35 insertions, 66 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 1292cb6..84b09dc 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -9199,13 +9199,9 @@ void getIntersectionOfProtocols(ASTContext &Context,
// Remove any implied protocols from the list of inherited protocols.
if (!ImpliedProtocols.empty()) {
- IntersectionSet.erase(
- std::remove_if(IntersectionSet.begin(),
- IntersectionSet.end(),
- [&](ObjCProtocolDecl *proto) -> bool {
- return ImpliedProtocols.count(proto) > 0;
- }),
- IntersectionSet.end());
+ llvm::erase_if(IntersectionSet, [&](ObjCProtocolDecl *proto) -> bool {
+ return ImpliedProtocols.count(proto) > 0;
+ });
}
// Sort the remaining protocols by name.
@@ -11719,13 +11715,9 @@ ASTContext::filterFunctionTargetAttrs(const TargetAttr *TD) const {
assert(TD != nullptr);
ParsedTargetAttr ParsedAttr = TD->parse();
- ParsedAttr.Features.erase(
- llvm::remove_if(ParsedAttr.Features,
- [&](const std::string &Feat) {
- return !Target->isValidFeatureName(
- StringRef{Feat}.substr(1));
- }),
- ParsedAttr.Features.end());
+ llvm::erase_if(ParsedAttr.Features, [&](const std::string &Feat) {
+ return !Target->isValidFeatureName(StringRef{Feat}.substr(1));
+ });
return ParsedAttr;
}
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp
index cc787ed..96a6f34 100644
--- a/clang/lib/AST/CXXInheritance.cpp
+++ b/clang/lib/AST/CXXInheritance.cpp
@@ -671,9 +671,7 @@ CXXRecordDecl::getFinalOverriders(CXXFinalOverriderMap &FinalOverriders) const {
// FIXME: IsHidden reads from Overriding from the middle of a remove_if
// over the same sequence! Is this guaranteed to work?
- Overriding.erase(
- std::remove_if(Overriding.begin(), Overriding.end(), IsHidden),
- Overriding.end());
+ llvm::erase_if(Overriding, IsHidden);
}
}
}
diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp
index 7642e73..e385c58 100644
--- a/clang/lib/AST/CommentSema.cpp
+++ b/clang/lib/AST/CommentSema.cpp
@@ -236,9 +236,7 @@ void Sema::actOnParamCommandDirectionArg(ParamCommandComment *Command,
if (Direction == -1) {
// Try again with whitespace removed.
- ArgLower.erase(
- std::remove_if(ArgLower.begin(), ArgLower.end(), clang::isWhitespace),
- ArgLower.end());
+ llvm::erase_if(ArgLower, clang::isWhitespace);
Direction = getParamPassDirection(ArgLower);
SourceRange ArgRange(ArgLocBegin, ArgLocEnd);
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 016d288..945c935 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -2156,12 +2156,9 @@ CXXMethodDecl::getCorrespondingMethodInClass(const CXXRecordDecl *RD,
}
// Other candidate final overriders might be overridden by this function.
- FinalOverriders.erase(
- std::remove_if(FinalOverriders.begin(), FinalOverriders.end(),
- [&](CXXMethodDecl *OtherD) {
- return recursivelyOverrides(D, OtherD);
- }),
- FinalOverriders.end());
+ llvm::erase_if(FinalOverriders, [&](CXXMethodDecl *OtherD) {
+ return recursivelyOverrides(D, OtherD);
+ });
FinalOverriders.push_back(D);
};
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index d8b96ce..59943d1 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -1084,14 +1084,10 @@ namespace {
void performLifetimeExtension() {
// Disable the cleanups for lifetime-extended temporaries.
- CleanupStack.erase(std::remove_if(CleanupStack.begin(),
- CleanupStack.end(),
- [](Cleanup &C) {
- return !C.isDestroyedAtEndOf(
- ScopeKind::FullExpression);
- }),
- CleanupStack.end());
- }
+ llvm::erase_if(CleanupStack, [](Cleanup &C) {
+ return !C.isDestroyedAtEndOf(ScopeKind::FullExpression);
+ });
+ }
/// Throw away any remaining cleanups at the end of evaluation. If any
/// cleanups would have had a side-effect, note that as an unmodeled
diff --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index c7789b7..a2ef270 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -425,16 +425,14 @@ void ExternalASTMerger::RemoveSources(llvm::ArrayRef<ImporterSource> Sources) {
logs() << "(ExternalASTMerger*)" << (void *)this
<< " removing source (ASTContext*)" << (void *)&S.getASTContext()
<< "\n";
- Importers.erase(
- std::remove_if(Importers.begin(), Importers.end(),
- [&Sources](std::unique_ptr<ASTImporter> &Importer) -> bool {
- for (const ImporterSource &S : Sources) {
- if (&Importer->getFromContext() == &S.getASTContext())
- return true;
- }
- return false;
- }),
- Importers.end());
+ llvm::erase_if(Importers,
+ [&Sources](std::unique_ptr<ASTImporter> &Importer) -> bool {
+ for (const ImporterSource &S : Sources) {
+ if (&Importer->getFromContext() == &S.getASTContext())
+ return true;
+ }
+ return false;
+ });
for (OriginMap::iterator OI = Origins.begin(), OE = Origins.end(); OI != OE; ) {
std::pair<const DeclContext *, DCOrigin> Origin = *OI;
bool Erase = false;
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 9fa5e9c..57454a5 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3417,10 +3417,9 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDecl GD) {
Target.getCPUSpecificCPUDispatchFeatures(II->getName(), Features);
llvm::transform(Features, Features.begin(),
[](StringRef Str) { return Str.substr(1); });
- Features.erase(std::remove_if(
- Features.begin(), Features.end(), [&Target](StringRef Feat) {
- return !Target.validateCpuSupports(Feat);
- }), Features.end());
+ llvm::erase_if(Features, [&Target](StringRef Feat) {
+ return !Target.validateCpuSupports(Feat);
+ });
Options.emplace_back(cast<llvm::Function>(Func), StringRef{}, Features);
++Index;
}
diff --git a/clang/lib/Driver/Multilib.cpp b/clang/lib/Driver/Multilib.cpp
index 5dd5555..ab44ba5 100644
--- a/clang/lib/Driver/Multilib.cpp
+++ b/clang/lib/Driver/Multilib.cpp
@@ -299,7 +299,7 @@ MultilibSet::multilib_list MultilibSet::filterCopy(FilterCallback F,
}
void MultilibSet::filterInPlace(FilterCallback F, multilib_list &Ms) {
- Ms.erase(std::remove_if(Ms.begin(), Ms.end(), F), Ms.end());
+ llvm::erase_if(Ms, F);
}
raw_ostream &clang::driver::operator<<(raw_ostream &OS, const MultilibSet &MS) {
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 50b965d..5258967 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1069,9 +1069,7 @@ static void
checkAndRemoveNonDriverDiags(SmallVectorImpl<StoredDiagnostic> &StoredDiags) {
// Get rid of stored diagnostics except the ones from the driver which do not
// have a source location.
- StoredDiags.erase(
- std::remove_if(StoredDiags.begin(), StoredDiags.end(), isNonDriverDiag),
- StoredDiags.end());
+ llvm::erase_if(StoredDiags, isNonDriverDiag);
}
static void checkAndSanitizeDiags(SmallVectorImpl<StoredDiagnostic> &
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 0e43fa4..20de917 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1151,14 +1151,12 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
// Remove any macro definitions that are explicitly ignored by the module.
// They aren't supposed to affect how the module is built anyway.
HeaderSearchOptions &HSOpts = Invocation->getHeaderSearchOpts();
- PPOpts.Macros.erase(
- std::remove_if(PPOpts.Macros.begin(), PPOpts.Macros.end(),
- [&HSOpts](const std::pair<std::string, bool> &def) {
+ llvm::erase_if(
+ PPOpts.Macros, [&HSOpts](const std::pair<std::string, bool> &def) {
StringRef MacroDef = def.first;
return HSOpts.ModulesIgnoreMacros.count(
llvm::CachedHashString(MacroDef.split('=').first)) > 0;
- }),
- PPOpts.Macros.end());
+ });
// If the original compiler invocation had -fmodule-name, pass it through.
Invocation->getLangOpts()->ModuleName =
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 5a0fa51..cfee7a3c 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -155,11 +155,8 @@ ModuleMacro *Preprocessor::addModuleMacro(Module *Mod, IdentifierInfo *II,
// If we were the first overrider for any macro, it's no longer a leaf.
auto &LeafMacros = LeafModuleMacros[II];
if (HidAny) {
- LeafMacros.erase(std::remove_if(LeafMacros.begin(), LeafMacros.end(),
- [](ModuleMacro *MM) {
- return MM->NumOverriddenBy != 0;
- }),
- LeafMacros.end());
+ llvm::erase_if(LeafMacros,
+ [](ModuleMacro *MM) { return MM->NumOverriddenBy != 0; });
}
// The new macro is always a leaf macro.
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp
index 40ffa6c..2fe88cc 100644
--- a/clang/lib/Serialization/ModuleManager.cpp
+++ b/clang/lib/Serialization/ModuleManager.cpp
@@ -270,8 +270,7 @@ void ModuleManager::removeModules(ModuleIterator First, ModuleMap *modMap) {
I->Imports.remove_if(IsVictim);
I->ImportedBy.remove_if(IsVictim);
}
- Roots.erase(std::remove_if(Roots.begin(), Roots.end(), IsVictim),
- Roots.end());
+ llvm::erase_if(Roots, IsVictim);
// Remove the modules from the PCH chain.
for (auto I = First; I != Last; ++I) {
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
index 7f1d0ac..4888efe 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
@@ -153,8 +153,7 @@ private:
return getDecl(CheckDR) == getDecl(DR) && Pred(Check);
return false;
};
- toScanFor.erase(std::remove_if(toScanFor.begin(), toScanFor.end(), P),
- toScanFor.end());
+ llvm::erase_if(toScanFor, P);
}
void CheckExpr(const Expr *E_p) {