[cfe-dev] Analyzing the AST for variable usage

Nat! via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 9 13:05:01 PDT 2015


Hi

before I am writing this myself, I just wonder, if this functionality is 
maybe available somewhere (analyzer ?).

I want to know for every AST node, in a function, if any successor nodes 
access a memory area, that has been passed in by a (single) argument.

Or less abstract

---
struct foo
{
    char   space[ 20];
};


extern int  whatever( char *);


void  f( struct foo *p)
{
    char   *q;
    char   tmp[ 10];

    q = &p->space[ 10];
loop:
    whatever( q);
    if( whatever( tmp))
       goto loop;

    // here comes the first node, that does not touch p space

    whatever( tmp);
}
---


Ciao
    Nat!

P.S. For my purposes it's really better do this on clang level than on 
llvm level.




More information about the cfe-dev mailing list