[cfe-dev] Read/Write Accesses of global variables in a Function body...

Peter clang_llvm_123-4 at yahoo.de
Mon Dec 19 11:58:12 PST 2011


Thanks a lot Eli,... for your reply...

>having the AST visitor look for assignment operators rather than doing that part yourself.
I did everything myself because I wanted to start from a given function...
How do I make sure that my visitor only visits the body of a given function? Do I
have to implement two different visitors, one that only implements 'VisitFunctionDecl' to
find the function in question and then once found, call the other visitor with the function body
to only visit the 'DeclRefExpr' expressions?


>hasLinkage(), or maybe hasGlobalStorage()? 
...hasLinkage is what I was looking for... ;)


>If you're just looking for simple assignments,
I guess for the write access I do, but for the read access I need any occurrence within
the function body. Does that mean I have to implement a visitor method for any possible rvalue
expression, or is it maybe enough to only visit the 'DeclRefExpr' ?

Thanks a lot!!!!
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111219/3c5b721f/attachment.html>


More information about the cfe-dev mailing list