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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263836 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/AST/PrettyPrinter.h 6 additions, 5 deletionsinclude/clang/AST/PrettyPrinter.h
- include/clang/AST/Type.h 16 additions, 10 deletionsinclude/clang/AST/Type.h
- lib/AST/DeclPrinter.cpp 8 additions, 9 deletionslib/AST/DeclPrinter.cpp
- lib/AST/TypePrinter.cpp 23 additions, 14 deletionslib/AST/TypePrinter.cpp
- test/Sema/ast-print.c 2 additions, 0 deletionstest/Sema/ast-print.c
Loading
Please register or sign in to comment