diff options
author | John McCall <rjmccall@apple.com> | 2010-01-20 21:53:11 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-01-20 21:53:11 +0000 |
commit | 401982f56c3633a4c77ddad49708795132265e13 (patch) | |
tree | 5aeb4c593a7e4f11c2221c1931d238c058c73e2e /clang/lib/Sema/SemaLookup.cpp | |
parent | dd969c897ecb31480f3cee2856ff72e0854d8527 (diff) | |
download | bcm5719-llvm-401982f56c3633a4c77ddad49708795132265e13.tar.gz bcm5719-llvm-401982f56c3633a4c77ddad49708795132265e13.zip |
First pass at collecting access-specifier information along inheritance paths.
Triggers lots of assertions about missing access information; fix them.
Will actually consume this information soon.
llvm-svn: 94038
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index da7626780ca..ddce4a4c23d 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -445,8 +445,9 @@ static bool LookupDirect(LookupResult &R, const DeclContext *DC) { DeclContext::lookup_const_iterator I, E; for (llvm::tie(I, E) = DC->lookup(R.getLookupName()); I != E; ++I) { - if (R.isAcceptableDecl(*I)) { - R.addDecl(*I); + NamedDecl *D = *I; + if (R.isAcceptableDecl(D)) { + R.addDecl(D); Found = true; } } @@ -1047,10 +1048,15 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, // FIXME: support using declarations! QualType SubobjectType; int SubobjectNumber = 0; + AccessSpecifier SubobjectAccess = AS_private; for (CXXBasePaths::paths_iterator Path = Paths.begin(), PathEnd = Paths.end(); Path != PathEnd; ++Path) { const CXXBasePathElement &PathElement = Path->back(); + // Pick the best (i.e. most permissive i.e. numerically lowest) access + // across all paths. + SubobjectAccess = std::min(SubobjectAccess, Path->Access); + // Determine whether we're looking at a distinct sub-object or not. if (SubobjectType.isNull()) { // This is the first subobject we've looked at. Record its type. @@ -1106,7 +1112,7 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, DeclContext::lookup_iterator I, E; for (llvm::tie(I,E) = Paths.front().Decls; I != E; ++I) - R.addDecl(*I); + R.addDecl(*I, std::max(SubobjectAccess, (*I)->getAccess())); R.resolveKind(); return true; } |