mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Only optionally try to resolve imports of 'Foo.Private' submodules to 'Foo_Private' top-level modules. Such a module may not actually exist and the user did in fact mean a submodule, in which case we do not want to error out during the scan
This commit is contained in:
@@ -724,7 +724,7 @@ public:
|
||||
// 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);
|
||||
|
||||
1
test/ScanDependencies/Inputs/CHeaders/Y.h
Normal file
1
test/ScanDependencies/Inputs/CHeaders/Y.h
Normal file
@@ -0,0 +1 @@
|
||||
void funcY(void);
|
||||
1
test/ScanDependencies/Inputs/CHeaders/Y_Private.h
Normal file
1
test/ScanDependencies/Inputs/CHeaders/Y_Private.h
Normal file
@@ -0,0 +1 @@
|
||||
void funcYPrivate(void);
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user