summaryrefslogtreecommitdiffstats
path: root/lib/AST/CXXInheritance.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-03 01:13:25 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-03 01:13:25 +0000
commit7f7f5f2803290121a1f78e041411ffc49b4c37fc (patch)
tree8c44d30df3c39e1cc8ee292dcaf18c2291a3f212 /lib/AST/CXXInheritance.cpp
parent971cc48dcae6719dc9e4e555fc4fcae8afc680fc (diff)
Revert r97618. Access control sucks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CXXInheritance.cpp')
-rw-r--r--lib/AST/CXXInheritance.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp
index 265b454975..99f908caea 100644
--- a/lib/AST/CXXInheritance.cpp
+++ b/lib/AST/CXXInheritance.cpp
@@ -140,20 +140,18 @@ bool CXXRecordDecl::forallBases(ForallBasesCallback *BaseMatches,
return AllMatches;
}
-static bool lookupInBases(ASTContext &Context, const CXXRecordDecl *Record,
- CXXRecordDecl::BaseMatchesCallback *BaseMatches,
- void *UserData,
- CXXBasePaths &Paths) {
+bool CXXRecordDecl::lookupInBases(BaseMatchesCallback *BaseMatches,
+ void *UserData,
+ CXXBasePaths &Paths) const {
bool FoundPath = false;
// The access of the path down to this record.
AccessSpecifier AccessToHere = Paths.ScratchPath.Access;
bool IsFirstStep = Paths.ScratchPath.empty();
- for (CXXRecordDecl::base_class_const_iterator BaseSpec = Record->bases_begin(),
- BaseSpecEnd = Record->bases_end();
- BaseSpec != BaseSpecEnd;
- ++BaseSpec) {
+ ASTContext &Context = getASTContext();
+ 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())
.getUnqualifiedType();
@@ -188,7 +186,7 @@ static bool lookupInBases(ASTContext &Context, const CXXRecordDecl *Record,
// Add this base specifier to the current path.
CXXBasePathElement Element;
Element.Base = &*BaseSpec;
- Element.Class = Record;
+ Element.Class = this;
if (BaseSpec->isVirtual())
Element.SubobjectNumber = 0;
else
@@ -214,8 +212,7 @@ static bool lookupInBases(ASTContext &Context, const CXXRecordDecl *Record,
Paths.ScratchPath.Access = BaseSpec->getAccessSpecifier();
else
Paths.ScratchPath.Access
- = CXXRecordDecl::MergeAccess(AccessToHere,
- BaseSpec->getAccessSpecifier());
+ = MergeAccess(AccessToHere, BaseSpec->getAccessSpecifier());
}
// Track whether there's a path involving this specific base.
@@ -236,7 +233,7 @@ static bool lookupInBases(ASTContext &Context, const CXXRecordDecl *Record,
CXXRecordDecl *BaseRecord
= cast<CXXRecordDecl>(BaseSpec->getType()->getAs<RecordType>()
->getDecl());
- if (lookupInBases(Context, BaseRecord, BaseMatches, UserData, Paths)) {
+ if (BaseRecord->lookupInBases(BaseMatches, UserData, Paths)) {
// C++ [class.member.lookup]p2:
// A member name f in one sub-object B hides a member name f in
// a sub-object A if A is a base class sub-object of B. Any
@@ -269,12 +266,6 @@ static bool lookupInBases(ASTContext &Context, const CXXRecordDecl *Record,
return FoundPath;
}
-bool CXXRecordDecl::lookupInBases(BaseMatchesCallback *BaseMatches,
- void *UserData,
- CXXBasePaths &Paths) const {
- return ::lookupInBases(getASTContext(), this, BaseMatches, UserData, Paths);
-}
-
bool CXXRecordDecl::FindBaseClass(const CXXBaseSpecifier *Specifier,
CXXBasePath &Path,
void *BaseRecord) {