<div dir="ltr"><div>Looks to me like everything is in the AST:</div><div><br></div><div>$ cat /tmp/t.cc</div><div>template <typename T> class A {};</div><div>template <typename T> class B {};</div><div>class C : public A<B<int>>{};</div><div><br></div><div>$ clang-query /tmp/t.cc -- -std=c++11<br></div><div><div>clang-query> m cxxRecordDecl()</div><div><br></div><div>Match #1:</div><div><br></div><div>Binding for "root":</div><div>CXXRecordDecl 0x32ec0c0 </tmp/t.cc:1:23, col:32> col:29 class A definition</div><div>`-CXXRecordDecl 0x3339180 <col:23, col:29> col:29 implicit class A</div><div><br></div><div><br></div><div>Match #2:</div><div><br></div><div>Binding for "root":</div><div>CXXRecordDecl 0x3339180 </tmp/t.cc:1:23, col:29> col:29 implicit class A</div><div><br></div><div><br></div><div>Match #3:</div><div><br></div><div>Binding for "root":</div><div>ClassTemplateSpecializationDecl 0x33398f8 </tmp/t.cc:1:1, col:32> col:29 class A definition</div><div>|-TemplateArgument type 'class B<int>'</div><div>`-CXXRecordDecl 0x3339ad8 prev 0x33398f8 <col:23, col:29> col:29 implicit class A</div><div><br></div><div><br></div><div>Match #4:</div><div><br></div><div>Binding for "root":</div><div>CXXRecordDecl 0x3339ad8 prev 0x33398f8 </tmp/t.cc:1:23, col:29> col:29 implicit class A</div><div><br></div><div><br></div><div>Match #5:</div><div><br></div><div>Binding for "root":</div><div>CXXRecordDecl 0x3339290 </tmp/t.cc:2:23, col:32> col:29 class B definition</div><div>`-CXXRecordDecl 0x3339598 <col:23, col:29> col:29 implicit class B</div><div><br></div><div><br></div><div>Match #6:</div><div><br></div><div>Binding for "root":</div><div>CXXRecordDecl 0x3339598 </tmp/t.cc:2:23, col:29> col:29 implicit class B</div><div><br></div><div><br></div><div>Match #7:</div><div><br></div><div>Binding for "root":</div><div>ClassTemplateSpecializationDecl 0x3339750 </tmp/t.cc:2:1, col:32> col:29 class B</div><div>`-TemplateArgument type 'int'</div><div><br></div><div><br></div><div>Match #8:</div><div><br></div><div>Binding for "root":</div><div>CXXRecordDecl 0x3339628 </tmp/t.cc:3:1, col:28> col:7 class C definition</div><div>|-public 'A<B<int> >':'class A<class B<int> >'</div><div>`-CXXRecordDecl 0x3339b98 <col:1, col:7> col:7 implicit class C</div><div><br></div><div><br></div><div>Match #9:</div><div><br></div><div>Binding for "root":</div><div>CXXRecordDecl 0x3339b98 </tmp/t.cc:3:1, col:7> col:7 implicit class C</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 5, 2015 at 2:42 PM Noel Grandin via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
I'm working on the LibreOffice team, and I'm using a clang plugin to do a fairly brute-force analysis looking for unused<br>
methods, using the clang compiler plugin API.<br>
<br>
Mostly this works fairly well. I'm walking the AST and outputting every method definition I see, and every call I see.<br>
<br>
The one shortcoming is that clang does not generate AST nodes for all implicit instantiations of templates.<br>
For example, if I have<br>
template<T> class A {};<br>
template<T> class B {};<br>
class C : public A< B<int> > {};<br>
, it will not generate AST nodes for the B<int> instantiation that occurs in the template parameter.<br>
<br>
Is there a way to make clang do this, or am I simply barking up the wrong tree :-) ?<br>
<br>
Thanks, Noel Grandin.<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>