summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/ast-print.c
diff options
context:
space:
mode:
authorSteven Watanabe <steven@providere-consulting.com>2016-03-18 21:35:59 +0000
committerSteven Watanabe <steven@providere-consulting.com>2016-03-18 21:35:59 +0000
commit9359b8fe5d944c8355ea49ba949d481fe080cec9 (patch)
tree7a71c84630ee4d071b428f63a266d758c91e0fd6 /clang/test/Sema/ast-print.c
parent26628d3015028ad2f4d07acea0acc7168db0e107 (diff)
downloadbcm5719-llvm-9359b8fe5d944c8355ea49ba949d481fe080cec9.tar.gz
bcm5719-llvm-9359b8fe5d944c8355ea49ba949d481fe080cec9.zip
Fix printing of anonymous struct typedefs.
clang -cc1 -ast-print put the struct definition in the wrong place, like this: struct {} typedef S; The reason that this happens is that the printing code first prints the struct definition, and then tells the next declaration to leave out the type. This behavior is correct for simple variable declarations, but fails for typedefs (or extern, mutable, etc). The patch address this problem by skipping the struct declaration when we first see it, and then telling the first subsequent declaration that it needs to print out the full struct definition. Differential Revision: http://reviews.llvm.org/D17285 llvm-svn: 263836
Diffstat (limited to 'clang/test/Sema/ast-print.c')
-rw-r--r--clang/test/Sema/ast-print.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/test/Sema/ast-print.c b/clang/test/Sema/ast-print.c
index b0e421410b2..4c0aef5b2f3 100644
--- a/clang/test/Sema/ast-print.c
+++ b/clang/test/Sema/ast-print.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -ast-print | FileCheck %s
+// RUN: %clang_cc1 %s -ast-print | %clang_cc1 -fsyntax-only -
typedef void func_typedef();
func_typedef xxx;
@@ -39,6 +40,7 @@ int rvarr(int n, int a[restrict static n]) {
return a[2];
}
+// CHECK: typedef struct {
typedef struct {
int f;
} T __attribute__ ((__aligned__));
OpenPOWER on IntegriCloud