From: Nathan James Date: Thu, 12 Jan 2023 19:20:53 +0000 (+0000) Subject: [clang-tidy][NFC] Make CheckFactories::CreateChecks* const X-Git-Tag: upstream/17.0.6~21158 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b616811dde41d851dddf7a5e1b9848e53d2aa10e;p=platform%2Fupstream%2Fllvm.git [clang-tidy][NFC] Make CheckFactories::CreateChecks* const There's no reason for these methods to be non-const. Reviewed By: gribozavr2 Differential Revision: https://reviews.llvm.org/D138566 --- diff --git a/clang-tools-extra/clang-tidy/ClangTidyModule.cpp b/clang-tools-extra/clang-tidy/ClangTidyModule.cpp index e312526..6736643 100644 --- a/clang-tools-extra/clang-tidy/ClangTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidyModule.cpp @@ -22,7 +22,7 @@ void ClangTidyCheckFactories::registerCheckFactory(StringRef Name, } std::vector> -ClangTidyCheckFactories::createChecks(ClangTidyContext *Context) { +ClangTidyCheckFactories::createChecks(ClangTidyContext *Context) const { std::vector> Checks; for (const auto &Factory : Factories) { if (Context->isCheckEnabled(Factory.getKey())) @@ -32,7 +32,8 @@ ClangTidyCheckFactories::createChecks(ClangTidyContext *Context) { } std::vector> -ClangTidyCheckFactories::createChecksForLanguage(ClangTidyContext *Context) { +ClangTidyCheckFactories::createChecksForLanguage( + ClangTidyContext *Context) const { std::vector> Checks; const LangOptions &LO = Context->getLangOpts(); for (const auto &Factory : Factories) { diff --git a/clang-tools-extra/clang-tidy/ClangTidyModule.h b/clang-tools-extra/clang-tidy/ClangTidyModule.h index f44457d..9a7c144 100644 --- a/clang-tools-extra/clang-tidy/ClangTidyModule.h +++ b/clang-tools-extra/clang-tidy/ClangTidyModule.h @@ -65,11 +65,11 @@ public: /// Create instances of checks that are enabled. std::vector> - createChecks(ClangTidyContext *Context); + createChecks(ClangTidyContext *Context) const; /// Create instances of checks that are enabled for the current Language. std::vector> - createChecksForLanguage(ClangTidyContext *Context); + createChecksForLanguage(ClangTidyContext *Context) const; typedef llvm::StringMap FactoryMap; FactoryMap::const_iterator begin() const { return Factories.begin(); }