Home | History | Annotate | Download | only in Sema

Lines Matching defs: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.
134 /// doing access-control without privileges.
169 AccessSpecifier Access)
171 Access) {
593 /// A helper class for checking for a friend which will grant access
631 /// the final class in the path would have access in that class.
647 // base will not have any access in classes derived from Cur.
689 /// NamingClass would have some natural access in P, which implicitly
694 /// would have to have some natural access in P, it says the actual
695 /// target has to have some natural access in P, which opens up the
701 /// access a forbidden base class's members by directly subclassing
703 /// - It also makes access substantially harder to compute because it
731 AccessSpecifier Access,
736 if (Access == AS_public) return AR_accessible;
737 assert(Access == AS_private || Access == AS_protected);
748 if (Access == AS_private) {
757 assert(Access == AS_protected);
765 // An additional access check beyond those described earlier in
766 // [class.access] is applied when a non-static data member or
768 // class. As described earlier, access to a protected member is
770 // some class C. If the access is to form a pointer to member,
798 // pointer-to-member expression nor in a member access: when
835 // access if the access occurs in a friend or member of some class P
837 // access in P. The 'member' aspect is easy to handle because P
844 if (Access == AS_protected && Target.isInstanceMember()) {
873 /// C++0x [class.access.base]p5:
885 /// C++0x [class.access.base]p4:
901 /// access equivalent to the member's access. Therefore we need only
906 /// B_i). For i in 1..n, we will calculate ACAB(i), the access to the
908 /// Access(a, b) = (* access on the base specifier from a to b *)
918 /// let AccessToBase = Merge(Access(B_i, B_{i+1}), ACAB(i+1)) in
923 /// \param FinalAccess the access of the "final step", or AS_public if
943 assert(FinalAccess != AS_none && "forbidden access after declaring class");
947 // Derive the friend-modified access along each path.
988 // Note that we modify the path's Access field to the
989 // friend-modified access.
990 if (BestPath == 0 || PathAccess < BestPath->Access) {
992 BestPath->Access = PathAccess;
995 if (BestPath->Access == AS_public)
1002 assert((!BestPath || BestPath->Access != AS_public) &&
1013 /// Given that an entity has protected natural access, check whether
1014 /// access might be denied because of the protected member access
1040 // access.
1044 // access here would grant us access overall.
1062 assert(InstanceContext && "diagnosing dependent access");
1097 AccessSpecifier Access = Entity.getAccess();
1102 // Easy case: the decl's natural access determined its path access.
1103 // We have to check against AS_private here in case Access is AS_none,
1105 if (D && (Access == D->getAccess() || D->getAccess() == AS_private)) {
1108 if (Access == AS_protected &&
1155 << (unsigned) (Access == AS_protected)
1163 llvm_unreachable("can't diagnose dependent access failures");
1186 llvm_unreachable("can't diagnose dependent access failures");
1190 // constraining access. We have to check against AS_private for
1192 if (BaseAccess == AS_private || BaseAccess >= Access) {
1214 llvm_unreachable("access not apparently constrained by path");
1282 assert(UnprivilegedAccess != AS_public && "public access not weeded out");
1284 // Before we try to recalculate access paths, try to white-list
1287 // common forms of privileged access.
1292 // *have* to delay immediately here: we can do the full access
1297 // access.
1336 // Append the declaration's access if applicable.
1342 assert(Path->Access <= UnprivilegedAccess &&
1343 "access along best path worse than direct?");
1344 if (Path->Access == AS_public)
1353 assert(EC.isDependent() && "delaying non-dependent access");
1355 assert(DC->isDependentContext() && "delaying non-dependent access");
1356 DependentDiagnostic::Create(S.Context, DC, DependentDiagnostic::Access,
1366 /// Checks access to an entity from the given effective context.
1371 assert(Entity.getAccess() != AS_public && "called for public access!");
1392 llvm_unreachable("invalid access result");
1397 // If the access path is public, it's accessible everywhere.
1402 // access control checking, because our effective context might be
1427 // Access control for names used in the declarations of functions
1451 AccessSpecifier Access = DD.getAccess();
1473 DeclAccessPair::make(TargetDecl, Access),
1482 Access);
1502 /// Perform access-control checking on a previously-unresolved member
1503 /// access which has now been resolved to a member.
1524 AccessSpecifier access,
1527 if (access == AS_public || !getLangOpts().AccessControl) return true;
1530 DeclAccessPair::make(decl, access), objectType);
1541 llvm_unreachable("bad access result");
1551 // There's never a path involved when checking implicit destructor access.
1552 AccessSpecifier Access = Dtor->getAccess();
1553 if (Access == AS_public)
1560 DeclAccessPair::make(Dtor, Access),
1567 /// Checks access to a constructor.
1571 AccessSpecifier Access,
1573 if (!getLangOpts().AccessControl || Access == AS_public)
1607 return CheckConstructorAccess(UseLoc, Constructor, Entity, Access, PD);
1610 /// Checks access to a constructor.
1614 AccessSpecifier Access,
1617 Access == AS_public)
1633 DeclAccessPair::make(Constructor, Access),
1640 /// Checks access to an overloaded operator new or delete.
1660 /// Checks access to an overloaded member operator, including
1682 /// Checks access to the target of a friend declaration.
1690 // inheritance path modifying access.
1691 AccessSpecifier access = target->getAccess();
1693 if (!getLangOpts().AccessControl || access == AS_public)
1704 DeclAccessPair::make(target, access),
1738 /// Checks access for a hierarchy conversion.
1740 /// \param ForceCheck true if this check should be performed even if access
1754 if (Path.Access == AS_public)
1762 Path.Access);
1778 /// Checks access to all the declarations in the given result set.
1781 && "performing access check without access control");
1782 assert(R.getNamingClass() && "performing access check without naming class");
1795 /// Checks access to Decl from the given class. The check will take access
1796 /// specifiers into account, but no member access expressions and such.