[clang-tools-extra] r290633 - [clang-tidy] Make 2 checks register matchers for C++ only.

Malcolm Parsons via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 27 14:14:40 PST 2016


Author: malcolm.parsons
Date: Tue Dec 27 16:14:40 2016
New Revision: 290633

URL: http://llvm.org/viewvc/llvm-project?rev=290633&view=rev
Log:
[clang-tidy] Make 2 checks register matchers for C++ only.

Modified:
    clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
    clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDeleteCheck.cpp?rev=290633&r1=290632&r2=290633&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDeleteCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDeleteCheck.cpp Tue Dec 27 16:14:40 2016
@@ -22,6 +22,9 @@ static const char SpecialFunction[] = "S
 static const char DeletedNotPublic[] = "DeletedNotPublic";
 
 void UseEqualsDeleteCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus)
+    return;
+
   auto PrivateSpecialFn = cxxMethodDecl(
       isPrivate(),
       anyOf(cxxConstructorDecl(anyOf(isDefaultConstructor(),

Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp?rev=290633&r1=290632&r2=290633&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp Tue Dec 27 16:14:40 2016
@@ -22,6 +22,9 @@ namespace tidy {
 namespace readability {
 
 void RedundantMemberInitCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus)
+    return;
+
   auto Construct =
       cxxConstructExpr(
           hasDeclaration(cxxConstructorDecl(hasParent(




More information about the cfe-commits mailing list