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 @@ -525,7 +525,18 @@ class ModuleDependencyInfo {
525
525
// / Add a dependency on the given module, if it was not already in the set.
526
526
void addModuleImport (ImportPath::Module module ,
527
527
llvm::StringSet<> *alreadyAddedModules = nullptr ) {
528
- addModuleImport (module .front ().Item .str (), alreadyAddedModules);
528
+ std::string ImportedModuleName = module .front ().Item .str ().str ();
529
+ auto submodulePath = module .getSubmodulePath ();
530
+ if (submodulePath.size () > 0 && !submodulePath[0 ].Item .empty ()) {
531
+ assert (submodulePath.size () == 1 && " Unsupported Clang submodule import" );
532
+ auto submoduleComponent = submodulePath[0 ];
533
+ // Special case: a submodule named "Foo.Private" can be moved to a top-level
534
+ // module named "Foo_Private". ClangImporter has special support for this.
535
+ if (submoduleComponent.Item .str () == " Private" )
536
+ ImportedModuleName = ImportedModuleName + " _Private" ;
537
+ }
538
+
539
+ addModuleImport (ImportedModuleName, alreadyAddedModules);
529
540
}
530
541
531
542
// / 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 {
42
42
header "X.h"
43
43
export *
44
44
}
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