I'm writing a GCC plugin for GCC 9 and I've got the following problem:
Imagine a simple initialisation:
enum en{ENUM_VAL1, ENUM_VAL2, ...};
int a = ENUM_VAL1;
What I would like it to be able to do is extracting the information that a's value is an enum value defined by the enumeration en.
What I am doing currently is jumping in on the PLUGIN_ON_FINISH_DECL event, giving me the VAR_DECL tree representing this declaration.
Using the macro DECL_INITIAL I am able to to get the value node of this declaration. However, the returned node of this macros is an INTEGER_CST node. I am so far unable to extract from this that this value in fact is an enum value.
Is there any way to do so?