diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-07-31 09:58:52 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-07-31 09:58:52 +0000 |
commit | 11887924806547ec02e0838644afa80c69084fa8 (patch) | |
tree | 292aaadf9abc3431bfe66a025502152305343d3a /clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp | |
parent | 1cd9e019dae22e01ce608a9b333dfb3e38045d6a (diff) | |
download | bcm5719-llvm-11887924806547ec02e0838644afa80c69084fa8.tar.gz bcm5719-llvm-11887924806547ec02e0838644afa80c69084fa8.zip |
[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
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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" @@ -36,6 +37,9 @@ public: "misc-swapped-arguments", new ClangTidyCheckFactory<SwappedArgumentsCheck>()); CheckFactories.addCheckFactory( + "misc-undelegated-constructor", + new ClangTidyCheckFactory<UndelegatedConstructorCheck>()); + CheckFactories.addCheckFactory( "misc-unused-raii", new ClangTidyCheckFactory<UnusedRAIICheck>()); CheckFactories.addCheckFactory( |