[clang-tools-extra] 4cf3f03 - [clang-tidy] use llvm::any_of refactor getAnalyzerCheckersAndPackages [NFC] (#91713)
via cfe-commits
cfe-commits at lists.llvm.org
Fri May 10 06:51:11 PDT 2024
Author: Congcong Cai
Date: 2024-05-10T21:51:07+08:00
New Revision: 4cf3f032283d8426c9b7829c7ccf0ab01939c7db
URL: https://github.com/llvm/llvm-project/commit/4cf3f032283d8426c9b7829c7ccf0ab01939c7db
DIFF: https://github.com/llvm/llvm-project/commit/4cf3f032283d8426c9b7829c7ccf0ab01939c7db.diff
LOG: [clang-tidy] use llvm::any_of refactor getAnalyzerCheckersAndPackages [NFC] (#91713)
Added:
Modified:
clang-tools-extra/clang-tidy/ClangTidy.cpp
Removed:
################################################################################
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