[PATCH] D16536: Fix crashing on user-defined conversion.
Cong Liu via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 25 09:20:49 PST 2016
congliu updated this revision to Diff 45873.
congliu added a comment.
- Address the comment and clean up the code.
http://reviews.llvm.org/D16536
Files:
clang-tidy/misc/VirtualNearMissCheck.cpp
test/clang-tidy/misc-virtual-near-miss.cpp
Index: test/clang-tidy/misc-virtual-near-miss.cpp
===================================================================
--- test/clang-tidy/misc-virtual-near-miss.cpp
+++ 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-tidy/misc/VirtualNearMissCheck.cpp
===================================================================
--- clang-tidy/misc/VirtualNearMissCheck.cpp
+++ 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.45873.patch
Type: text/x-patch
Size: 1519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160125/a188a810/attachment-0001.bin>
More information about the cfe-commits
mailing list