From 11887924806547ec02e0838644afa80c69084fa8 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 31 Jul 2014 09:58:52 +0000 Subject: [clang-tidy] Add a checker for code that looks like a delegate constructors but doesn't delegate. Summary: class Foo { Foo() { Foo(42); // oops } Foo(int); }; This is valid code but it does nothing and we can't emit a warning in clang because there might be side effects. The checker emits a warning for this pattern and also for base class initializers written in this style. There is some overlap with the unused-rtti checker but they follow different goals and fire in different places most of the time. Reviewers: alexfh, djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4667 llvm-svn: 214397 --- clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp') diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp index e3dbdc3bcbe..8cf70d30492 100644 --- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp @@ -14,6 +14,7 @@ #include "BoolPointerImplicitConversion.h" #include "RedundantSmartptrGet.h" #include "SwappedArgumentsCheck.h" +#include "UndelegatedConstructor.h" #include "UnusedRAII.h" #include "UseOverride.h" @@ -35,6 +36,9 @@ public: CheckFactories.addCheckFactory( "misc-swapped-arguments", new ClangTidyCheckFactory()); + CheckFactories.addCheckFactory( + "misc-undelegated-constructor", + new ClangTidyCheckFactory()); CheckFactories.addCheckFactory( "misc-unused-raii", new ClangTidyCheckFactory()); -- cgit v1.2.3