[clang-tools-extra] [clang-tidy] use llvm::any_of refactor getAnalyzerCheckersAndPackages [NFC] (PR #91713)
via cfe-commits
cfe-commits at lists.llvm.org
Fri May 10 01:29:03 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tidy
@llvm/pr-subscribers-clang-tools-extra
Author: Congcong Cai (HerrCai0907)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/91713.diff
1 Files Affected:
- (modified) clang-tools-extra/clang-tidy/ClangTidy.cpp (+5-5)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/91713
More information about the cfe-commits
mailing list