[PATCH] D138566: [clang-tidy][NFC] Make CheckFactories::CreateChecks* const
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 23 04:40:11 PST 2022
njames93 created this revision.
njames93 added reviewers: aaron.ballman, gribozavr2, JonasToth.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a project: All.
njames93 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
There's no reason for these methods to be non-const.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D138566
Files:
clang-tools-extra/clang-tidy/ClangTidyModule.cpp
clang-tools-extra/clang-tidy/ClangTidyModule.h
Index: clang-tools-extra/clang-tidy/ClangTidyModule.h
===================================================================
--- clang-tools-extra/clang-tidy/ClangTidyModule.h
+++ clang-tools-extra/clang-tidy/ClangTidyModule.h
@@ -65,11 +65,11 @@
/// Create instances of checks that are enabled.
std::vector<std::unique_ptr<ClangTidyCheck>>
- createChecks(ClangTidyContext *Context);
+ createChecks(ClangTidyContext *Context) const;
/// Create instances of checks that are enabled for the current Language.
std::vector<std::unique_ptr<ClangTidyCheck>>
- createChecksForLanguage(ClangTidyContext *Context);
+ createChecksForLanguage(ClangTidyContext *Context) const;
typedef llvm::StringMap<CheckFactory> FactoryMap;
FactoryMap::const_iterator begin() const { return Factories.begin(); }
Index: clang-tools-extra/clang-tidy/ClangTidyModule.cpp
===================================================================
--- clang-tools-extra/clang-tidy/ClangTidyModule.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyModule.cpp
@@ -22,7 +22,7 @@
}
std::vector<std::unique_ptr<ClangTidyCheck>>
-ClangTidyCheckFactories::createChecks(ClangTidyContext *Context) {
+ClangTidyCheckFactories::createChecks(ClangTidyContext *Context) const {
std::vector<std::unique_ptr<ClangTidyCheck>> Checks;
for (const auto &Factory : Factories) {
if (Context->isCheckEnabled(Factory.getKey()))
@@ -32,7 +32,8 @@
}
std::vector<std::unique_ptr<ClangTidyCheck>>
-ClangTidyCheckFactories::createChecksForLanguage(ClangTidyContext *Context) {
+ClangTidyCheckFactories::createChecksForLanguage(
+ ClangTidyContext *Context) const {
std::vector<std::unique_ptr<ClangTidyCheck>> Checks;
const LangOptions &LO = Context->getLangOpts();
for (const auto &Factory : Factories) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138566.477457.patch
Type: text/x-patch
Size: 1793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221123/4f46a213/attachment.bin>
More information about the cfe-commits
mailing list