Skip to content

[ClangImporter] Account for synthesized types when filtering by module #19991

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
Oct 23, 2018

Conversation

jrose-apple
Copy link
Contributor

We treat redeclarable Clang declarations as present in every module where they're declared, except for struct/enum/union declarations where we only count full definitions. This logic requires going from the imported Swift declaration back to the Clang declaration, something that's not really possible for "synthesized declarations" today. The only top-level synthesized declarations we have right now are the structs we make to wrap error code enums.

The 100% correct thing to do would be to account for people defining error code enums consistently across multiple modules. In practice, though, error code enums are used with Objective-C (the importer's treatment of them is tied to NSError), where redefining existing types is very unusual. Therefore, this fix just ignores redeclarations of error code enums, whether they're definitions or not.

rdar://problem/45414271

We treat redeclarable Clang declarations as present in every module
where they're declared, except for struct/enum/union declarations
where we only count full definitions. This logic requires going from
the imported Swift declaration back to the Clang declaration,
something that's not really possible for "synthesized declarations"
today. The only top-level synthesized declarations we have right now
are the structs we make to wrap error code enums.

The 100% correct thing to do would be to account for people defining
error code enums consistently across multiple modules. In practice,
though, error code enums are used with Objective-C (the importer's
treatment of them is tied to NSError), where redefining existing types
is very unusual. Therefore, this fix just ignores redeclarations of
error code enums, whether they're definitions or not.

rdar://problem/45414271
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jrose-apple jrose-apple merged commit 1b847f3 into swiftlang:master Oct 23, 2018
@jrose-apple jrose-apple deleted the oh-node-you-didnt branch October 23, 2018 17:23
@DougGregor
Copy link
Member

The Reactive(Cocoa|Swift) failures are not due to this PR.

jrose-apple added a commit to jrose-apple/swift that referenced this pull request Oct 23, 2018
[ClangImporter] Account for synthesized types when filtering by module

(cherry picked from commit 1b847f3)
jrose-apple added a commit that referenced this pull request Oct 23, 2018
[ClangImporter] Account for synthesized types when filtering by module

(cherry picked from commit 1b847f3)
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.

3 participants