I’m trying to write a clang tool that finds all calls to a fucntion with variable args and returns the type of argument.
When I put in a constant enum value, for example:
static void foo(char *, ...) {}
enum test {
TEST_VALUE1,
TEST_VALUE2
};
void main() {
foo("bla", TEST_VALUE1);
}
I get this AST for the argument:
DeclRefExpr 0x55933eb553b8 'int' EnumConstant 0x55933eb53ec0 'TEST_VAL1' 'int'
I see that I could get from this an clang::EnumConstantDecl
object, but I don’t see any where from this to get the type of the enum (enum_test).
Is there any way to do this?