Thank you. This is exactly what I was looking for. I have a small issue though. I've used a CompilerInvocation and CompilerInstance to set up clang. Then I use parseAST to parse the clang AST. My program can't find standard C++ headers like <string> and <stdio.h>. How do I make clang automatically find system include directories (e.g. /usr/include etc).<div>
<br></div><div>Regards,</div><div>Adil<br><br><div class="gmail_quote">On Fri, Oct 19, 2012 at 10:19 PM, Anna Zaks <span dir="ltr"><<a href="mailto:ganna@apple.com" target="_blank">ganna@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You could search for all DeclRefExprs that refer to the particular variable declaration (by doing an AST walk).<br>
<br>
Note that this will find only syntactic references to a particular variable, but will not trace the data flow. For example,<br>
int x = 0;<br>
int y = x;<br>
use(y); // This will not be a use of x.<br>
<br>
(SSA form just guarantees that there is only a single assignment for each variable.)<br>
<br>
Anna.<br>
On Oct 18, 2012, at 11:21 PM, madil90 <<a href="mailto:madil90@gmail.com">madil90@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
>   I want to use clang to find out all the instances of a variable usage.<br>
> e.g. I want to find out every place where the variable 'x' was used? I know<br>
> that, in theory, this problem can be solved using the SSA form. How can I do<br>
> this in clang?<br>
><br>
> Regards,<br>
> Adil<br>
><br>
><br>
<span class="HOEnZb"><font color="#888888">><br>
> --<br>
> View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/Instances-of-Variable-Usage-SSA-form-tp4027566.html" target="_blank">http://clang-developers.42468.n3.nabble.com/Instances-of-Variable-Usage-SSA-form-tp4027566.html</a><br>

> Sent from the Clang Developers mailing list archive at Nabble.com.<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>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Mohammad Adil<div>LUMS SSE</div><br>
</div>