summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaAccess.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-11-03 16:51:37 +0000
committerDouglas Gregor <dgregor@apple.com>2011-11-03 16:51:37 +0000
commit03ba1887f0b8a13c37ff3d19fb58e9c5b70bb4da (patch)
treea38c6c8c7e4eb981a915f0c6ba374266804711fa /clang/lib/Sema/SemaAccess.cpp
parentdd847baaddd02a2cebb8b2b994636fbbe1ef0451 (diff)
downloadbcm5719-llvm-03ba1887f0b8a13c37ff3d19fb58e9c5b70bb4da.tar.gz
bcm5719-llvm-03ba1887f0b8a13c37ff3d19fb58e9c5b70bb4da.zip
Refactor Sema::IsSimplyAccessible slightly, to work on a DeclContext rather than a class
llvm-svn: 143615
Diffstat (limited to 'clang/lib/Sema/SemaAccess.cpp')
-rw-r--r--clang/lib/Sema/SemaAccess.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp
index 6cd92303268..83ca553aa68 100644
--- a/clang/lib/Sema/SemaAccess.cpp
+++ b/clang/lib/Sema/SemaAccess.cpp
@@ -1651,19 +1651,24 @@ void Sema::CheckLookupAccess(const LookupResult &R) {
/// \param Decl the declaration to check if it can be accessed
/// \param Class the class/context from which to start the search
/// \return true if the Decl is accessible from the Class, false otherwise.
-bool Sema::IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *Class) {
- if (!Class || !Decl->isCXXClassMember())
- return true;
+bool Sema::IsSimplyAccessible(NamedDecl *Decl, DeclContext *Ctx) {
+ if (CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(Ctx)) {
+ if (!Class || !Decl->isCXXClassMember())
+ return true;
- QualType qType = Class->getTypeForDecl()->getCanonicalTypeInternal();
- AccessTarget Entity(Context, AccessedEntity::Member, Class,
- DeclAccessPair::make(Decl, Decl->getAccess()),
- qType);
- if (Entity.getAccess() == AS_public)
- return true;
+ QualType qType = Class->getTypeForDecl()->getCanonicalTypeInternal();
+ AccessTarget Entity(Context, AccessedEntity::Member, Class,
+ DeclAccessPair::make(Decl, Decl->getAccess()),
+ qType);
+ if (Entity.getAccess() == AS_public)
+ return true;
- EffectiveContext EC(CurContext);
- return ::IsAccessible(*this, EC, Entity) != ::AR_inaccessible;
+ EffectiveContext EC(CurContext);
+ return ::IsAccessible(*this, EC, Entity) != ::AR_inaccessible;
+ }
+
+ // FIXME: Check access for Objective-C ivars.
+ return true;
}
void Sema::ActOnStartSuppressingAccessChecks() {
OpenPOWER on IntegriCloud