diff options
Diffstat (limited to 'clang/lib/AST/CXXInheritance.cpp')
-rw-r--r-- | clang/lib/AST/CXXInheritance.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp index f9aa9127d21..cf3913bac00 100644 --- a/clang/lib/AST/CXXInheritance.cpp +++ b/clang/lib/AST/CXXInheritance.cpp @@ -97,7 +97,7 @@ bool CXXRecordDecl::isDerivedFrom(const CXXRecordDecl *Base, Paths); } -bool CXXRecordDecl::isVirtuallyDerivedFrom(CXXRecordDecl *Base) const { +bool CXXRecordDecl::isVirtuallyDerivedFrom(const CXXRecordDecl *Base) const { if (!getNumVBases()) return false; @@ -107,8 +107,12 @@ bool CXXRecordDecl::isVirtuallyDerivedFrom(CXXRecordDecl *Base) const { if (getCanonicalDecl() == Base->getCanonicalDecl()) return false; - Paths.setOrigin(const_cast<CXXRecordDecl*>(this)); - return lookupInBases(&FindVirtualBaseClass, Base->getCanonicalDecl(), Paths); + Paths.setOrigin(const_cast<CXXRecordDecl*>(this)); + + const void *BasePtr = static_cast<const void*>(Base->getCanonicalDecl()); + return lookupInBases(&FindVirtualBaseClass, + const_cast<void *>(BasePtr), + Paths); } static bool BaseIsNot(const CXXRecordDecl *Base, void *OpaqueTarget) { @@ -161,7 +165,7 @@ bool CXXRecordDecl::forallBases(ForallBasesCallback *BaseMatches, return AllMatches; } -bool CXXBasePaths::lookupInBases(ASTContext &Context, +bool CXXBasePaths::lookupInBases(ASTContext &Context, const CXXRecordDecl *Record, CXXRecordDecl::BaseMatchesCallback *BaseMatches, void *UserData) { |