[cfe-dev] Transform Enum constants in the source to their integral values

Nikola Smiljanic popizdeh at gmail.com
Wed Aug 6 16:44:52 PDT 2014

enum Enum { One, Two };
Enum e = One;

'One' and 'Two' are EnumConstantDecls but 'e' is a VarDecl whose type is
Enum (EnumType).

On Thu, Aug 7, 2014 at 5:37 AM, Manasij Mukherjee <manasij7479 at gmail.com>

> Hi,
> I want to transform a source file so that Enum constants are replaced by
> their respective integral values.
> More specifically, this should work on variable initializations and
> function or template default argument values.
> I can obtain a VarDecl for functions and variables and a
> NonTypeTemplateParmDecl for the templates.
> (By using DeclVisitor)
> How can I detect if these represent Enum Constants ?
> And then get their value, possibly.
> I tried implementing VisitEnumConstantDecl, but that doesn't seem to get
> called for these cases.
> Thanks,
> Manasij Mukherjee
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140807/e675494c/attachment.html>

More information about the cfe-dev mailing list