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

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)