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

Predicate VirtualDispatch::getAViableTarget

Gets a viable target for the given function call.

If c is a virtual call, then we will perform a simple virtual dispatch analysis to return the Function instances which might be a viable target, based on an analysis of the declared type of the qualifier expression.

(This analysis is imprecise: it looks for subtypes of the declared type of the qualifier expression and the possible implementations of c.getTarget() that are declared or inherited by those subtypes. This does not account for virtual inheritance and the ways this affects dispatch.)

If c is not a virtual call, the result will be c.getTarget().

Import path

import semmle.code.cpp.dispatch.VirtualDispatchPrototype
Function getAViableTarget(Call c)