[cfe-commits] r62737 - in /cfe/trunk: include/clang/AST/Expr.h include/clang/AST/StmtNodes.def include/clang/Basic/DiagnosticKinds.def include/clang/Parse/Action.h include/clang/Parse/Designator.h lib/AST/Expr.cpp lib/AST/StmtPrinter.cpp lib/Pars

Douglas Gregor dgregor at apple.com
Wed Jan 21 20:54:28 PST 2009


On Jan 21, 2009, at 8:12 PM, Eli Friedman wrote:

> On Wed, Jan 21, 2009 at 4:58 PM, Douglas Gregor <dgregor at apple.com>  
> wrote:
>> Author: dgregor
>> Date: Wed Jan 21 18:58:24 2009
>> New Revision: 62737
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=62737&view=rev
>> Log:
>> Initial implementation of semantic analysis and ASTs for C99
>> designated initializers. This implementation should cover all of the
>> constraints in C99 6.7.8, including long, complex designations and
>> computing the size of incomplete array types initialized with a
>> designated initializer. Please see the new test-case and holler if  
>> you
>> find cases where this doesn't work.
>
> Nice start!  It looks like there's still a lot of work to do, though.
>
> One simple case that doesn't work:
> struct {int x,*y;} z[] = {[0].x = 2, &z[0].x};
> I think this indicates a rather serious error in the way you're doing
> the recursion.

Interesting. It indicates a misunderstanding on my part regarding what  
"current object" means following a designated initializer.   Thanks  
for the illustrative example; I'll look into it tomorrow.

> Do you have any thoughts on how to implement CodeGen without
> duplicating all the designator logic?

I'm not sure; we'll probably have Sema build some kind of easy-to-grok  
initializer list that puts everything in place, which CodeGen can then  
use rather than try to sort through the DesignatedInitExprs itself.

	- Doug



More information about the cfe-commits mailing list