CodeQL library for C/C++
Search

Member predicate Call::passesByReference

Holds if this call passes the variable accessed by va by reference as the ith argument. The qualifier of a call to a member function is i = -1.

A variable is passed by reference if the ith parameter of the function receives an address that points within the object denoted by va. For a variable named x, passing by reference includes both explicit pointers (&x) and implicit conversion to a C++ reference (x), but it also includes deeper expressions such as &x[0] + length or &*&*&x.

When Fields are involved, an argument i may pass more than one variable by reference simultaneously. For example, the call f(&x.m1.m2) counts as passing both x, m1 and m2 to argument 0 of f.

This predicate holds for variables passed by reference even if they are passed as references to const and thus cannot be changed through that reference. See passesByNonConstReference for a predicate that only holds for variables passed by reference to non-const.

predicate passesByReference(int i, VariableAccess va)