<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 27, 2016 at 10:09 AM, Mikhail Ramalho via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>1. How can I ignore any non instantiated varDecl? </div><div></div></div></blockquote><div><br></div><div>Check if the variable lives in a dependent DeclContext, something like 'VD->getDeclContext()->isDependentContext()'.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>2. How can I get the instantiated VarDecl? (Actually, the opposite of the first question).<br></div><div><br></div><div>I mean, somewhere there must be a VarDecl with a SubstNonTypeTemplateParmExpr, right?</div></div></blockquote><div><br></div><div>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:</div><div><br></div><div><div>`-VarDecl 0xcc3f08 parent 0xcc2380 prev 0xcc2698 <line:5:1, col:23> col:19 used p 'const char *' cinit</div><div>  `-SubstNonTypeTemplateParmExpr 0xcc4110 <col:23> 'const char *'</div><div>    `-UnaryOperator 0xcc40f0 <col:23> 'const char *' prefix '&'</div><div>      `-DeclRefExpr 0xcc40c8 <col:23> 'const char' lvalue Var 0xcc20b0 'c' 'const char'</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>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 knows.</div></div></blockquote><div><br></div><div>No.</div></div></div></div>