[clang-tools-extra] r258801 - Fix crashing on user-defined conversion.
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 26 02:56:27 PST 2016
Author: alexfh
Date: Tue Jan 26 04:56:27 2016
New Revision: 258801
URL: http://llvm.org/viewvc/llvm-project?rev=258801&view=rev
Log:
Fix crashing on user-defined conversion.
Summary: Fix the assertion failure for the user-defined conversion method. e.g.: operator bool()
Reviewers: alexfh, aaron.ballman
Subscribers: aaron.ballman, cfe-commits
Patch by Cong Liu!
Differential Revision: http://reviews.llvm.org/D16536
Modified:
clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp
Modified: clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp?rev=258801&r1=258800&r2=258801&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp Tue Jan 26 04:56:27 2016
@@ -178,7 +178,8 @@ bool VirtualNearMissCheck::isPossibleToB
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 @@ void VirtualNearMissCheck::registerMatch
return;
Finder->addMatcher(
- cxxMethodDecl(unless(anyOf(isOverride(), isImplicit(),
- cxxConstructorDecl(), cxxDestructorDecl())))
+ cxxMethodDecl(
+ unless(anyOf(isOverride(), isImplicit(), cxxConstructorDecl(),
+ cxxDestructorDecl(), cxxConversionDecl())))
.bind("method"),
this);
}
Modified: clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp?rev=258801&r1=258800&r2=258801&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp Tue Jan 26 04:56:27 2016
@@ -69,6 +69,7 @@ public:
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'
More information about the cfe-commits
mailing list