[cfe-dev] AST for DeclRefExpr of NonTypeTemplateParm
Reid Kleckner via cfe-dev
cfe-dev at lists.llvm.org
Wed Apr 27 10:23:39 PDT 2016
On Wed, Apr 27, 2016 at 10:09 AM, Mikhail Ramalho via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> 1. How can I ignore any non instantiated varDecl?
Check if the variable lives in a dependent DeclContext, something like
> 2. How can I get the instantiated VarDecl? (Actually, the opposite of the
> first question).
> I mean, somewhere there must be a VarDecl with
> a SubstNonTypeTemplateParmExpr, right?
If you instantiate it, then yes, it will be there. Changing the last line
of your program to 'return *A<&B::c>::p;' adds this AST node to the dump:
`-VarDecl 0xcc3f08 parent 0xcc2380 prev 0xcc2698 <line:5:1, col:23> col:19
used p 'const char *' cinit
`-SubstNonTypeTemplateParmExpr 0xcc4110 <col:23> 'const char *'
`-UnaryOperator 0xcc40f0 <col:23> 'const char *' prefix '&'
`-DeclRefExpr 0xcc40c8 <col:23> 'const char' lvalue Var 0xcc20b0 'c'
> 3. Is it possible to generate the AST without any template? I'm only
> interested in the instantiated templates. It seems a long shot, but who
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev