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
diff --git a/clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp b/clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp
index b1ec6da..5b2c789 100644
--- a/clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MoveConstructorInitCheck.cpp
@@ -17,15 +17,19 @@
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) {