aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
diff options
context:
space:
mode:
authorJonas Toth <jonas.toth@gmail.com>2019-02-28 14:55:12 +0000
committerJonas Toth <jonas.toth@gmail.com>2019-02-28 14:55:12 +0000
commitda666233fe7d1748b38ae0cea0b7be357e8b6a05 (patch)
tree634650f19451872df59060457afc2102d8809818 /clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
parent2098b86b9658c0751ef00af779ab34cc7a56f01d (diff)
downloadllvm-da666233fe7d1748b38ae0cea0b7be357e8b6a05.zip
llvm-da666233fe7d1748b38ae0cea0b7be357e8b6a05.tar.gz
llvm-da666233fe7d1748b38ae0cea0b7be357e8b6a05.tar.bz2
[clang-tidy] added cppcoreguidelines-explicit-virtual-functions
Addresses the bugzilla bug #30397. (https://bugs.llvm.org/show_bug.cgi?id=30397) modernize-use-override suggests that destructors require the override specifier and the CPP core guidelines do not recommend this. Patch by lewmpk. Differential Revision: https://reviews.llvm.org/D58731 llvm-svn: 355093
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
index 6b06595..cd7ed6c 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
@@ -17,9 +17,20 @@ namespace clang {
namespace tidy {
namespace modernize {
+void UseOverrideCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
+ Options.store(Opts, "IgnoreDestructors", IgnoreDestructors);
+}
+
void UseOverrideCheck::registerMatchers(MatchFinder *Finder) {
// Only register the matcher for C++11.
- if (getLangOpts().CPlusPlus11)
+ if (!getLangOpts().CPlusPlus11)
+ return;
+
+ if (IgnoreDestructors)
+ Finder->addMatcher(
+ cxxMethodDecl(isOverride(), unless(cxxDestructorDecl())).bind("method"),
+ this);
+ else
Finder->addMatcher(cxxMethodDecl(isOverride()).bind("method"), this);
}