Getting the variable name (IdentifierInfo?) from clang Expr* object of arguments for function calls
-
13-10-2022 - |
Question
I'm trying to get function call sequences using clang's Analyzer framework (With checkers and such).
I wrote a Checker
that uses the checkPreCall
method to handle function calls. I'm trying to look at simple function calls like f(x, y)
, and I want to see the name of the variable I'm passing to the function.
Using the fact that a Expr
is a type of Stmt
, I used the printPretty
function to get the variable name, but obviously if the argument is x+2
or something like that I get x+2
as the output.
Is there a better way to retrieve the name of the variable, or even find out whether it's a simple expression (x
) or a complex one (x+2
)?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow