[cfe-commits] r63242 - in /cfe/trunk: Driver/RewriteObjC.cpp include/clang/AST/Decl.h include/clang/AST/Expr.h include/clang/AST/ExprCXX.h include/clang/Basic/DiagnosticSemaKinds.def lib/AST/Expr.cpp lib/AST/StmtPrinter.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CGExprScalar.cpp lib/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaInit.cpp test/Sema/array-init.c test/Sema/designated-initializers.c test/Sema/vector-init.c

Douglas Gregor dgregor at apple.com
Thu Jan 29 08:09:36 PST 2009


On Jan 28, 2009, at 11:00 PM, Chris Lattner wrote:

>
> On Jan 28, 2009, at 1:54 PM, Douglas Gregor wrote:
>
>> Author: dgregor
>> Date: Wed Jan 28 15:54:33 2009
>> New Revision: 63242
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=63242&view=rev
>> Log:
>> Code generation support for C99 designated initializers.
>>
>> The approach I've taken in this patch is relatively straightforward,
>> although the code itself is non-trivial. Essentially, as we process
>> an initializer list we build up a fully-explicit representation of  
>> the
>> initializer list, where each of the subobject initializations occurs
>> in order. Designators serve to "fill in" subobject initializations in
>> a non-linear way. The fully-explicit representation makes initializer
>> lists (both with and without designators) easy to grok for codegen  
>> and
>> later semantic analyses. We keep the syntactic form of the  
>> initializer
>> list linked into the AST for those clients interested in exactly what
>> the user wrote.
>>
>> Known limitations:
>> - Designating a member of a union that isn't the first member may
>>   result in bogus initialization (we warn about this)
>> - GNU array-range designators are not supported (we warn about this)
>
> Very nice Doug, please make these errors though.  Some code bases  
> build with many warnings, so this can be easy to miss.  Thanks for  
> working on this!


FWIW, follow-on patches (one still to-be-finished) get this down to  
only a very minor difference that we warn about (different behavior  
when GNU array-range designated initializers have side effects).

   - Doug



More information about the cfe-commits mailing list