[Mlir-commits] [mlir] 70257fa - Use any_of (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Fri Jul 22 01:05:28 PDT 2022
Author: Kazu Hirata
Date: 2022-07-22T01:05:17-07:00
New Revision: 70257fab68e8081f5a4f182ea580f284b593aa6f
URL: https://github.com/llvm/llvm-project/commit/70257fab68e8081f5a4f182ea580f284b593aa6f
DIFF: https://github.com/llvm/llvm-project/commit/70257fab68e8081f5a4f182ea580f284b593aa6f.diff
LOG: Use any_of (NFC)
Added:
Modified:
clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
clang-tools-extra/clangd/index/Merge.cpp
clang/lib/Lex/ModuleMap.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaTemplate.cpp
lld/wasm/SyntheticSections.h
llvm/include/llvm/Passes/StandardInstrumentations.h
mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
polly/lib/Analysis/ScopBuilder.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
index 245c03fe8e9c3..dbda14c97e5fc 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
@@ -49,13 +49,11 @@ void MacroRepeatedPPCallbacks::MacroExpands(const Token &MacroNameTok,
// Bail out if the contents of the macro are containing keywords that are
// making the macro too complex.
- if (std::find_if(
- MI->tokens().begin(), MI->tokens().end(), [](const Token &T) {
- return T.isOneOf(tok::kw_if, tok::kw_else, tok::kw_switch,
- tok::kw_case, tok::kw_break, tok::kw_while,
- tok::kw_do, tok::kw_for, tok::kw_continue,
- tok::kw_goto, tok::kw_return);
- }) != MI->tokens().end())
+ if (llvm::any_of(MI->tokens(), [](const Token &T) {
+ return T.isOneOf(tok::kw_if, tok::kw_else, tok::kw_switch, tok::kw_case,
+ tok::kw_break, tok::kw_while, tok::kw_do, tok::kw_for,
+ tok::kw_continue, tok::kw_goto, tok::kw_return);
+ }))
return;
for (unsigned ArgNo = 0U; ArgNo < MI->getNumParams(); ++ArgNo) {
diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
index b5e5191876cad..67d8ccbd6cad4 100644
--- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -604,9 +604,9 @@ int clangTidyMain(int argc, const char **argv) {
std::vector<ClangTidyError> Errors =
runClangTidy(Context, OptionsParser->getCompilations(), PathList, BaseFS,
FixNotes, EnableCheckProfile, ProfilePrefix);
- bool FoundErrors = llvm::find_if(Errors, [](const ClangTidyError &E) {
- return E.DiagLevel == ClangTidyError::Error;
- }) != Errors.end();
+ bool FoundErrors = llvm::any_of(Errors, [](const ClangTidyError &E) {
+ return E.DiagLevel == ClangTidyError::Error;
+ });
// --fix-errors and --fix-notes imply --fix.
FixBehaviour Behaviour = FixNotes ? FB_FixNotes
diff --git a/clang-tools-extra/clangd/index/Merge.cpp b/clang-tools-extra/clangd/index/Merge.cpp
index 997bbfb6672a1..0d15dfcb1f252 100644
--- a/clang-tools-extra/clangd/index/Merge.cpp
+++ b/clang-tools-extra/clangd/index/Merge.cpp
@@ -196,10 +196,9 @@ static bool prefer(const SymbolLocation &L, const SymbolLocation &R) {
return true;
auto HasCodeGenSuffix = [](const SymbolLocation &Loc) {
constexpr static const char *CodegenSuffixes[] = {".proto"};
- return std::any_of(std::begin(CodegenSuffixes), std::end(CodegenSuffixes),
- [&](llvm::StringRef Suffix) {
- return llvm::StringRef(Loc.FileURI).endswith(Suffix);
- });
+ return llvm::any_of(CodegenSuffixes, [&](llvm::StringRef Suffix) {
+ return llvm::StringRef(Loc.FileURI).endswith(Suffix);
+ });
};
return HasCodeGenSuffix(L) && !HasCodeGenSuffix(R);
}
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 57e344622f25a..47d6f5893e974 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -456,10 +456,8 @@ static bool violatesPrivateInclude(Module *RequestingModule,
&Header.getModule()->Headers[Module::HK_Private],
&Header.getModule()->Headers[Module::HK_PrivateTextual]};
for (auto *Hs : HeaderList)
- IsPrivate |=
- std::find_if(Hs->begin(), Hs->end(), [&](const Module::Header &H) {
- return H.Entry == IncFileEnt;
- }) != Hs->end();
+ IsPrivate |= llvm::any_of(
+ *Hs, [&](const Module::Header &H) { return H.Entry == IncFileEnt; });
assert(IsPrivate && "inconsistent headers and roles");
}
#endif
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 0b4c450f76e0d..cd5cdbde7f3f0 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -15400,7 +15400,7 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
pty->getKind() == BuiltinType::Overload)) {
auto *OE = dyn_cast<OverloadExpr>(LHSExpr);
if (OE && !OE->hasTemplateKeyword() && !OE->hasExplicitTemplateArgs() &&
- std::any_of(OE->decls_begin(), OE->decls_end(), [](NamedDecl *ND) {
+ llvm::any_of(OE->decls(), [](NamedDecl *ND) {
return isa<FunctionTemplateDecl>(ND);
})) {
Diag(OE->getQualifier() ? OE->getQualifierLoc().getBeginLoc()
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 67cf8f0371c5c..171f005816b5c 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -2520,7 +2520,7 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template,
continue;
// Cannot make a deduction guide when unparsed arguments are present.
- if (std::any_of(CD->param_begin(), CD->param_end(), [](ParmVarDecl *P) {
+ if (llvm::any_of(CD->parameters(), [](ParmVarDecl *P) {
return !P || P->hasUnparsedDefaultArg();
}))
continue;
diff --git a/lld/wasm/SyntheticSections.h b/lld/wasm/SyntheticSections.h
index eac017883ef50..06579054b6300 100644
--- a/lld/wasm/SyntheticSections.h
+++ b/lld/wasm/SyntheticSections.h
@@ -290,14 +290,12 @@ class GlobalSection : public SyntheticSection {
bool needsRelocations() {
if (config->extendedConst)
return false;
- return llvm::find_if(internalGotSymbols, [=](Symbol *sym) {
- return !sym->isTLS();
- }) != internalGotSymbols.end();
+ return llvm::any_of(internalGotSymbols,
+ [=](Symbol *sym) { return !sym->isTLS(); });
}
bool needsTLSRelocations() {
- return llvm::find_if(internalGotSymbols, [=](Symbol *sym) {
- return sym->isTLS();
- }) != internalGotSymbols.end();
+ return llvm::any_of(internalGotSymbols,
+ [=](Symbol *sym) { return sym->isTLS(); });
}
void generateRelocationCode(raw_ostream &os, bool TLS) const;
diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h
index 32ecc9ec5fb00..30287cde5de70 100644
--- a/llvm/include/llvm/Passes/StandardInstrumentations.h
+++ b/llvm/include/llvm/Passes/StandardInstrumentations.h
@@ -133,9 +133,9 @@ class PreservedCFGCheckerInstrumentation {
}
bool isPoisoned() const {
- return BBGuards &&
- std::any_of(BBGuards->begin(), BBGuards->end(),
- [](const auto &BB) { return BB.second.isPoisoned(); });
+ return BBGuards && llvm::any_of(*BBGuards, [](const auto &BB) {
+ return BB.second.isPoisoned();
+ });
}
static void printDiff(raw_ostream &out, const CFG &Before,
diff --git a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
index 068bc1062df23..31d11c84c8772 100644
--- a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
@@ -321,9 +321,8 @@ unsigned FlatAffineValueConstraints::insertVar(VarKind kind, unsigned pos,
}
bool FlatAffineValueConstraints::hasValues() const {
- return llvm::find_if(values, [](Optional<Value> var) {
- return var.has_value();
- }) != values.end();
+ return llvm::any_of(
+ values, [](const Optional<Value> &var) { return var.has_value(); });
}
/// Checks if two constraint systems are in the same space, i.e., if they are
diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp
index 9bfd8717449b8..ab8e5adc23971 100644
--- a/polly/lib/Analysis/ScopBuilder.cpp
+++ b/polly/lib/Analysis/ScopBuilder.cpp
@@ -697,8 +697,7 @@ isl::set ScopBuilder::getPredecessorDomainConstraints(BasicBlock *BB,
// If the predecessor is in a region we used for propagation we can skip it.
auto PredBBInRegion = [PredBB](Region *PR) { return PR->contains(PredBB); };
- if (std::any_of(PropagatedRegions.begin(), PropagatedRegions.end(),
- PredBBInRegion)) {
+ if (llvm::any_of(PropagatedRegions, PredBBInRegion)) {
continue;
}
More information about the Mlir-commits
mailing list