diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2015-08-28 19:27:19 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2015-08-28 19:27:19 +0000 |
commit | 327e97bb37ec535f134b0b3e7ecbb9c181ad4f4c (patch) | |
tree | 787f0b09c43bf1d18e7b891e8f6d33cd4bbc5956 /clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp | |
parent | ff7da34bc36d2859076876637ad2b04796cbb81c (diff) | |
download | bcm5719-llvm-327e97bb37ec535f134b0b3e7ecbb9c181ad4f4c.tar.gz bcm5719-llvm-327e97bb37ec535f134b0b3e7ecbb9c181ad4f4c.zip |
Disable clang-tidy misc checkers when not compiling in C++ mode. Many of the checkers do not require additional testing as the tests will not compile for other languages or modes, or the checkers would never match a valid construct.
llvm-svn: 246318
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp b/clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp index b1ec6da74a7..5b2c789a6c8 100644 --- a/clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp @@ -17,15 +17,19 @@ namespace clang { namespace tidy { void MoveConstructorInitCheck::registerMatchers(MatchFinder *Finder) { - Finder->addMatcher( - constructorDecl(unless(isImplicit()), allOf( - isMoveConstructor(), - hasAnyConstructorInitializer( - ctorInitializer(withInitializer(constructExpr(hasDeclaration( - constructorDecl(isCopyConstructor()).bind("ctor") - )))).bind("init") - ) - )), this); + // Only register the matchers for C++11; the functionality currently does not + // provide any benefit to other languages, despite being benign. + if (getLangOpts().CPlusPlus11) { + Finder->addMatcher( + constructorDecl(unless(isImplicit()), allOf( + isMoveConstructor(), + hasAnyConstructorInitializer( + ctorInitializer(withInitializer(constructExpr(hasDeclaration( + constructorDecl(isCopyConstructor()).bind("ctor") + )))).bind("init") + ) + )), this); + } } void MoveConstructorInitCheck::check(const MatchFinder::MatchResult &Result) { |