Call `ActOnFields` before late parsing in `ParseStructUnionBody`
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
Assessment
This issue has not been assessed yet.