This is an archive of the discontinued LLVM Phabricator instance.

Fix printing of anonymous struct typedefs
ClosedPublic

Authored by steven_watanabe on Feb 15 2016, 6:14 PM.

Details

Summary

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.

Diff Detail

Event Timeline

steven_watanabe retitled this revision from to Fix printing of anonymous struct typedefs.
steven_watanabe updated this object.
steven_watanabe added a subscriber: cfe-commits.
rsmith accepted this revision.Mar 18 2016, 11:43 AM
rsmith edited edge metadata.
This revision is now accepted and ready to land.Mar 18 2016, 11:43 AM
This revision was automatically updated to reflect the committed changes.