<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Aug 16, 2011, at 5:17 PM, Caitlin Sadowski wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Ted,<br><br>Ok, that makes sense.<br><br>Here is my impression: For example,if I want to be sure to visit each<br>DeclRefExpr inside of a CFGBlock, I can just iterate over the CFGStmts<br>making up the block and use the (nonrecursive) StmtVisitor to visit<br>DeclRefExprs (as in the code above). Is this true, or are there any<br>corner cases I should be concerned about? I am a bit confused by the<br>"AlwaysAdd" vs. "NotAlwaysAdd" enum in AddStmtChoice in CFG.cpp.<br></span></blockquote></div><div><br></div><div>Ah, good point.  You have flexibility in how the CFG is constructed.</div><div><br></div><div>For the static analyzer, we currently linearize all expressions/statements for the constructed CFG.  That's what I was referring to before.</div><div><br></div><div>For the compiler warnings, we only put in a limited subset of the expressions into the CFG, because the current analyses in the frontend  (e.g., -Wuninitialized) only look at some of the expressions, thus putting all expressions in the CFG would make those analyses a bit slower.  DeclRefExprs happen to be one of them that is always in the CFG in both cases.</div><div><br></div><div>So, yes, you just need to iterate over CFGStmts in the CFG to find all DeclRefExprs.  You don't even need a StmtVisitor.  Just use a dyn_cast<> on the Stmt*.</div></body></html>