[clang-tidy] Added virtual isLanguageVersionSupported to ClangTidyCheck
authorNathan James <n.james93@hotmail.co.uk>
Fri, 28 Feb 2020 13:03:30 +0000 (13:03 +0000)
committerNathan James <n.james93@hotmail.co.uk>
Fri, 28 Feb 2020 13:05:05 +0000 (13:05 +0000)
commit39c4246e1e5bb76b1bca2e4b0d0ebc4005d75c32
tree9e08f3a6c402a22eaccebb4db045b0b4756cd994
parentf829615205f0f671c9b6e1e89d9af78f0d40fe9d
[clang-tidy] Added virtual isLanguageVersionSupported to ClangTidyCheck

Summary:
Motivated by [[ https://bugs.llvm.org/show_bug.cgi?id=45045 | Tune inspections to a specific C++ standard. ]]
Moves the isLanguageVersionSupported virtual function from `MakeSmartPtrCheck` to the base `ClangTidyCheck` class.
This will disable registering matchers or pp callbacks on unsupported language versions for a check.
Having it as a standalone function is cleaner than manually disabling the check in the register function and should hopefully
encourage check developers to actually restrict the check based on language version.
As an added bonus this could enable automatic detection of what language version a check runs on for the purpose of documentation generation

Reviewers: aaron.ballman, gribozavr2, Eugene.Zelenko, JonasToth, alexfh, hokein

Reviewed By: gribozavr2

Subscribers: xazax.hun, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75289
clang-tools-extra/clang-tidy/ClangTidy.cpp
clang-tools-extra/clang-tidy/ClangTidyCheck.h
clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.h
clang-tools-extra/clangd/ParsedAST.cpp
clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h