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

Member predicate Call::passesByReferenceNonConst

Holds if this call passes the variable accessed by va by reference to non-const data 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 only holds for variables passed by reference to non-const data and thus can be changed through that reference. See passesByReference for a predicate that also holds for variables passed by reference to const.

predicate passesByReferenceNonConst(int i, VariableAccess va)