CodeQL library for C/C++
codeql/cpp-all 0.12.12-dev (changelog, source)
Search

Member predicate AccessHolder::canAccessMember

Holds if a non-static member member is accessible at this when named in a class derived that is derived from or equal to the declaring class of member (N4140 11.2/5 and 11.4).

This predicate determines whether an expression x.member would be allowed in this when x has type derived. The more general syntax x.N::member, where N may be a base class of derived, is not supported. This should only affect very rare edge cases of 11.4. This predicate concerns only access and thus does not determine whether member can be unambiguously named at this: multiple overloads may apply, or member may be declared in an ambiguous base class.

This predicate is pragma[inline] because it is infeasible to fully compute it on large code bases: all public members member are accessible from everywhere (this), so this predicate could yield a number of tuples that is quadratic in the size of the program. To avoid this combinatorial explosion, only use this predicate in a context where this and member are sufficiently restricted when member is public.

predicate canAccessMember(Declaration member, Class derived)