diff options
author | John McCall <rjmccall@apple.com> | 2009-11-12 03:15:40 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-11-12 03:15:40 +0000 |
commit | 84c16cf824de9f670ec3fae8853d33ea287d0053 (patch) | |
tree | b0c15335edc78ad4f77d4ab4ad2e15fff4d5ce4e /clang/lib/AST/CXXInheritance.cpp | |
parent | cb5e22737302b51b690db0dcd71d1abc41989922 (diff) | |
download | bcm5719-llvm-84c16cf824de9f670ec3fae8853d33ea287d0053.tar.gz bcm5719-llvm-84c16cf824de9f670ec3fae8853d33ea287d0053.zip |
Random const correctness, and incidentally use computeDeclContext when building
a using declaration.
llvm-svn: 86942
Diffstat (limited to 'clang/lib/AST/CXXInheritance.cpp')
-rw-r--r-- | clang/lib/AST/CXXInheritance.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp index b59b45f6467..d4f6e871731 100644 --- a/clang/lib/AST/CXXInheritance.cpp +++ b/clang/lib/AST/CXXInheritance.cpp @@ -76,28 +76,28 @@ void CXXBasePaths::swap(CXXBasePaths &Other) { std::swap(DetectedVirtual, Other.DetectedVirtual); } -bool CXXRecordDecl::isDerivedFrom(CXXRecordDecl *Base) { +bool CXXRecordDecl::isDerivedFrom(CXXRecordDecl *Base) const { CXXBasePaths Paths(/*FindAmbiguities=*/false, /*RecordPaths=*/false, /*DetectVirtual=*/false); return isDerivedFrom(Base, Paths); } -bool CXXRecordDecl::isDerivedFrom(CXXRecordDecl *Base, CXXBasePaths &Paths) { +bool CXXRecordDecl::isDerivedFrom(CXXRecordDecl *Base, CXXBasePaths &Paths) const { if (getCanonicalDecl() == Base->getCanonicalDecl()) return false; - Paths.setOrigin(this); + Paths.setOrigin(const_cast<CXXRecordDecl*>(this)); return lookupInBases(&FindBaseClass, Base->getCanonicalDecl(), Paths); } bool CXXRecordDecl::lookupInBases(BaseMatchesCallback *BaseMatches, void *UserData, - CXXBasePaths &Paths) { + CXXBasePaths &Paths) const { bool FoundPath = false; ASTContext &Context = getASTContext(); - for (base_class_iterator BaseSpec = bases_begin(), BaseSpecEnd = bases_end(); - BaseSpec != BaseSpecEnd; ++BaseSpec) { + for (base_class_const_iterator BaseSpec = bases_begin(), + BaseSpecEnd = bases_end(); BaseSpec != BaseSpecEnd; ++BaseSpec) { // Find the record of the base class subobjects for this type. QualType BaseType = Context.getCanonicalType(BaseSpec->getType()); BaseType = BaseType.getUnqualifiedType(); @@ -183,7 +183,7 @@ bool CXXRecordDecl::lookupInBases(BaseMatchesCallback *BaseMatches, return FoundPath; } -bool CXXRecordDecl::FindBaseClass(CXXBaseSpecifier *Specifier, +bool CXXRecordDecl::FindBaseClass(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, void *BaseRecord) { assert(((Decl *)BaseRecord)->getCanonicalDecl() == BaseRecord && @@ -192,7 +192,7 @@ bool CXXRecordDecl::FindBaseClass(CXXBaseSpecifier *Specifier, ->getCanonicalDecl() == BaseRecord; } -bool CXXRecordDecl::FindTagMember(CXXBaseSpecifier *Specifier, +bool CXXRecordDecl::FindTagMember(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, void *Name) { RecordDecl *BaseRecord = Specifier->getType()->getAs<RecordType>()->getDecl(); @@ -208,7 +208,7 @@ bool CXXRecordDecl::FindTagMember(CXXBaseSpecifier *Specifier, return false; } -bool CXXRecordDecl::FindOrdinaryMember(CXXBaseSpecifier *Specifier, +bool CXXRecordDecl::FindOrdinaryMember(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, void *Name) { RecordDecl *BaseRecord = Specifier->getType()->getAs<RecordType>()->getDecl(); @@ -225,9 +225,10 @@ bool CXXRecordDecl::FindOrdinaryMember(CXXBaseSpecifier *Specifier, return false; } -bool CXXRecordDecl::FindNestedNameSpecifierMember(CXXBaseSpecifier *Specifier, - CXXBasePath &Path, - void *Name) { +bool CXXRecordDecl:: +FindNestedNameSpecifierMember(const CXXBaseSpecifier *Specifier, + CXXBasePath &Path, + void *Name) { RecordDecl *BaseRecord = Specifier->getType()->getAs<RecordType>()->getDecl(); DeclarationName N = DeclarationName::getFromOpaquePtr(Name); |