[cfe-commits] r119838 - in /cfe/trunk: include/clang/AST/Stmt.h include/clang/Lex/Preprocessor.h include/clang/Parse/Parser.h include/clang/Sema/Sema.h lib/AST/Stmt.cpp lib/Lex/PPMacroExpansion.cpp lib/Parse/ParseStmt.cpp lib/Sema/SemaStmt.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp test/Sema/if-empty-body.c test/SemaCXX/if-empty-body.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Fri Nov 19 18:09:26 PST 2010


On Nov 19, 2010, at 3:27 PM, Argyrios Kyrtzidis wrote:

> On Nov 19, 2010, at 2:30 PM, Abramo Bagnara wrote:
> 
>> Il 19/11/2010 21:54, Argyrios Kyrtzidis ha scritto:
>>> Author: akirtzidis
>>> Date: Fri Nov 19 14:54:25 2010
>>> New Revision: 119838
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=119838&view=rev
>>> Log:
>>> Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:
>>> 
>>> if (condition)
>>>  CALL(0); // empty macro but don't warn for empty body.
>> 
>> Is not this approach way too much ad hoc, is it?
> 
> Currently this is only useful for the 'if' body and was the simplest approach.
> 
>> 
>> What about loop body, else stmt and who knows how many places we might
>> be interested...
>> 
>> Is not better to have the flag in NullStmt or to use another way to
>> detect this situation?
>> 
> 
> What are the use cases you have in mind ? Just checking if a NullStmt was preceded by an empty macro (not caring exactly which one) ?
> I'd prefer not to increase complexity without actual uses.

I implemented a better and more general approach in r119887, where NullStmt has a flag to indicate whether it was preceded by an empty macro.
Thanks for the hint, and let me know what you think.

-Argiris



More information about the cfe-commits mailing list