summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaAccess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaAccess.cpp')
-rw-r--r--lib/Sema/SemaAccess.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp
index 9fbae2ca297f5..e06792cae78ba 100644
--- a/lib/Sema/SemaAccess.cpp
+++ b/lib/Sema/SemaAccess.cpp
@@ -152,8 +152,8 @@ struct AccessTarget : public AccessedEntity {
: AccessedEntity(Entity) {
initialize();
}
-
- AccessTarget(ASTContext &Context,
+
+ AccessTarget(ASTContext &Context,
MemberNonce _,
CXXRecordDecl *NamingClass,
DeclAccessPair FoundDecl,
@@ -163,7 +163,7 @@ struct AccessTarget : public AccessedEntity {
initialize();
}
- AccessTarget(ASTContext &Context,
+ AccessTarget(ASTContext &Context,
BaseNonce _,
CXXRecordDecl *BaseClass,
CXXRecordDecl *DerivedClass,
@@ -777,7 +777,7 @@ static AccessResult HasAccess(Sema &S,
// We interpret this as a restriction on [M3].
// In this part of the code, 'C' is just our context class ECRecord.
-
+
// These rules are different if we don't have an instance context.
if (!Target.hasInstanceContext()) {
// If it's not an instance member, these restrictions don't apply.
@@ -1272,8 +1272,8 @@ static void DiagnoseBadAccess(Sema &S, SourceLocation Loc,
DiagnoseAccessPath(S, EC, Entity);
}
-/// MSVC has a bug where if during an using declaration name lookup,
-/// the declaration found is unaccessible (private) and that declaration
+/// MSVC has a bug where if during an using declaration name lookup,
+/// the declaration found is unaccessible (private) and that declaration
/// was bring into scope via another using declaration whose target
/// declaration is accessible (public) then no error is generated.
/// Example:
@@ -1290,15 +1290,15 @@ static void DiagnoseBadAccess(Sema &S, SourceLocation Loc,
/// using B::f;
/// };
///
-/// Here, B::f is private so this should fail in Standard C++, but
+/// Here, B::f is private so this should fail in Standard C++, but
/// because B::f refers to A::f which is public MSVC accepts it.
-static bool IsMicrosoftUsingDeclarationAccessBug(Sema& S,
+static bool IsMicrosoftUsingDeclarationAccessBug(Sema& S,
SourceLocation AccessLoc,
AccessTarget &Entity) {
if (UsingShadowDecl *Shadow =
dyn_cast<UsingShadowDecl>(Entity.getTargetDecl())) {
const NamedDecl *OrigDecl = Entity.getTargetDecl()->getUnderlyingDecl();
- if (Entity.getTargetDecl()->getAccess() == AS_private &&
+ if (Entity.getTargetDecl()->getAccess() == AS_private &&
(OrigDecl->getAccess() == AS_public ||
OrigDecl->getAccess() == AS_protected)) {
S.Diag(AccessLoc, diag::ext_ms_using_declaration_inaccessible)
@@ -1536,7 +1536,7 @@ Sema::AccessResult Sema::CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E,
Found.getAccess() == AS_public)
return AR_accessible;
- AccessTarget Entity(Context, AccessTarget::Member, E->getNamingClass(),
+ AccessTarget Entity(Context, AccessTarget::Member, E->getNamingClass(),
Found, QualType());
Entity.setDiag(diag::err_access) << E->getSourceRange();
@@ -1691,7 +1691,7 @@ Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc,
AccessEntity.setDiag(PD);
return CheckAccess(*this, UseLoc, AccessEntity);
-}
+}
/// Checks access to an overloaded operator new or delete.
Sema::AccessResult Sema::CheckAllocationAccess(SourceLocation OpLoc,
@@ -1823,7 +1823,7 @@ Sema::AccessResult Sema::CheckBaseClassAccess(SourceLocation AccessLoc,
BaseD = cast<CXXRecordDecl>(Base->getAs<RecordType>()->getDecl());
DerivedD = cast<CXXRecordDecl>(Derived->getAs<RecordType>()->getDecl());
- AccessTarget Entity(Context, AccessTarget::Base, BaseD, DerivedD,
+ AccessTarget Entity(Context, AccessTarget::Base, BaseD, DerivedD,
Path.Access);
if (DiagID)
Entity.setDiag(DiagID) << Derived << Base;
@@ -1893,7 +1893,7 @@ bool Sema::IsSimplyAccessible(NamedDecl *Target, DeclContext *Ctx) {
if (ObjCMethodDecl *MD = getCurMethodDecl())
ClassOfMethodDecl = MD->getClassInterface();
else if (FunctionDecl *FD = getCurFunctionDecl()) {
- if (ObjCImplDecl *Impl
+ if (ObjCImplDecl *Impl
= dyn_cast<ObjCImplDecl>(FD->getLexicalDeclContext())) {
if (ObjCImplementationDecl *IMPD
= dyn_cast<ObjCImplementationDecl>(Impl))
@@ -1903,21 +1903,21 @@ bool Sema::IsSimplyAccessible(NamedDecl *Target, DeclContext *Ctx) {
ClassOfMethodDecl = CatImplClass->getClassInterface();
}
}
-
+
// If we're not in an interface, this ivar is inaccessible.
if (!ClassOfMethodDecl)
return false;
-
+
// If we're inside the same interface that owns the ivar, we're fine.
if (declaresSameEntity(ClassOfMethodDecl, Ivar->getContainingInterface()))
return true;
-
+
// If the ivar is private, it's inaccessible.
if (Ivar->getCanonicalAccessControl() == ObjCIvarDecl::Private)
return false;
-
+
return Ivar->getContainingInterface()->isSuperClassOf(ClassOfMethodDecl);
}
-
+
return true;
}