aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/CXXInheritance.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-08 18:23:20 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-08 18:23:20 +0000
commit2aa800a955132d83a666bcd52d3d59d09cffc079 (patch)
treef67526d50f10362ff19e569637585c27023264c6 /lib/AST/CXXInheritance.cpp
parente696b6924d14b0e0590b5d923ca1646e6f67ac40 (diff)
Constify CXXRecordDecl::isVirtuallyDerivedFrom.
No functionality change. A couple ugly const_casts because the ancestor search code is used for other purposes as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CXXInheritance.cpp')
-rw-r--r--lib/AST/CXXInheritance.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp
index f9aa9127d2..cf3913bac0 100644
--- a/lib/AST/CXXInheritance.cpp
+++ b/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) {