[Clang importer] Consider attributes on the typedef name for an anonymous tag #42604
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In C, one can provide a typedef name for an anonymous tag declaration in
one shot, e.g.,
In this case, there are effectively two declarations at the C level:
the typedef and the struct. The Clang importer was only taking
attributes from the anonymous struct (i.e., the tag) and not from the
typedef. However, any attributes put before the
typedef
should applyas well... so consider those, too.
For now, only do this for
swift_attr
attributes, because we'reseeing this primarily with
Sendable
annotations. In the future, wecan look to generalizing it, but that could have source-breaking
consequences.
Fixes rdar://91632960.