[cfe-dev] Analyzing the AST for variable usage
Vedant Kumar via cfe-dev
cfe-dev at lists.llvm.org
Wed Sep 9 15:14:00 PDT 2015
I'm not sure something like this exists. If I were to try it, I'd start by writing a llvm::FunctionPass which uses the alias analyzer. There's some documentation on this here:
In your example, it seems like you'd like to check if any loads/stores in your function may alias with 'p'.
> On Sep 9, 2015, at 1:05 PM, Nat! via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 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];
> whatever( q);
> if( whatever( tmp))
> goto loop;
> // here comes the first node, that does not touch p space
> whatever( tmp);
> P.S. For my purposes it's really better do this on clang level than on llvm level.
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
More information about the cfe-dev