[clang-tools-extra] 3bca861 - [clang-tidy][NFC] Remove unsupported language version checks from vector

Nathan James via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 5 07:35:40 PST 2021


Author: Nathan James
Date: 2021-03-05T15:35:34Z
New Revision: 3bca86170da0a7cadb4cc13b178ff1edf162ea8e

URL: https://github.com/llvm/llvm-project/commit/3bca86170da0a7cadb4cc13b178ff1edf162ea8e
DIFF: https://github.com/llvm/llvm-project/commit/3bca86170da0a7cadb4cc13b178ff1edf162ea8e.diff

LOG: [clang-tidy][NFC] Remove unsupported language version checks from vector

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/ClangTidy.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index f65e8ed216f2..88ba4bf63e09 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -393,6 +393,10 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
   std::vector<std::unique_ptr<ClangTidyCheck>> Checks =
       CheckFactories->createChecks(&Context);
 
+  llvm::erase_if(Checks, [&](std::unique_ptr<ClangTidyCheck> &Check) {
+    return !Check->isLanguageVersionSupported(Context.getLangOpts());
+  });
+
   ast_matchers::MatchFinder::MatchFinderOptions FinderOptions;
 
   std::unique_ptr<ClangTidyProfiling> Profiling;
@@ -416,8 +420,6 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
   }
 
   for (auto &Check : Checks) {
-    if (!Check->isLanguageVersionSupported(Context.getLangOpts()))
-      continue;
     Check->registerMatchers(&*Finder);
     Check->registerPPCallbacks(*SM, PP, ModuleExpanderPP);
   }


        


More information about the cfe-commits mailing list