Getting the enum type of values and the type of a cast via a gcc plugin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am writing a GCC 9 Plugin to extract information about my C++ code. Imagine the following two code snippets:

int i = ENUM_VAL;

int j = static_cast<int>(1.5);

Where ENUM_VAL is a value defined by an enum.

The information I would like to extract via my gcc plugin is the enum type of ENUM_VAL and the type specified in the static_cast (so in this case int).

What I have been trying so far is to latch onto the PRE_GENERICIZE pass to access the AST of functions and then walk through the tree until I arrive at the particular VAR_DECL. However, using the DECL_INITIAL macro on the VAR_DECL representing i and j returns an INTEGER_CST node, not a representing the enum value or the cast. Is there any way to access this information?

Best regards






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux