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] Extend libstdc++ modulemap #59775

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

egorzhdan
Copy link
Contributor

The modulemap needs to include the headers even if they are not supposed to be used directly from Swift:

If a C++ header is being imported into Swift, and the header includes a stdlib header, clang needs to correctly deduce that the stdlib header is a part of the stdlib module, and not a part of the C++ module that we're importing.

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

@swift-ci please smoke test

@egorzhdan egorzhdan force-pushed the egorzhdan/libstdcxx-modulemap branch from dbc37fc to a7d6102 Compare June 29, 2022 14:32
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan closed this Jun 29, 2022
@egorzhdan egorzhdan reopened this Jun 29, 2022
@egorzhdan egorzhdan force-pushed the egorzhdan/libstdcxx-modulemap branch 5 times, most recently from 513d41d to 695d48f Compare July 5, 2022 15:40
@egorzhdan egorzhdan requested a review from zoecarver July 5, 2022 17:56
This fixes a circular dependency between libstdc++ and glibc modules.

Glibc contains multiple include directives like `#include <stdlib.h>`. The problem is that `stdlib.h` is not only a glibc header, it is also a libstdc++ header that forwards to the glibc header. This causes Clang to assume that glibc depends on libstdc++.
@egorzhdan egorzhdan force-pushed the egorzhdan/libstdcxx-modulemap branch 2 times, most recently from 742e7f0 to a926369 Compare July 6, 2022 12:05
The modulemap needs to include the headers even if they are not supposed to be used directly from Swift:

If a C++ header is being imported into Swift, and the header includes a stdlib header, clang needs to correctly deduce that the stdlib header is a part of the stdlib module, and not a part of the C++ module that we're importing.
@egorzhdan egorzhdan force-pushed the egorzhdan/libstdcxx-modulemap branch from a926369 to 49e08af Compare July 6, 2022 12:33
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

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.

None yet

1 participant