[clang-tools-extra] b616811 - [clang-tidy][NFC] Make CheckFactories::CreateChecks* const
Nathan James via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 12 11:21:03 PST 2023
Author: Nathan James
Date: 2023-01-12T19:20:54Z
New Revision: b616811dde41d851dddf7a5e1b9848e53d2aa10e
URL: https://github.com/llvm/llvm-project/commit/b616811dde41d851dddf7a5e1b9848e53d2aa10e
DIFF: https://github.com/llvm/llvm-project/commit/b616811dde41d851dddf7a5e1b9848e53d2aa10e.diff
LOG: [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
Added:
Modified:
clang-tools-extra/clang-tidy/ClangTidyModule.cpp
clang-tools-extra/clang-tidy/ClangTidyModule.h
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/ClangTidyModule.cpp b/clang-tools-extra/clang-tidy/ClangTidyModule.cpp
index e31252687adb3..67366433f79a7 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<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 @@ ClangTidyCheckFactories::createChecks(ClangTidyContext *Context) {
}
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) {
diff --git a/clang-tools-extra/clang-tidy/ClangTidyModule.h b/clang-tools-extra/clang-tidy/ClangTidyModule.h
index f44457d3ae8f8..9a7c1448b8126 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyModule.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyModule.h
@@ -65,11 +65,11 @@ class ClangTidyCheckFactories {
/// 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(); }
More information about the cfe-commits
mailing list