<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Dmitri,<div><br></div><div>I think you should move the calls to diagnose the empty for and while loop statements out of ActOnCompoundStmt into the <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ActOnWhileStmt and </span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ActOnForStmt</span>. Then, you would only perform the check to see if the following statement is on the same line if the body is actually empty. This would make code cleaner as well.</div><div><br></div><div>Here is one way to implement it (suggestion by Argyrios). You can store a member variable inside Sema to flag if potential warning is diagnosed. When processing the next statement in <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ActOnExprStmt,</span> you can check the identation and make the final decision.</div><div><br></div><div>Minor issues:</div><div><br></div><div>Factor the check for empty loop body into a separate function.</div><div><br></div><div>Indentation is off in several places (I saw this in at least 3 places):</div><div><div>+  if (QuietIfBodyOnSeparateLine)</div><div>+  {</div></div><div>=></div><div><div>+  if (QuietIfBodyOnSeparateLine)  {</div></div><div><br></div><div>Missing space here: if(BodyCol > StmtCol) </div><div><br></div><div>Thanks,</div><div>Anna.</div><div><br></div><div><div><div>On Jan 7, 2012, at 3:05 PM, Dmitri Gribenko wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Thu, Jan 5, 2012 at 9:22 PM, Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>> wrote:<br><blockquote type="cite">Attached is a patch that implements enhancement proposed in PR11329.<br></blockquote><br>*ping*<br><br>Are there any issues with this patch?  Any other cases to include/exclude?<br><br>Dmitri<br><br>-- <br>main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>*/<br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></div></blockquote></div><br></div></body></html>