[clang] 9e88cbc - Use any_of (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 24 14:48:27 PDT 2022
Author: Kazu Hirata
Date: 2022-07-24T14:48:11-07:00
New Revision: 9e88cbcc403bdf82f29259ad60ff60a8fc4434a1
URL: https://github.com/llvm/llvm-project/commit/9e88cbcc403bdf82f29259ad60ff60a8fc4434a1
DIFF: https://github.com/llvm/llvm-project/commit/9e88cbcc403bdf82f29259ad60ff60a8fc4434a1.diff
LOG: Use any_of (NFC)
Added:
Modified:
clang/lib/Edit/EditedSource.cpp
clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
llvm/tools/llvm-profdata/llvm-profdata.cpp
llvm/tools/llvm-xray/xray-graph.cpp
mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
Removed:
################################################################################
diff --git a/clang/lib/Edit/EditedSource.cpp b/clang/lib/Edit/EditedSource.cpp
index ee57660b8c72c..a3386b2489b07 100644
--- a/clang/lib/Edit/EditedSource.cpp
+++ b/clang/lib/Edit/EditedSource.cpp
@@ -84,11 +84,11 @@ bool EditedSource::canInsertInOffset(SourceLocation OrigLoc, FileOffset Offs) {
deconstructMacroArgLoc(OrigLoc, ExpLoc, ArgUse);
auto I = ExpansionToArgMap.find(ExpLoc);
if (I != ExpansionToArgMap.end() &&
- find_if(I->second, [&](const MacroArgUse &U) {
+ llvm::any_of(I->second, [&](const MacroArgUse &U) {
return ArgUse.Identifier == U.Identifier &&
std::tie(ArgUse.ImmediateExpansionLoc, ArgUse.UseLoc) !=
std::tie(U.ImmediateExpansionLoc, U.UseLoc);
- }) != I->second.end()) {
+ })) {
// Trying to write in a macro argument input that has already been
// written by a previous commit for another expansion of the same macro
// argument name. For example:
diff --git a/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
index cddf206728b1a..27fd40a441fad 100644
--- a/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
@@ -182,7 +182,7 @@ class PaddingChecker : public Checker<check::ASTDecl<TranslationUnitDecl>> {
return false;
};
- if (std::any_of(RD->field_begin(), RD->field_end(), IsTrickyField))
+ if (llvm::any_of(RD->fields(), IsTrickyField))
return true;
return false;
}
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 0c23d7c1435f3..3af8f800adcb8 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -2200,8 +2200,7 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts,
Builder.addRecord(Func);
if (ShowCovered) {
- if (std::any_of(Func.Counts.begin(), Func.Counts.end(),
- [](uint64_t C) { return C; }))
+ if (llvm::any_of(Func.Counts, [](uint64_t C) { return C; }))
OS << Func.Name << "\n";
continue;
}
diff --git a/llvm/tools/llvm-xray/xray-graph.cpp b/llvm/tools/llvm-xray/xray-graph.cpp
index 39d2c5c153ef1..ff47eb64e9473 100644
--- a/llvm/tools/llvm-xray/xray-graph.cpp
+++ b/llvm/tools/llvm-xray/xray-graph.cpp
@@ -232,10 +232,11 @@ Error GraphRenderer::accountRecord(const XRayRecord &Record) {
if (!DeduceSiblingCalls)
return make_error<StringError>("No matching ENTRY record",
make_error_code(errc::invalid_argument));
- auto Parent = std::find_if(
- ThreadStack.rbegin(), ThreadStack.rend(),
- [&](const FunctionAttr &A) { return A.FuncId == Record.FuncId; });
- if (Parent == ThreadStack.rend())
+ bool FoundParent =
+ llvm::any_of(llvm::reverse(ThreadStack), [&](const FunctionAttr &A) {
+ return A.FuncId == Record.FuncId;
+ });
+ if (!FoundParent)
return make_error<StringError>(
"No matching Entry record in stack",
make_error_code(errc::invalid_argument)); // There is no matching
diff --git a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
index 8c3dc07cd97ed..265797bc61bf2 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
@@ -182,7 +182,7 @@ LogicalResult transform::TransformState::checkAndRecordHandleInvalidation(
return isa<MemoryEffects::Free>(effect.getEffect()) &&
effect.getValue() == target.get();
};
- if (llvm::find_if(effects, consumesTarget) != effects.end())
+ if (llvm::any_of(effects, consumesTarget))
recordHandleInvalidation(target);
}
return success();
More information about the cfe-commits
mailing list