Skip to content
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

[cxx-interop] Determine owning module correctly for C++ decls in nested modules #80130

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

egorzhdan
Copy link
Contributor

This fixes a compiler bug that got exposed by llvm/llvm-project@f11abac.

If a C++ type is declared in a nested Clang submodule, Swift was emitting errors that look like:

Type alias 'string' is not available due to missing import of defining module 'fwd’

rdar://146899125

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Mar 19, 2025
@egorzhdan egorzhdan requested a review from tshortli March 19, 2025 18:17
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@tshortli
Copy link
Contributor

The fix looks good to me but I think a few more test cases would be valuable:

  • the owning submodule is imported explicitly, instead of the top level module
  • a different submodule of the top level module is imported
  • MemberImportVisibility enabled and the referenced decl is a member

@egorzhdan egorzhdan force-pushed the egorzhdan/submodules-name-for-lookup branch from 26fbc95 to 658bcbb Compare March 20, 2025 18:04
@egorzhdan egorzhdan requested a review from susmonteiro as a code owner March 20, 2025 18:04
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

Thanks @tshortli, I added those tests.

…ed modules

This fixes a compiler bug that got exposed by llvm/llvm-project@f11abac.

If a C++ type is declared in a nested Clang submodule, Swift was emitting errors that look like:
```
Type alias 'string' is not available due to missing import of defining module 'fwd’
```

rdar://146899125
@egorzhdan egorzhdan force-pushed the egorzhdan/submodules-name-for-lookup branch from 658bcbb to 106a6af Compare March 20, 2025 19:15
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan merged commit 77ad256 into main Mar 21, 2025
3 checks passed
@egorzhdan egorzhdan deleted the egorzhdan/submodules-name-for-lookup branch March 21, 2025 10:13
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.

4 participants