[PATCH] D16536: Fix crashing on user-defined conversion.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 26 03:00:33 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL258801: Fix crashing on user-defined conversion. (authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D16536?vs=45873&id=45963#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16536

Files:
  clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp

Index: clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp
@@ -69,6 +69,7 @@
   int decaz(const char str[]);
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'Child::decaz' has {{.*}} 'Mother::decay'
 
+  operator bool();
 private:
   void funk();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'Child::funk' has {{.*}} 'Father::func'
Index: clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
@@ -178,7 +178,8 @@
 
   bool IsPossible = !BaseMD->isImplicit() && !isa<CXXConstructorDecl>(BaseMD) &&
                     !isa<CXXDestructorDecl>(BaseMD) && BaseMD->isVirtual() &&
-                    !BaseMD->isOverloadedOperator();
+                    !BaseMD->isOverloadedOperator() &&
+                    !isa<CXXConversionDecl>(BaseMD);
   PossibleMap[Id] = IsPossible;
   return IsPossible;
 }
@@ -210,8 +211,9 @@
     return;
 
   Finder->addMatcher(
-      cxxMethodDecl(unless(anyOf(isOverride(), isImplicit(),
-                                 cxxConstructorDecl(), cxxDestructorDecl())))
+      cxxMethodDecl(
+          unless(anyOf(isOverride(), isImplicit(), cxxConstructorDecl(),
+                       cxxDestructorDecl(), cxxConversionDecl())))
           .bind("method"),
       this);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16536.45963.patch
Type: text/x-patch
Size: 1663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160126/9975395b/attachment.bin>


More information about the cfe-commits mailing list