[cfe-dev] Instances of Variable Usage (SSA form)

Anna Zaks ganna at apple.com
Fri Oct 19 10:19:06 PDT 2012


You could search for all DeclRefExprs that refer to the particular variable declaration (by doing an AST walk).

Note that this will find only syntactic references to a particular variable, but will not trace the data flow. For example,
int x = 0;
int y = x;
use(y); // This will not be a use of x.

(SSA form just guarantees that there is only a single assignment for each variable.)

Anna.
On Oct 18, 2012, at 11:21 PM, madil90 <madil90 at gmail.com> wrote:

> Hi,
>   I want to use clang to find out all the instances of a variable usage.
> e.g. I want to find out every place where the variable 'x' was used? I know
> that, in theory, this problem can be solved using the SSA form. How can I do
> this in clang?
> 
> Regards,
> Adil
> 
> 
> 
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/Instances-of-Variable-Usage-SSA-form-tp4027566.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list