[cfe-dev] Analyser - variadic arguments
Artem Dergachev via cfe-dev
cfe-dev at lists.llvm.org
Thu Jul 28 03:44:46 PDT 2016
Hello Michael,
You can obtain the total number of arguments passed to the call either
from the AST (the CallExpr object represents a particular call
expression, and contains information about number of arguments in this
expression), or from the path-sensitive CallEvent structure. The method
you're looking for is called getNumArgs() in both cases. CallEvent also
contains values of all arguments, which may be concrete (known numbers,
even if they are variables in the AST) or symbolic (if even the
path-sensitive engine cannot determine theirl concrete values).
You can then see the function declaration in the AST (CallEvent's
getDecl() method, which is slightly more accurate than CallExpr's
getDirectCallee(), because it accounts for calling functions through
pointers or calling virtual functions whenever the path-sensitive engine
can help with that), and see which parameters it takes, and how many of
them are non-variadic, and substract.
More information about the cfe-dev
mailing list