<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Thanks Eli, you helped me a lot...!!!</span></div><div><br><span></span></div><div><span>One last question, is there any way to find that a</span><span></span></div><div><span>a DeclRefExpr only occurred on the left hand site?</span></div><div><br><span></span></div><div><span>I can overwrite 'VisitBinaryOperator' to see if it occurred<br></span></div><div><span>on the left hand site. But how do I know, that it doesn't occur</span></div><div><span>on the right hand site?</span></div><div><br><span></span></div><div><span>'VisitDeclRefExpr' finds any occurrences...and it looks like '</span><span>DeclRefExpr' doesn't tell</span></div><div><span>me on which site is...<br></span></div><div><span><br></span></div><div><span>Thanks a
 lot!!!!</span></div><div><span>Peter<br></span></div><div><br></div><div><br></div><div><br></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">Von:</span></b> Eli Friedman <eli.friedman@gmail.com><br> <b><span style="font-weight: bold;">An:</span></b> Peter <clang_llvm_123-4@yahoo.de> <br><b><span style="font-weight: bold;">Cc:</span></b> "cfe-dev@cs.uiuc.edu" <cfe-dev@cs.uiuc.edu> <br> <b><span style="font-weight: bold;">Gesendet:</span></b> 21:06 Montag, 19.Dezember 2011<br> <b><span style="font-weight: bold;">Betreff:</span></b> Re: [cfe-dev] Read/Write Accesses of global variables in a Function body...<br> </font> <br>On Mon, Dec 19, 2011 at 11:58 AM, Peter <<a ymailto="mailto:clang_llvm_123-4@yahoo.de"
 href="mailto:clang_llvm_123-4@yahoo.de">clang_llvm_123-4@yahoo.de</a>> wrote:<br>> Thanks a lot Eli,... for your reply...<br>><br>>>having the AST visitor look for assignment operators rather than doing that<br>>> part yourself.<br>> I did everything myself because I wanted to start from a given function...<br>> How do I make sure that my visitor only visits the body of a given function?<br>> Do I<br>> have to implement two different visitors, one that only implements<br>> 'VisitFunctionDecl' to<br>> find the function in question and then once found, call the other visitor<br>> with the function body<br>> to only visit the 'DeclRefExpr' expressions?<br><br>From the docs for RecursiveASTVisitor, it looks like you can override<br>TraverseFunctionDecl to suppress recursion if necessary.<br><br>>>hasLinkage(), or maybe hasGlobalStorage()?<br>> ...hasLinkage is what I was looking for...
 ;)<br>><br>>>If you're just looking for simple assignments,<br>> I guess for the write access I do, but for the read access I need any<br>> occurrence within<br>> the function body. Does that mean I have to implement a visitor method for<br>> any possible rvalue<br>> expression, or is it maybe enough to only visit the 'DeclRefExpr' ?<br><br>Any use of the variable will have an associated DeclRefExpr, so you<br>won't miss any references to the variable.<br><br>-Eli<br><br><br> </div> </div>  </div></body></html>