Skip to content

[Clang importer] Import Clang swift_attr attribute. #35327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 9, 2021

Conversation

DougGregor
Copy link
Member

The Clang swift_attr attribute allows C code to describe, via a Clang
attribute, the Swift attributes that should be applied to the given
declaration. When an

__attribute__((__swift_attr__("@tribute")))

occurs on a Clang declaration, parse the attribute within the string
literal as a Swift attribute, then attach that to the imported Swift
declaration.

Fixes rdar://70146633.

The Clang swift_attr attribute allows C code to describe, via a Clang
attribute, the Swift attributes that should be applied to the given
declaration. When an

    __attribute__((__swift_attr__("@tribute")))

occurs on a Clang declaration, parse the attribute within the string
literal as a Swift attribute, then attach that to the imported Swift
declaration.

Fixes rdar://70146633.
Our name lookup rules for the resolution of custom attributes don't
allow for them to find MainActor within the _Concurrency library.
Therefore, hardcode @mainactor to map to _Concurrency.MainActor.

While here, make sure we drop concurrency-specific attributes that
show up in Clang attributes when we aren't in concurrency mode.
@DougGregor
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jan 9, 2021

Build failed
Swift Test Linux Platform
Git Sha - 8c123e8

@swift-ci
Copy link
Contributor

swift-ci commented Jan 9, 2021

Build failed
Swift Test OS X Platform
Git Sha - 8c123e8

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@DougGregor DougGregor merged commit 38d5ed3 into swiftlang:main Jan 9, 2021
@DougGregor DougGregor deleted the import-clang-swift-attrs branch January 11, 2021 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants