[PATCH] Fix printing GNU old-style field designators

Nick Sumner nick.sumner at gmail.com
Tue May 26 19:41:47 PDT 2015


Hi all,

The attached patch allows StmtPrinter to print old style field
designators in initializers. Given the code:
struct A { int b; int c; };
struct A a = {b: 3, .c = 4};

The initializer is presently printed as:
struct A a = {b: = 3, .c = 4};

The combination of ':' and '=' is invalid.

With the patch, the initializer is printed as:
struct A a = {b: 3, .c = 4};

Best,
Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StmtPrinter.patch
Type: text/x-patch
Size: 971 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150526/f447e500/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: initializersTest.c
Type: text/x-csrc
Size: 184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150526/f447e500/attachment.c>


More information about the cfe-commits mailing list