<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Siraj,<div><br></div><div>What you are seeing is expected - the analyzer processes entrance to the loop 4 times along the execution path. </div><div><br></div><div>What is the check you are trying to write? Is it path-sensitive in nature?</div><div><br></div><div>Cheers,</div><div>Anna.</div><div><br><div><div>On Jun 25, 2013, at 8:10 AM, "Siraj, Tareq A" <<a href="mailto:tareq.a.siraj@intel.com">tareq.a.siraj@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Hello,<br>I am new to the static analyzer codebase and wanted to try out some simple checkers on for loops. I noticed that PreStmt ignores control flow e.g. IfStmt and we should be using check::BranchCondition. I tried using check::BranchCondition on for loops and looks like it calls the checkBranchCondition function 4 times for 1 for loop. So,<br> (1) Is this a bug?<br> (2) Is check::BranchCondition the right checker to use here?<span class="Apple-converted-space"> </span><br><br>Thanks.<br><br>Sample for loop:<br>=============<br>for (int i = 0; i < 10; ++i)<br><br>Calling dump() on the statement in checkBranchCondition() produces:<br>======================================================<br>BinaryOperator 0x476f540 '_Bool' '<'<br>|-ImplicitCastExpr 0x476f528 'int' <LValueToRValue><br>| `-DeclRefExpr 0x476f4e0 'int' lvalue Var 0x476f450 'i' 'int'<br>`-IntegerLiteral 0x476f508 'int' 10<br>BinaryOperator 0x476f540 '_Bool' '<'<br>|-ImplicitCastExpr 0x476f528 'int' <LValueToRValue><br>| `-DeclRefExpr 0x476f4e0 'int' lvalue Var 0x476f450 'i' 'int'<br>`-IntegerLiteral 0x476f508 'int' 10<br>BinaryOperator 0x476f540 '_Bool' '<'<br>|-ImplicitCastExpr 0x476f528 'int' <LValueToRValue><br>| `-DeclRefExpr 0x476f4e0 'int' lvalue Var 0x476f450 'i' 'int'<br>`-IntegerLiteral 0x476f508 'int' 10<br>BinaryOperator 0x476f540 '_Bool' '<'<br>|-ImplicitCastExpr 0x476f528 'int' <LValueToRValue><br>| `-DeclRefExpr 0x476f4e0 'int' lvalue Var 0x476f450 'i' 'int'<br>`-IntegerLiteral 0x476f508 'int' 10<br><br><br>--<br>Tareq A. Siraj<span class="Apple-converted-space"> </span><br><br><br><br><br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a></div></blockquote></div><br></div></body></html>