[clang-tools-extra] [clang-tidy] use llvm::any_of refactor getAnalyzerCheckersAndPackages [NFC] (PR #91713)
Congcong Cai via cfe-commits
cfe-commits at lists.llvm.org
Fri May 10 01:28:32 PDT 2024
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/91713
None
>From 035363d336a9b115d5584efe01733cb1b76792c4 Mon Sep 17 00:00:00 2001
From: Congcong Cai <congcongcai0907 at 163.com>
Date: Fri, 10 May 2024 16:28:06 +0800
Subject: [PATCH] [clang-tidy] use llvm::any_of refactor
getAnalyzerCheckersAndPackages [NFC]
---
clang-tools-extra/clang-tidy/ClangTidy.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index b877ea06dc05c..1cd7cdd10bc25 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -373,11 +373,11 @@ static CheckersList getAnalyzerCheckersAndPackages(ClangTidyContext &Context,
const auto &RegisteredCheckers =
AnalyzerOptions::getRegisteredCheckers(IncludeExperimental);
- bool AnalyzerChecksEnabled = false;
- for (StringRef CheckName : RegisteredCheckers) {
- std::string ClangTidyCheckName((AnalyzerCheckNamePrefix + CheckName).str());
- AnalyzerChecksEnabled |= Context.isCheckEnabled(ClangTidyCheckName);
- }
+ const bool AnalyzerChecksEnabled =
+ llvm::any_of(RegisteredCheckers, [&](StringRef CheckName) -> bool {
+ return Context.isCheckEnabled(
+ (AnalyzerCheckNamePrefix + CheckName).str());
+ });
if (!AnalyzerChecksEnabled)
return List;
More information about the cfe-commits
mailing list