Skip to content

[cxx-interop] Import CF_OPTIONS types such as Foundation.NSTextCheckingType correctly #67301

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 1 commit into from
Jul 14, 2023

Conversation

egorzhdan
Copy link
Contributor

This fixes linker errors which occurred when using Foundation extensions to Swift.String, such as func replacingOccurrences.

After the last rebranch, Clang started wrapping certain types in clang::ElaboratedType. This caused CF_OPTIONS types such as Foundation.NSTextCheckingType to be imported incorrectly in C++ language mode (NSTextCheckingType was imported as uint64_t without getting the special treatment of a CF type), which was causing deserialization errors when Swift tried reading Foundation.swiftmodule. Those deserialization errors were silenced by default. The IR for those functions was not emitted, which caused linker errors later.

rdar://109830032

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Jul 14, 2023
@egorzhdan egorzhdan requested a review from ravikandhadai July 14, 2023 15:47
@egorzhdan egorzhdan requested review from zoecarver and hyp as code owners July 14, 2023 15:47
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

…ingType` correctly

This fixes linker errors which occurred when using Foundation extensions to `Swift.String`, such as `func replacingOccurrences`.

After the last rebranch, Clang started wrapping certain types in `clang::ElaboratedType`. This caused CF_OPTIONS types such as `Foundation.NSTextCheckingType` to be imported incorrectly in C++ language mode (`NSTextCheckingType` was imported as `uint64_t` without getting the special treatment of a CF type), which was causing deserialization errors when Swift tried reading `Foundation.swiftmodule`. Those deserialization errors were silenced by default. The IR for those functions was not emitted, which caused linker errors later.

rdar://109830032
@egorzhdan egorzhdan force-pushed the egorzhdan/foundation-linker-errors branch from 18865cd to e6b830b Compare July 14, 2023 16:52
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan merged commit 9edb752 into main Jul 14, 2023
@egorzhdan egorzhdan deleted the egorzhdan/foundation-linker-errors branch July 14, 2023 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants