Fix printing of types in initializers with suppressed tags.
Tag and specifier printing can be suppressed in Decl::printGroup, but these suppressions leak into the initializers. Thus
int *x = ((void *)0), *y = ((void *)0);
gets printed as
int *x = ((void *)0), *y = ((*)0);
And
struct { struct Z z; } z = {(struct Z){}};
gets printed as
struct { struct Z z; } z = {(){}};
The stops the suppressions from leaking into the initializers.
Patch by Nick Sumner!
Differential Revision: http://reviews.llvm.org/D16438
llvm-svn: 258679
diff --git a/clang/test/Sema/ast-print.c b/clang/test/Sema/ast-print.c
index b4d7684..b0e4214 100644
--- a/clang/test/Sema/ast-print.c
+++ b/clang/test/Sema/ast-print.c
@@ -53,3 +53,13 @@
// CHECK: struct pair_t p = {a: 3, .b = 4};
struct pair_t p = {a: 3, .b = 4};
+
+void initializers() {
+ // CHECK: int *x = ((void *)0), *y = ((void *)0);
+ int *x = ((void *)0), *y = ((void *)0);
+ struct Z{};
+ struct {
+ struct Z z;
+ // CHECK: } z = {(struct Z){}};
+ } z = {(struct Z){}};
+}