<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt">On Thu, Nov 15, 2012 at 12:47 AM, Holtgrewe, Manuel <span dir="ltr"><<a href="mailto:manuel.holtgrewe@fu-berlin.de" target="_blank">manuel.holtgrewe@fu-berlin.de</a>></span> wrote:<br>
<div class="gmail_extra"><div class="gmail_quote"><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">Dear all,<br>

<br>
I would like to use the clang infrastructure (libclang, libtooling, ...) to find all references to a function overload or a type in a program. This should also work if the program has templates.<br>
<br>
Consider the following example:<br>
<br>
void f(int i)<br>
{}<br>
<br>
template <typename T><br>
void f(T x)<br>
{<br>
  X<T> y;<br>
}<br>
<br>
template <typename T><br>
struct X<br>
{};<br>
<br>
template <><br>
struct X<long><br>
{};<br>
<br>
main ()<br>
{<br>
  f(3.0);<br>
  f(1);<br>
  f(1l);<br>
<br>
  return 0;<br>
}<br>
<br>
For example, I would like to find all occurences of the overload "void f(int i)" (result should be the line with "f(1)" or all occurences of the specialization "X<long>" (in the line with "X<T> y" when f is called with a long value.<br>

<br>
Is this possible with clang? If so, can anyone point me in the right direction?<br></blockquote><div><br></div><div>Yes. Start here: <a href="http://clang.llvm.org/docs/Tooling.html">http://clang.llvm.org/docs/Tooling.html</a></div>
<div><br></div><div>Cheers,</div><div>/Manuel</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">

<br>
Thanks,<br>
Manuel<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>