<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Oct 5, 2015 at 3:27 PM Noel Grandin <<a href="mailto:noelgrandin@gmail.com">noelgrandin@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Manuel<br>
<br>
That was a bad example, this is a better one (dramatically simplified from my actual code).<br>
I can't seem to use clang-query here (I have 3.6), but dumping the AST shows my problem.<br></blockquote><div><br></div><div>Note that the AST dump doesn't contain all nodes.</div><div>In this case, it is correct though. The problem is that the method is not actually instantiated. You'll need to reference it in order for it to actually get instantiated.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Specifically, in the below code, when I traverse the AST, there is no way to see that a call to doRegisterHandlers() is<br>
in fact being generated.<br>
<br>
The relevant section of AST looks like:<br>
CallExpr 0x328d958 <line:15:9, col:42> '<dependent type>'<br>
| | | | |-CXXDependentScopeMemberExpr 0x328d8d8 <col:9, col:15> '<dependent type>' lvalue<br>
| | | | | `-CXXThisExpr 0x328d8c0 <col:9> 'ImportFilterImpl<Generator> *' this<br>
| | | | `-DeclRefExpr 0x328d930 <col:34> 'Generator' lvalue Var 0x328d850 'exporter' 'Generator'<br>
<br>
<br>
Now I know that clang is doing the right thing here, but I'm hoping there is a way I can tell it to "expand out" and<br>
generate more AST nodes when I hit a template instantiation?<br>
<br>
Thanks a lot for the help!<br>
<br>
Regards, Noel.<br>
<br>
<br>
--------------------------------------<br>
<br>
class XFilter<br>
{<br>
public:<br>
virtual bool filter() = 0;<br>
};<br>
<br>
template<class Generator><br>
class ImportFilterImpl : public XFilter<br>
{<br>
public:<br>
virtual bool filter() override<br>
{<br>
Generator exporter;<br>
this->doRegisterHandlers(exporter);<br>
}<br>
<br>
private:<br>
virtual void doRegisterHandlers(Generator &) {};<br>
};<br>
<br>
<br>
template<class T><br>
class ImplInheritanceHelper : public T<br>
{};<br>
<br>
template<class Generator><br>
struct ImportFilter : public ImplInheritanceHelper<ImportFilterImpl<Generator> ><br>
{<br>
};<br>
<br>
class MyGenerator {};<br>
<br>
class MainClass : public ImportFilter<MyGenerator><br>
{};<br>
</blockquote></div></div>