[clang-tidy][NFC] Make CheckFactories::CreateChecks* const
authorNathan James <n.james93@hotmail.co.uk>
Thu, 12 Jan 2023 19:20:53 +0000 (19:20 +0000)
committerNathan James <n.james93@hotmail.co.uk>
Thu, 12 Jan 2023 19:20:54 +0000 (19:20 +0000)
There's no reason for these methods to be non-const.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D138566

clang-tools-extra/clang-tidy/ClangTidyModule.cpp
clang-tools-extra/clang-tidy/ClangTidyModule.h

index e312526..6736643 100644 (file)
@@ -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) {
index f44457d..9a7c144 100644 (file)
@@ -65,11 +65,11 @@ public:
 
   /// 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(); }