Skip to content

[cxx-interop] Allow import-as-member for functions declared within a namespace #82579

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 2, 2025

Conversation

egorzhdan
Copy link
Contributor

This makes it possible to use trigger import-as-member for C++ functions declared within namespaces. Previously only functions declared at the file level were supported.

rdar://138930205

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Jun 27, 2025
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan force-pushed the egorzhdan/import-as-member-from-namespace branch from 0efd534 to 9603bd2 Compare June 30, 2025 14:42
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

@swift-ci please test Windows

Copy link
Contributor

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

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

Overall looks good, I have one question about the naming.

@@ -10231,7 +10231,9 @@ ClangImporter::Implementation::importDeclContextOf(

// If the declaration was not global to start with, we're done.
bool isGlobal =
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think this code is a bit confusing. isGlobal to me suggest something like DeclContext::isFileContext. But the fact that we also make this condition dependent on the EffectiveClangContext suggests me that the meaning of this is a bit more elaborate. Should this be something like isRenamedGlobal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Renamed it to isRenamedGlobal.

…namespace

This makes it possible to use trigger import-as-member for C++ functions declared within namespaces. Previously only functions declared at the file level were supported.

rdar://138930205
@egorzhdan egorzhdan force-pushed the egorzhdan/import-as-member-from-namespace branch from 9603bd2 to d3dc17a Compare July 2, 2025 15:40
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan merged commit a18db8f into main Jul 2, 2025
3 checks passed
@egorzhdan egorzhdan deleted the egorzhdan/import-as-member-from-namespace branch July 2, 2025 21:49
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