Home | History | Annotate | Download | only in Sema

Lines Matching refs:Access

1 //===---- SemaAccess.cpp - C++ Access Control -------------------*- C++ -*-===//
10 // This file provides Sema routines for C++ access control semantics.
36 /// SetMemberAccessSpecifier - Set the access specifier of a member.
37 /// Returns true on error (when the previous member decl access specifier
38 /// is different from the new member decl access specifier).
43 // Use the lexical access specifier.
48 // C++ [class.access.spec]p3: When a member is redeclared its access
87 // C++ [class.access.nest]p1:
88 // A nested class is a member and as such has the same access
90 // C++ [class.access]p2:
91 // A member of a class can also access all the names to which
92 // the class has access. A local class of a member function
93 // may access the same names that the member function itself
94 // may access.
129 /// doing access-control without privileges.
163 AccessSpecifier Access)
164 : AccessedEntity(Context, Base, BaseClass, DerivedClass, Access) {
586 /// A helper class for checking for a friend which will grant access
624 /// the final class in the path would have access in that class.
640 // base will not have any access in classes derived from Cur.
682 /// NamingClass would have some natural access in P, which implicitly
687 /// would have to have some natural access in P, it says the actual
688 /// target has to have some natural access in P, which opens up the
694 /// access a forbidden base class's members by directly subclassing
696 /// - It also makes access substantially harder to compute because it
724 AccessSpecifier Access,
729 if (Access == AS_public) return AR_accessible;
730 assert(Access == AS_private || Access == AS_protected);
741 if (Access == AS_private) {
750 assert(Access == AS_protected);
758 // An additional access check beyond those described earlier in
759 // [class.access] is applied when a non-static data member or
761 // class. As described earlier, access to a protected member is
763 // some class C. If the access is to form a pointer to member,
791 // pointer-to-member expression nor in a member access: when
828 // access if the access occurs in a friend or member of some class P
830 // access in P. The 'member' aspect is easy to handle because P
837 if (Access == AS_protected && Target.isInstanceMember()) {
866 /// C++0x [class.access.base]p5:
878 /// C++0x [class.access.base]p4:
894 /// access equivalent to the member's access. Therefore we need only
899 /// B_i). For i in 1..n, we will calculate ACAB(i), the access to the
901 /// Access(a, b) = (* access on the base specifier from a to b *)
911 /// let AccessToBase = Merge(Access(B_i, B_{i+1}), ACAB(i+1)) in
916 /// \param FinalAccess the access of the "final step", or AS_public if
936 assert(FinalAccess != AS_none && "forbidden access after declaring class");
940 // Derive the friend-modified access along each path.
981 // Note that we modify the path's Access field to the
982 // friend-modified access.
983 if (BestPath == 0 || PathAccess < BestPath->Access) {
985 BestPath->Access = PathAccess;
988 if (BestPath->Access == AS_public)
995 assert((!BestPath || BestPath->Access != AS_public) &&
1006 /// Given that an entity has protected natural access, check whether
1007 /// access might be denied because of the protected member access
1033 // access.
1037 // access here would grant us access overall.
1055 assert(InstanceContext && "diagnosing dependent access");
1090 AccessSpecifier Access = Entity.getAccess();
1095 // Easy case: the decl's natural access determined its path access.
1096 // We have to check against AS_private here in case Access is AS_none,
1098 if (D && (Access == D->getAccess() || D->getAccess() == AS_private)) {
1101 if (Access == AS_protected &&
1148 << (unsigned) (Access == AS_protected)
1156 llvm_unreachable("can't diagnose dependent access failures");
1179 llvm_unreachable("can't diagnose dependent access failures");
1183 // constraining access. We have to check against AS_private for
1185 if (BaseAccess == AS_private || BaseAccess >= Access) {
1207 llvm_unreachable("access not apparently constrained by path");
1275 assert(UnprivilegedAccess != AS_public && "public access not weeded out");
1277 // Before we try to recalculate access paths, try to white-list
1280 // common forms of privileged access.
1285 // *have* to delay immediately here: we can do the full access
1290 // access.
1329 // Append the declaration's access if applicable.
1335 assert(Path->Access <= UnprivilegedAccess &&
1336 "access along best path worse than direct?");
1337 if (Path->Access == AS_public)
1346 assert(EC.isDependent() && "delaying non-dependent access");
1348 assert(DC->isDependentContext() && "delaying non-dependent access");
1349 DependentDiagnostic::Create(S.Context, DC, DependentDiagnostic::Access,
1359 /// Checks access to an entity from the given effective context.
1364 assert(Entity.getAccess() != AS_public && "called for public access!");
1385 llvm_unreachable("invalid access result");
1390 // If the access path is public, it's accessible everywhere.
1398 // access control checking, because our effective context might be
1423 // Access control for names used in the declarations of functions
1447 AccessSpecifier Access = DD.getAccess();
1469 DeclAccessPair::make(TargetDecl, Access),
1478 Access);
1498 /// Perform access-control checking on a previously-unresolved member
1499 /// access which has now been resolved to a member.
1520 AccessSpecifier access,
1523 if (access == AS_public || !getLangOpts().AccessControl) return true;
1526 DeclAccessPair::make(decl, access), objectType);
1537 llvm_unreachable("bad access result");
1547 // There's never a path involved when checking implicit destructor access.
1548 AccessSpecifier Access = Dtor->getAccess();
1549 if (Access == AS_public)
1556 DeclAccessPair::make(Dtor, Access),
1563 /// Checks access to a constructor.
1567 AccessSpecifier Access,
1569 if (!getLangOpts().AccessControl || Access == AS_public)
1603 return CheckConstructorAccess(UseLoc, Constructor, Entity, Access, PD);
1606 /// Checks access to a constructor.
1610 AccessSpecifier Access,
1613 Access == AS_public)
1629 DeclAccessPair::make(Constructor, Access),
1636 /// Checks direct (i.e. non-inherited) access to an arbitrary class
1641 AccessSpecifier Access = Target->getAccess();
1643 Access == AS_public)
1648 DeclAccessPair::make(Target, Access),
1655 /// Checks access to an overloaded operator new or delete.
1675 /// Checks access to an overloaded member operator, including
1715 /// Checks access for a hierarchy conversion.
1719 /// \param ForceCheck true if this check should be performed even if access
1734 if (Path.Access == AS_public)
1742 Path.Access);
1758 /// Checks access to all the declarations in the given result set.
1761 && "performing access check without access control");
1762 assert(R.getNamingClass() && "performing access check without naming class");
1775 /// Checks access to Decl from the given class. The check will take access
1776 /// specifiers into account, but no member access expressions and such.
1842 "Tried to start access check suppression when already started.");
1848 "Tried to stop access check suprression when already stopped.");