File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed
Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -543,7 +543,18 @@ class ModuleDependencyInfo {
543543 // / Add a dependency on the given module, if it was not already in the set.
544544 void addModuleImport (ImportPath::Module module ,
545545 llvm::StringSet<> *alreadyAddedModules = nullptr ) {
546- addModuleImport (module .front ().Item .str (), alreadyAddedModules);
546+ std::string ImportedModuleName = module .front ().Item .str ().str ();
547+ auto submodulePath = module .getSubmodulePath ();
548+ if (submodulePath.size () > 0 && !submodulePath[0 ].Item .empty ()) {
549+ assert (submodulePath.size () == 1 && " Unsupported Clang submodule import" );
550+ auto submoduleComponent = submodulePath[0 ];
551+ // Special case: a submodule named "Foo.Private" can be moved to a top-level
552+ // module named "Foo_Private". ClangImporter has special support for this.
553+ if (submoduleComponent.Item .str () == " Private" )
554+ ImportedModuleName = ImportedModuleName + " _Private" ;
555+ }
556+
557+ addModuleImport (ImportedModuleName, alreadyAddedModules);
547558 }
548559
549560 // / Add all of the module imports in the given source
Original file line number Diff line number Diff line change 1+ void funcXPrivate (void );
Original file line number Diff line number Diff line change @@ -42,3 +42,7 @@ module X {
4242 header "X.h"
4343 export *
4444}
45+ module X_Private {
46+ header "X_Private.h"
47+ export *
48+ }
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t.module-cache)
2+ // RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t.module-cache %s -o %t.deps.json -I %S/Inputs/CHeaders
3+
4+ // RUN: %FileCheck %s < %t.deps.json
5+ // CHECK: "clang": "X_Private"
6+ import X. Private
7+
You can’t perform that action at this time.
0 commit comments