File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -4232,9 +4232,22 @@ void ClangModuleUnit::getImportedModulesForLookup(
4232
4232
for (auto importMod : topLevelImported) {
4233
4233
auto wrapper = owner.getWrapperForModule (importMod);
4234
4234
4235
- auto actualMod = wrapper->getOverlayModule ();
4236
- if (!actualMod || actualMod == topLevelOverlay)
4235
+ ModuleDecl *actualMod = nullptr ;
4236
+ if (owner.SwiftContext .LangOpts .EnableCXXInterop && topLevel &&
4237
+ isCxxStdModule (topLevel) && wrapper->clangModule &&
4238
+ isCxxStdModule (wrapper->clangModule )) {
4239
+ // The CxxStdlib overlay re-exports the clang module std, which in recent
4240
+ // libc++ versions re-exports top-level modules for different std headers
4241
+ // (std_string, std_vector, etc). The overlay module for each of the std
4242
+ // modules is the CxxStdlib module itself. Make sure we return the actual
4243
+ // clang modules (std_xyz) as transitive dependencies instead of just
4244
+ // CxxStdlib itself.
4237
4245
actualMod = wrapper->getParentModule ();
4246
+ } else {
4247
+ actualMod = wrapper->getOverlayModule ();
4248
+ if (!actualMod || actualMod == topLevelOverlay)
4249
+ actualMod = wrapper->getParentModule ();
4250
+ }
4238
4251
4239
4252
assert (actualMod && " Missing imported overlay" );
4240
4253
imports.push_back ({ImportPath::Access (), actualMod});
You can’t perform that action at this time.
0 commit comments