https://github.com/localspook created https://github.com/llvm/llvm-project/pull/172432
None >From e69c7b7d3f2df293691150a777984477839a6b9b Mon Sep 17 00:00:00 2001 From: Victor Chernyakin <[email protected]> Date: Mon, 15 Dec 2025 23:51:03 -0800 Subject: [PATCH] [clang-tidy][NFC] Use structured binding in `ClangTidyModule.cpp` --- clang-tools-extra/clang-tidy/ClangTidyModule.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/clang-tools-extra/clang-tidy/ClangTidyModule.cpp b/clang-tools-extra/clang-tidy/ClangTidyModule.cpp index 4fb4144f835a3..1691b6251614d 100644 --- a/clang-tools-extra/clang-tidy/ClangTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidyModule.cpp @@ -23,9 +23,9 @@ void ClangTidyCheckFactories::registerCheckFactory(StringRef Name, std::vector<std::unique_ptr<ClangTidyCheck>> ClangTidyCheckFactories::createChecks(ClangTidyContext *Context) const { std::vector<std::unique_ptr<ClangTidyCheck>> Checks; - for (const auto &Factory : Factories) { - if (Context->isCheckEnabled(Factory.getKey())) - Checks.emplace_back(Factory.getValue()(Factory.getKey(), Context)); + for (const auto &[CheckName, Factory] : Factories) { + if (Context->isCheckEnabled(CheckName)) + Checks.emplace_back(Factory(CheckName, Context)); } return Checks; } @@ -35,11 +35,10 @@ ClangTidyCheckFactories::createChecksForLanguage( ClangTidyContext *Context) const { std::vector<std::unique_ptr<ClangTidyCheck>> Checks; const LangOptions &LO = Context->getLangOpts(); - for (const auto &Factory : Factories) { - if (!Context->isCheckEnabled(Factory.getKey())) + for (const auto &[CheckName, Factory] : Factories) { + if (!Context->isCheckEnabled(CheckName)) continue; - std::unique_ptr<ClangTidyCheck> Check = - Factory.getValue()(Factory.getKey(), Context); + std::unique_ptr<ClangTidyCheck> Check = Factory(CheckName, Context); if (Check->isLanguageVersionSupported(LO)) Checks.push_back(std::move(Check)); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
