[cfe-dev] Expr walk up? Looking for Enum name not value?
kozargabor at gmail.com
Sat Apr 20 16:16:35 PDT 2013
If I understand your problem correctly, what you need is to look for
typecasts (e.g. ImplicitCast) where the source type is an enum. I actually
do not know how enum values appear in the AST, i.e. whether they are
expanded to their values, but I'm assuming that they are not: in this case
the typecast AST node probably has an EnumConstantDecl as a child
(somewhere below an Expr), which you should be able to find without too
much of an issue, and it will give you the information you need. Try
dumping some example code (using enums) AST to figure out what is it you
exactly need to do.
Also consult the documentation for EnumDecl and EnumConstantDecl types:
Hope this helps!
2013/4/18 steveneliuk <s.eliuk at sisa.samsung.com>
> Hi there,
> There are various implemented visit*() statements in
> and I am looking for a way to obtain the actual enum name before it is
> converted to a value. The value works fine for Source-to-Source translation
> but some have complained because it is not as easy to read. I guess it is a
> MacroID and therefore is not contained in the original source. I can think
> of many laborious ways to obtain this but I know there has to be a built in
> function to obtain the name,
> cl_device_type CL_DEVICE_TYPE_ALL has a value of 4294967295U, but I need
> CL_DEVICE_TYPE_ALL to keep the translation easy to read.
> Any advice would be appreciated!!!
> View this message in context:
> Sent from the Clang Developers mailing list archive at Nabble.com.
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev