Author: alexfh
Date: Wed Dec 28 07:48:03 2016
New Revision: 290668

URL: http://llvm.org/viewvc/llvm-project?rev=290668&view=rev
Log:
[clang-tidy] google-explicit-constructor: ignore compiler-generated conversion 
operators.

Modified:
    clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
    clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp

Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp?rev=290668&r1=290667&r2=290668&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp Wed 
Dec 28 07:48:03 2016
@@ -26,8 +26,11 @@ void ExplicitConstructorCheck::registerM
     return;
   Finder->addMatcher(cxxConstructorDecl(unless(isInstantiated())).bind("ctor"),
                      this);
-  
Finder->addMatcher(cxxConversionDecl(unless(isExplicit())).bind("conversion"),
-                     this);
+  Finder->addMatcher(
+      cxxConversionDecl(unless(isExplicit()), // Already marked explicit.
+                        unless(isImplicit())) // Compiler-generated.
+          .bind("conversion"),
+      this);
 }
 
 // Looks for the token matching the predicate and returns the range of the 
found

Modified: 
clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp?rev=290668&r1=290667&r2=290668&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp Wed 
Dec 28 07:48:03 2016
@@ -80,6 +80,10 @@ struct B {
   // CHECK-FIXES: {{^  }}B(::std::initializer_list<char> &&list6) {}
 };
 
+struct StructWithFnPointer {
+  void (*f)();
+} struct_with_fn_pointer = {[] {}};
+
 using namespace std;
 
 struct C {


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to