[cfe-commits] [PATCH][PR11329][v7] Generalize -Wempty-body: warn when statement body is empty

Dmitri Gribenko gribozavr at gmail.com
Wed Jan 18 15:11:37 PST 2012


Hello,

Attached is a patch that implements enhancement proposed in PR11329.

As suggested by Argyrios, this patch implements:
* a stack of "CompoundScopeInfo"s, helper functions to push/pop them,
ActOn{Start,Finish}OfCompoundStatement callbacks;
* a check if the warning is actually enabled before doing costly checks.

Doing this uncovered a bug in TreeTransfom, Sema::ActOnBlockError was
not called in all cases.  This is also fixed.

I've ran a chromium build again and found 3 false positives (-1
because one previously affected file now builds with -Wno-empty-body).

Please review.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generalize-warn-empty-body-v7.patch
Type: text/x-diff
Size: 36355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120119/d4b4c9ad/attachment.patch>


More information about the cfe-commits mailing list