<div dir="ltr">Hi Reid,<div><br></div><div>Thank you for the fast answer! I was struggling with this for a couple of days already! I was already checking <span style="font-size:12.8px">isDependentContext() for functions and methods, but completely forgot about that on VarDecls!</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks again,</span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-04-27 18:23 GMT+01:00 Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">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" target="_blank">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></span><div>Check if the variable lives in a dependent DeclContext, something like 'VD->getDeclContext()->isDependentContext()'.</div><span class=""><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></span><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><span class=""><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></span><div>No.</div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div>
</div>