summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp b/clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp
index 0390c235711..5f56a4c8516 100644
--- a/clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UndelegatedConstructor.cpp
@@ -55,15 +55,20 @@ void UndelegatedConstructorCheck::registerMatchers(MatchFinder *Finder) {
// depending on the type's destructor and the number of arguments on the
// constructor call, this is handled by ignoringTemporaryExpr. Ignore template
// instantiations to reduce the number of duplicated warnings.
- Finder->addMatcher(
- compoundStmt(
- hasParent(constructorDecl(ofClass(recordDecl().bind("parent")))),
- forEach(ignoringTemporaryExpr(
- constructExpr(hasDeclaration(constructorDecl(ofClass(
- recordDecl(baseOfBoundNode("parent"))))))
- .bind("construct"))),
- unless(isInTemplateInstantiation())),
- 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(
+ compoundStmt(
+ hasParent(constructorDecl(ofClass(recordDecl().bind("parent")))),
+ forEach(ignoringTemporaryExpr(
+ constructExpr(hasDeclaration(constructorDecl(ofClass(
+ recordDecl(baseOfBoundNode("parent"))))))
+ .bind("construct"))),
+ unless(isInTemplateInstantiation())),
+ this);
+ }
}
void UndelegatedConstructorCheck::check(const MatchFinder::MatchResult &Result) {
OpenPOWER on IntegriCloud