Skip to content

[5.10 🍒][Dependency Scanning] Only optionally try to resolve imports of 'Foo.Private' submodules to Foo_Private top-level modules. #68842

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/AST/ModuleDependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ class ModuleDependencyInfo {
// Special case: a submodule named "Foo.Private" can be moved to a top-level
// module named "Foo_Private". ClangImporter has special support for this.
if (submoduleComponent.Item.str() == "Private")
ImportedModuleName = ImportedModuleName + "_Private";
addOptionalModuleImport(ImportedModuleName + "_Private", alreadyAddedModules);
}

addModuleImport(ImportedModuleName, alreadyAddedModules);
Expand Down
1 change: 1 addition & 0 deletions test/ScanDependencies/Inputs/CHeaders/Y.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void funcY(void);
1 change: 1 addition & 0 deletions test/ScanDependencies/Inputs/CHeaders/Y_Private.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void funcYPrivate(void);
7 changes: 7 additions & 0 deletions test/ScanDependencies/Inputs/CHeaders/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ module X_Private {
header "X_Private.h"
export *
}
module Y {
header "Y.h"
export *
explicit module Private {
header "Y_Private.h"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// RUN: %empty-directory(%t.module-cache)
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t.module-cache %s -o %t.deps.json -I %S/Inputs/CHeaders
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t.module-cache %s -o %t.deps.json -I %S/Inputs/CHeaders -verify

// RUN: %validate-json %t.deps.json | %FileCheck %s
// CHECK: "clang": "X_Private"
// CHECK: "clang": "Y"
// CHECK-NOT: "clang": "Y_Private"
import X.Private

import Y.Private