Call `ActOnFields` before late parsing in `ParseStructUnionBody`
In Parser::ParseStructUnionBody, we have a downstream change that calls Actions.ActOnFields before late-parsed attributes are semantically checked (upstream does the opposite). This was intentional to allow offsetof expressions in counted_by attributes to reference the current field and struct.
This divergence means the RecordDecl for the struct containing the counted_by attribute is already marked complete when GetEnclosingNamedOrTopAnonRecord calls isCompleteDefinition() on it, requiring a downstream workaround to account for this. This only manifests when late parsing is enabled.
Upstreaming the ActOnFields ordering change would eliminate the divergence and allow the workaround to be removed.
Once upstreamed, removing the downstream workaround is tracked here: https://github.com/swiftlang/llvm-project/issues/12604
Hi, I would like to try on this.