[clang-tools-extra] 33b9304 - Use llvm::is_contained (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 27 21:21:29 PDT 2022
Author: Kazu Hirata
Date: 2022-08-27T21:21:00-07:00
New Revision: 33b93044352fae09376b7d71ce6f2441a34f343d
URL: https://github.com/llvm/llvm-project/commit/33b93044352fae09376b7d71ce6f2441a34f343d
DIFF: https://github.com/llvm/llvm-project/commit/33b93044352fae09376b7d71ce6f2441a34f343d.diff
LOG: Use llvm::is_contained (NFC)
Added:
Modified:
clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
clang-tools-extra/clangd/QueryDriverDatabase.cpp
clang/lib/Frontend/FrontendAction.cpp
flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp b/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
index 88fd926158093..b75ab9dbb2fe3 100644
--- a/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
@@ -22,8 +22,7 @@ namespace zircon {
AST_MATCHER_P(CXXRecordDecl, matchesAnyName, ArrayRef<StringRef>, Names) {
std::string QualifiedName = Node.getQualifiedNameAsString();
- return llvm::any_of(Names,
- [&](StringRef Name) { return QualifiedName == Name; });
+ return llvm::is_contained(Names, QualifiedName);
}
void TemporaryObjectsCheck::registerMatchers(MatchFinder *Finder) {
diff --git a/clang-tools-extra/clangd/QueryDriverDatabase.cpp b/clang-tools-extra/clangd/QueryDriverDatabase.cpp
index e96912c6290c7..3fdacf397028e 100644
--- a/clang-tools-extra/clangd/QueryDriverDatabase.cpp
+++ b/clang-tools-extra/clangd/QueryDriverDatabase.cpp
@@ -189,8 +189,7 @@ extractSystemIncludesAndTarget(llvm::SmallString<128> Driver,
for (size_t I = 0, E = CommandLine.size(); I < E; ++I) {
llvm::StringRef Arg = CommandLine[I];
- if (llvm::any_of(FlagsToPreserve,
- [&Arg](llvm::StringRef S) { return S == Arg; })) {
+ if (llvm::is_contained(FlagsToPreserve, Arg)) {
Args.push_back(Arg);
} else {
const auto *Found =
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 4b639a7764954..78c8de78d7ab0 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -196,10 +196,8 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
ActionType == PluginASTAction::CmdlineBeforeMainAction) {
// This is O(|plugins| * |add_plugins|), but since both numbers are
// way below 50 in practice, that's ok.
- if (llvm::any_of(CI.getFrontendOpts().AddPluginActions,
- [&](const std::string &PluginAction) {
- return PluginAction == Plugin.getName();
- })) {
+ if (llvm::is_contained(CI.getFrontendOpts().AddPluginActions,
+ Plugin.getName())) {
if (ActionType == PluginASTAction::CmdlineBeforeMainAction)
ActionType = PluginASTAction::AddBeforeMainAction;
else
diff --git a/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp b/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
index 188a9d251cdfd..61f19013787e1 100644
--- a/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
+++ b/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
@@ -62,8 +62,7 @@ class BoxprocTypeRewriter : public mlir::TypeConverter {
return false;
}
if (auto recTy = ty.dyn_cast<RecordType>()) {
- if (llvm::any_of(visitedTypes,
- [&](mlir::Type rt) { return rt == recTy; }))
+ if (llvm::is_contained(visitedTypes, recTy))
return false;
bool result = false;
visitedTypes.push_back(recTy);
diff --git a/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp b/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
index 007ec5b70899f..a761a1a37ee7f 100644
--- a/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
@@ -424,8 +424,7 @@ bool AArch64RegisterInfo::isArgumentRegister(const MachineFunction &MF,
bool IsVarArg = STI.isCallingConvWin64(MF.getFunction().getCallingConv());
auto HasReg = [](ArrayRef<MCRegister> RegList, MCRegister Reg) {
- return llvm::any_of(RegList,
- [Reg](const MCRegister R) { return R == Reg; });
+ return llvm::is_contained(RegList, Reg);
};
switch (CC) {
diff --git a/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
index 1b1e0e74e24b6..ae9e95da4cd8d 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
@@ -459,8 +459,7 @@ LogicalResult MmaOp::verify() {
// Check that we matched an existing shape/dtype combination.
if (expectedA.empty() || expectedB.empty() || expectedC.empty() ||
- !llvm::any_of(allowedShapes,
- [&](const auto &allowed) { return allowed == mmaShape; })) {
+ !llvm::is_contained(allowedShapes, mmaShape)) {
errorStream << "unimplemented variant for MMA shape <";
llvm::interleaveComma(mmaShape, errorStream);
errorStream << ">";
@@ -475,10 +474,7 @@ LogicalResult MmaOp::verify() {
SmallVector<Type, 4> operandTySeg(operand_type_begin() + spec.first,
operand_type_begin() + spec.first +
spec.second);
- bool match =
- llvm::any_of(iter.value(), [&](const SmallVector<Type, 4> &typeSet) {
- return typeSet == operandTySeg;
- });
+ bool match = llvm::is_contained(iter.value(), operandTySeg);
if (!match) {
errorStream << "Could not match types for the "
More information about the cfe-commits
mailing list