[PATCH] D17285: Fix printing of anonymous struct typedefs

Steven Watanabe via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 15 18:14:25 PST 2016


steven_watanabe created this revision.
steven_watanabe added reviewers: rsmith, eli.friedman.
steven_watanabe added a subscriber: cfe-commits.

    Currently clang -cc1 -ast-print puts 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.  The current 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.


http://reviews.llvm.org/D17285

Files:
  include/clang/AST/PrettyPrinter.h
  include/clang/AST/Type.h
  lib/AST/DeclPrinter.cpp
  lib/AST/TypePrinter.cpp
  test/Sema/ast-print.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17285.48042.patch
Type: text/x-patch
Size: 9241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160216/a99928a7/attachment-0001.bin>


More information about the cfe-commits mailing list