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

Dmitri Gribenko gribozavr at gmail.com
Wed Jan 25 10:57:14 PST 2012

On Wed, Jan 25, 2012 at 6:22 AM, Argyrios Kyrtzidis <kyrtzidis at apple.com> wrote:
> -Why did you remove "if-empty-body.cpp" ? Did you include all the test cases
> in warn-empty-body.cpp ?


> +class CompoundScopeInfo {
> [...]
> You have a public field and a setter for it. Did you mean to actually make
> the field private so you cannot "unset" it ?

I just copied the design of FunctionScopeInfo (there are three such
HasSomething public fields with setters).  Should I change this?

> +  SmallVector<CompoundScopeInfo *, 4> CompoundScopes;
> Why don't you push CompoundScopes as value objects, to avoid malloc traffic?

Done (new patch attached).

> +  ActOnStartOfCompoundStmt();
>    StmtResult Body = ActOnCompoundStmt(Loc, Loc, move_arg(Statements),
>                                              /*isStmtExpr=*/false);
> +  ActOnFinishOfCompoundStmt();
> How about using a RAII object to make this less error prone,



(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generalize-warn-empty-body-v10.patch
Type: text/x-diff
Size: 33917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120125/49f8e306/attachment.patch>

More information about the cfe-commits mailing list