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++11 [class.access.nest]p1:
88 // A nested class is a member and as such has the same access
90 // C++11 [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) {
600 /// A helper class for checking for a friend which will grant access
638 /// the final class in the path would have access in that class.
652 // base will not have any access in classes derived from Cur.
694 /// NamingClass would have some natural access in P, which implicitly
699 /// would have to have some natural access in P, it says the actual
700 /// target has to have some natural access in P, which opens up the
706 /// access a forbidden base class's members by directly subclassing
708 /// - It also makes access substantially harder to compute because it
736 AccessSpecifier Access,
741 if (Access == AS_public) return AR_accessible;
742 assert(Access == AS_private || Access == AS_protected);
753 if (Access == AS_private) {
762 assert(Access == AS_protected);
770 // An additional access check beyond those described earlier in
771 // [class.access] is applied when a non-static data member or
773 // class. As described earlier, access to a protected member is
775 // some class C. If the access is to form a pointer to member,
803 // pointer-to-member expression nor in a member access: when
840 // access if the access occurs in a friend or member of some class P
842 // access in P. The 'member' aspect is easy to handle because P
849 if (Access == AS_protected && Target.isInstanceMember()) {
878 /// C++0x [class.access.base]p5:
890 /// C++0x [class.access.base]p4:
906 /// access equivalent to the member's access. Therefore we need only
911 /// B_i). For i in 1..n, we will calculate ACAB(i), the access to the
913 /// Access(a, b) = (* access on the base specifier from a to b *)
923 /// let AccessToBase = Merge(Access
928 /// \param FinalAccess the access of the "final step", or AS_public if
948 assert(FinalAccess != AS_none && "forbidden access after declaring class");
952 // Derive the friend-modified access along each path.
993 // Note that we modify the path's Access field to the
994 // friend-modified access.
995 if (BestPath == nullptr || PathAccess < BestPath->Access) {
997 BestPath->Access = PathAccess;
1000 if (BestPath->Access == AS_public)
1007 assert((!BestPath || BestPath->Access != AS_public) &&
1018 /// Given that an entity has protected natural access, check whether
1019 /// access might be denied because of the protected member access
1044 // access.
1048 // access here would grant us access overall.
1066 assert(InstanceContext && "diagnosing dependent access");
1096 /// We are unable to access a given declaration due to its direct
1097 /// access control; diagnose that.
1164 // The natural access so far.
1188 llvm_unreachable("cannot diagnose dependent access");
1194 assert(path.Access != AS_public);
1208 // If the access to this base is worse than the access we have to
1224 llvm_unreachable("cannot diagnose dependent access");
1227 // If this was private inheritance, but we don't have access to
1236 // If we don't have a constraining base, the access failure must be
1326 assert(UnprivilegedAccess != AS_public && "public access not weeded out");
1328 // Before we try to recalculate access paths, try to white-list
1331 // common forms of privileged access.
1336 // *have* to delay immediately here: we can do the full access
1341 // access.
1367 // equivalent to checking the access of a notional public
1384 // Append the declaration's access if applicable.
1390 assert(Path->Access <= UnprivilegedAccess &&
1391 "access along best path worse than direct?");
1392 if (Path->Access == AS_public)
1401 assert(EC.isDependent() && "delaying non-dependent access");
1403 assert(DC->isDependentContext() && "delaying non-dependent access");
1404 DependentDiagnostic::Create(S.Context, DC, DependentDiagnostic::Access,
1414 /// Checks access to an entity from the given effective context.
1419 assert(Entity.getAccess() != AS_public && "called for public access!");
1439 llvm_unreachable("invalid access result");
1444 // If the access path is public, it's accessible everywhere.
1449 // access control checking, because our effective context might be
1470 llvm_unreachable("invalid access result");
1474 // Access control for names used in the declarations of functions
1499 AccessSpecifier Access = DD.getAccess();
1521 DeclAccessPair::make(TargetDecl, Access),
1530 Access);
1550 /// Perform access-control checking on a previously-unresolved member
1551 /// access which has now been resolved to a member.
1572 AccessSpecifier access,
1575 if (access == AS_public || !getLangOpts().AccessControl) return true;
1578 DeclAccessPair::make(decl, access), objectType);
1589 llvm_unreachable("bad access result");
1599 // There's never a path involved when checking implicit destructor access.
1600 AccessSpecifier Access = Dtor->getAccess();
1601 if (Access == AS_public)
1608 DeclAccessPair::make(Dtor, Access),
1615 /// Checks access to a constructor.
1619 AccessSpecifier Access,
1621 if (!getLangOpts().AccessControl || Access == AS_public)
1655 return CheckConstructorAccess(UseLoc, Constructor, Entity, Access, PD);
1658 /// Checks access to a constructor.
1662 AccessSpecifier Access,
1665 Access == AS_public)
1681 DeclAccessPair::make(Constructor, Access),
1688 /// Checks access to an overloaded operator new or delete.
1708 /// \brief Checks access to a member.
1723 /// Checks access to an overloaded member operator, including
1745 /// Checks access to the target of a friend declaration.
1750 // inheritance path modifying access.
1751 AccessSpecifier access = target->getAccess();
1753 if (!getLangOpts().AccessControl || access == AS_public)
1760 DeclAccessPair::make(target, access),
1774 llvm_unreachable("invalid access result");
1795 /// Checks access for a hierarchy conversion.
1797 /// \param ForceCheck true if this check should be performed even if access
1811 if (Path.Access == AS_public)
1819 Path.Access);
1835 /// Checks access to all the declarations in the given result set.
1838 && "performing access check without access control");
1839 assert(R.getNamingClass() && "performing access check without naming class");
1852 /// Checks access to Decl from the given class. The check will take access
1853 /// specifiers into account, but no member access expressions and such.