Skip to content

Commit 02075d7

Browse files
committed
ExplicitModule: remove all search paths for command lines to explicitly build Swift textual interface
1 parent 2840f4f commit 02075d7

File tree

2 files changed

+8
-31
lines changed

2 files changed

+8
-31
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,28 +1137,14 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
11371137
.EffectiveLanguageVersion.asAPINotesVersionString()));
11381138

11391139
genericSubInvocation.setImportSearchPaths(SearchPathOpts.ImportSearchPaths);
1140-
llvm::for_each(SearchPathOpts.ImportSearchPaths,
1141-
[&](const std::string &path) {
1142-
GenericArgs.push_back("-I");
1143-
GenericArgs.push_back(path);
1144-
});
11451140
genericSubInvocation.setFrameworkSearchPaths(SearchPathOpts.FrameworkSearchPaths);
1146-
llvm::for_each(SearchPathOpts.FrameworkSearchPaths,
1147-
[&](const SearchPathOptions::FrameworkSearchPath &path) {
1148-
GenericArgs.push_back(path.IsSystem? "-Fsystem": "-F");
1149-
GenericArgs.push_back(path.Path);
1150-
});
11511141
if (!SearchPathOpts.SDKPath.empty()) {
11521142
genericSubInvocation.setSDKPath(SearchPathOpts.SDKPath);
1153-
GenericArgs.push_back("-sdk");
1154-
GenericArgs.push_back(SearchPathOpts.SDKPath);
11551143
}
11561144

11571145
genericSubInvocation.setInputKind(InputFileKind::SwiftModuleInterface);
11581146
if (!SearchPathOpts.RuntimeResourcePath.empty()) {
11591147
genericSubInvocation.setRuntimeResourcePath(SearchPathOpts.RuntimeResourcePath);
1160-
GenericArgs.push_back("-resource-dir");
1161-
GenericArgs.push_back(SearchPathOpts.RuntimeResourcePath);
11621148
}
11631149

11641150
// Inhibit warnings from the genericSubInvocation since we are assuming the user
@@ -1276,14 +1262,10 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
12761262
SubFEOpts.RequestedAction = FrontendOptions::ActionType::EmitModuleOnly;
12771263
if (!moduleCachePath.empty()) {
12781264
genericSubInvocation.setClangModuleCachePath(moduleCachePath);
1279-
GenericArgs.push_back("-module-cache-path");
1280-
GenericArgs.push_back(moduleCachePath);
12811265
}
12821266
if (!prebuiltCachePath.empty()) {
12831267
genericSubInvocation.getFrontendOptions().PrebuiltModuleCachePath =
1284-
prebuiltCachePath.str();
1285-
GenericArgs.push_back("-prebuilt-module-cache-path");
1286-
GenericArgs.push_back(prebuiltCachePath);
1268+
prebuiltCachePath.str();
12871269
}
12881270
if (trackSystemDependencies) {
12891271
genericSubInvocation.getFrontendOptions().IntermoduleDependencyTracking =
@@ -1300,22 +1282,11 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
13001282
}
13011283
genericSubInvocation.getSearchPathOptions().ExplicitSwiftModules =
13021284
searchPathOpts.ExplicitSwiftModules;
1303-
// Dependencies scanner shouldn't know any explict Swift modules to use.
1304-
// Adding these argumnets may not be necessary.
1305-
// FIXME: remove it?
1306-
for (auto EM: searchPathOpts.ExplicitSwiftModules) {
1307-
GenericArgs.push_back("-swift-module-file");
1308-
GenericArgs.push_back(ArgSaver.save(EM));
1309-
}
13101285
// Pass down -explicit-swift-module-map-file
13111286
// FIXME: we shouldn't need this. Remove it?
13121287
StringRef explictSwiftModuleMap = searchPathOpts.ExplicitSwiftModuleMap;
13131288
genericSubInvocation.getSearchPathOptions().ExplicitSwiftModuleMap =
13141289
explictSwiftModuleMap;
1315-
if (!explictSwiftModuleMap.empty()) {
1316-
GenericArgs.push_back("-explicit-swift-module-map-file");
1317-
GenericArgs.push_back(explictSwiftModuleMap);
1318-
}
13191290
if (clangImporter) {
13201291
// We need to add these extra clang flags because explict module building
13211292
// related flags are all there: -fno-implicit-modules, -fmodule-map-file=,

test/ScanDependencies/module_deps.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// Check the contents of the JSON output
66
// RUN: %FileCheck %s < %t/deps.json
77

8+
// Check the contents of the JSON output
9+
// RUN: %FileCheck %s -check-prefix CHECK-NO-SEARCH-PATHS < %t/deps.json
10+
811
// Check the make-style dependencies file
912
// RUN: %FileCheck %s -check-prefix CHECK-MAKE-DEPS < %t/deps.d
1013

@@ -133,7 +136,6 @@ import SubE
133136
// CHECK: "commandLine": [
134137
// CHECK: "-compile-module-from-interface"
135138
// CHECK: "-target"
136-
// CHECK: "-sdk"
137139
// CHECK: "-module-name"
138140
// CHECK: "G"
139141
// CHECK: "-swift-version"
@@ -193,6 +195,10 @@ import SubE
193195
/// --------Clang module SwiftShims
194196
// CHECK-LABEL: "modulePath": "SwiftShims.pcm",
195197

198+
// CHECK-NO-SEARCH-PATHS-NOT: "-I"
199+
// CHECK-NO-SEARCH-PATHS-NOT: "-sdk"
200+
// CHECK-NO-SEARCH-PATHS-NOT: "-F"
201+
// CHECK-NO-SEARCH-PATHS-NOT: "-prebuilt-module-cache-path"
196202

197203
// Check make-style dependencies
198204
// CHECK-MAKE-DEPS: module_deps.swift

0 commit comments

Comments
 (0)