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) {
602 /// A helper class for checking for a friend which will grant access
640 /// the final class in the path would have access in that class.
656 // base will not have any access in classes derived from Cur.
698 /// NamingClass would have some natural access in P, which implicitly
703 /// would have to have some natural access in P, it says the actual
704 /// target has to have some natural access in P, which opens up the
710 /// access a forbidden base class's members by directly subclassing
712 /// - It also makes access substantially harder to compute because it
740 AccessSpecifier Access,
745 if (Access == AS_public) return AR_accessible;
746 assert(Access == AS_private || Access == AS_protected);
757 if (Access == AS_private) {
766 assert(Access == AS_protected);
774 // An additional access check beyond those described earlier in
775 // [class.access] is applied when a non-static data member or
777 // class. As described earlier, access to a protected member is
779 // some class C. If the access is to form a pointer to member,
807 // pointer-to-member expression nor in a member access: when
844 // access if the access occurs in a friend or member of some class P
846 // access in P. The 'member' aspect is easy to handle because P
853 if (Access == AS_protected && Target.isInstanceMember()) {
882 /// C++0x [class.access.base]p5:
894 /// C++0x [class.access.base]p4:
910 /// access equivalent to the member's access. Therefore we need only
915 /// B_i). For i in 1..n, we will calculate ACAB(i), the access to the
917 /// Access(a, b) = (* access on the base specifier from a to b *)
927 /// let AccessToBase = Merge(Access(B_i, B_{i+1}), ACAB(i+1)) in
932 /// \param FinalAccess the access of the "final step", or AS_public if
952 assert(FinalAccess != AS_none && "forbidden access after declaring class");
956 // Derive the friend-modified access along each path.
997 // Note that we modify the path's Access field to the
998 // friend-modified access.
999 if (BestPath == 0 || PathAccess < BestPath->Access) {
1001 BestPath->Access = PathAccess;
1004 if (BestPath->Access == AS_public)
1011 assert((!BestPath || BestPath->Access != AS_public) &&
1022 /// Given that an entity has protected natural access, check whether
1023 /// access might be denied because of the protected member access
1048 // access.
1052 // access here would grant us access overall.
1070 assert(InstanceContext && "diagnosing dependent access");
1100 /// We are unable to access a given declaration due to its direct
1101 /// access control; diagnose that.
1170 // The natural access so far.
1194 llvm_unreachable("cannot diagnose dependent access");
1200 assert(path.Access != AS_public);
1214 // If the access to this base is worse than the access we have to
1230 llvm_unreachable("cannot diagnose dependent access");
1233 // If this was private inheritance, but we don't have access to
1242 // If we don't have a constraining base, the access failure must be
1331 assert(UnprivilegedAccess != AS_public && "public access not weeded out");
1333 // Before we try to recalculate access paths, try to white-list
1336 // common forms of privileged access.
1341 // *have* to delay immediately here: we can do the full access
1346 // access.
1372 // equivalent to checking the access of a notional public
1389 // Append the declaration's access if applicable.
1395 assert(Path->Access <= UnprivilegedAccess &&
1396 "access along best path worse than direct?");
1397 if (Path->Access == AS_public)
1406 assert(EC.isDependent() && "delaying non-dependent access");
1408 assert(DC->isDependentContext() && "delaying non-dependent access");
1409 DependentDiagnostic::Create(S.Context, DC, DependentDiagnostic::Access,
1419 /// Checks access to an entity from the given effective context.
1424 assert(Entity.getAccess() != AS_public && "called for public access!");
1445 llvm_unreachable("invalid access result");
1450 // If the access path is public, it's accessible everywhere.
1455 // access control checking, because our effective context might be
1480 // Access control for names used in the declarations of functions
1504 AccessSpecifier Access = DD.getAccess();
1526 DeclAccessPair::make(TargetDecl, Access),
1535 Access);
1555 /// Perform access-control checking on a previously-unresolved member
1556 /// access which has now been resolved to a member.
1577 AccessSpecifier access,
1580 if (access == AS_public || !getLangOpts().AccessControl) return true;
1583 DeclAccessPair::make(decl, access), objectType);
1594 llvm_unreachable("bad access result");
1604 // There's never a path involved when checking implicit destructor access.
1605 AccessSpecifier Access = Dtor->getAccess();
1606 if (Access == AS_public)
1613 DeclAccessPair::make(Dtor, Access),
1620 /// Checks access to a constructor.
1624 AccessSpecifier Access,
1626 if (!getLangOpts().AccessControl || Access == AS_public)
1660 return CheckConstructorAccess(UseLoc, Constructor, Entity, Access, PD);
1663 /// Checks access to a constructor.
1667 AccessSpecifier Access,
1670 Access == AS_public)
1686 DeclAccessPair::make(Constructor, Access),
1693 /// Checks access to an overloaded operator new or delete.
1713 /// \brief Checks access to a member.
1728 /// Checks access to an overloaded member operator, including
1750 /// Checks access to the target of a friend declaration.
1758 // inheritance path modifying access.
1759 AccessSpecifier access = target->getAccess();
1761 if (!getLangOpts().AccessControl || access == AS_public)
1772 DeclAccessPair::make(target, access),
1806 /// Checks access for a hierarchy conversion.
1808 /// \param ForceCheck true if this check should be performed even if access
1822 if (Path.Access == AS_public)
1830 Path.Access);
1846 /// Checks access to all the declarations in the given result set.
1849 && "performing access check without access control");
1850 assert(R.getNamingClass() && "performing access check without naming class");
1863 /// Checks access to Decl from the given class. The check will take access
1864 /// specifiers into account, but no member access expressions and such.