[PATCH] Fix printing of C style casts with suppressed specifiers

Nick Sumner nick.sumner at gmail.com
Sun May 31 02:20:41 PDT 2015


Hi all,

The attached patch allows C style casts to be printed correctly even
when the incoming PrintingPolicy suppresses specifiers. This can
happen, for instance, when casts occur during the initialization of
variables inside a DeclGroup. Given the code:
void foo() {
  int *x = ((void *)0), *y = ((void *)0);
}

The casts are printed as:
int *x = ((void *)0), *y = ((*)0);

Note that the second cast lacks 'void' because specifiers are
suppressed when printing members of the declgroup (after the first).

With the patch, the casts are printed as:
int *x = ((void *)0), *y = ((void *)0);

Best,
Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: castTypeSuppression.patch
Type: text/x-patch
Size: 916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150531/1c90a551/attachment.bin>


More information about the cfe-commits mailing list