Skip to content

Commit ea58ef8

Browse files
[ClangImporter] Simply clang-importer creation flags
Currently, `-direct-clang-cc1-module-build` and `-only-use-extra-clang-opts` have to be passed together for clang importer creation to succeed. Missing either will result in error. Simplified the swift-frontend flags by removing `-only-use-extra-clang-opts` and let `-direct-clang-cc1-module-build` to do both.
1 parent 7698d36 commit ea58ef8

File tree

7 files changed

+3
-19
lines changed

7 files changed

+3
-19
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -960,10 +960,6 @@ namespace swift {
960960
/// DWARFImporter delegate.
961961
bool DisableSourceImport = false;
962962

963-
/// When set, use ExtraArgs alone to configure clang instance because ExtraArgs
964-
/// contains the full option set.
965-
bool ExtraArgsOnly = false;
966-
967963
/// When building a PCM, rely on the Swift frontend's command-line -Xcc flags
968964
/// to build the Clang module via Clang frontend directly,
969965
/// and completely bypass the Clang driver.

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,9 +1115,6 @@ def target_variant_sdk_version : Separate<["-"], "target-variant-sdk-version">,
11151115
def target_sdk_name : Separate<["-"], "target-sdk-name">,
11161116
HelpText<"Canonical name of the target SDK used for compilation">;
11171117

1118-
def extra_clang_options_only : Flag<["-"], "only-use-extra-clang-opts">,
1119-
HelpText<"Options passed via -Xcc are sufficient for Clang configuration">;
1120-
11211118
def candidate_module_file
11221119
: Separate<["-"], "candidate-module-file">, MetaVarName<"<path>">,
11231120
HelpText<"Specify Swift module may be ready to use for an interface">;

lib/ClangImporter/ClangModuleDependencyScanner.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ ModuleDependencyVector ClangImporter::bridgeClangModuleDependencies(
167167
swiftArgs.push_back("-module-name");
168168
swiftArgs.push_back(clangModuleDep.ID.ModuleName);
169169

170-
// We pass the entire argument list via -Xcc, so the invocation should
171-
// use extra clang options alone.
172-
swiftArgs.push_back("-only-use-extra-clang-opts");
173-
174170
auto pcmPath = moduleCacheRelativeLookupModuleOutput(
175171
clangModuleDep.ID, ModuleOutputKind::ModuleFile, moduleOutputPath);
176172
swiftArgs.push_back("-o");
@@ -307,10 +303,6 @@ void ClangImporter::recordBridgingHeaderOptions(
307303
// Swift frontend action: -emit-pcm
308304
swiftArgs.push_back("-emit-pch");
309305

310-
// We pass the entire argument list via -Xcc, so the invocation should
311-
// use extra clang options alone.
312-
swiftArgs.push_back("-only-use-extra-clang-opts");
313-
314306
// Ensure that the resulting PCM build invocation uses Clang frontend
315307
// directly
316308
swiftArgs.push_back("-direct-clang-cc1-module-build");

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,6 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts, ArgList &Args,
16551655
Opts.EnableClangSPI = false;
16561656
}
16571657

1658-
Opts.ExtraArgsOnly |= Args.hasArg(OPT_extra_clang_options_only);
16591658
Opts.DirectClangCC1ModuleBuild |= Args.hasArg(OPT_direct_clang_cc1_module_build);
16601659

16611660
if (const Arg *A = Args.getLastArg(OPT_pch_output_dir)) {

test/ClangImporter/pcm-emit-direct-cc1-mode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Emit the explicit module.
22
// RUN: %empty-directory(%t)
3-
// RUN: %swift-frontend -emit-pcm -direct-clang-cc1-module-build -only-use-extra-clang-opts -module-name script -o %t/script.pcm %S/Inputs/custom-modules/module.modulemap -Xcc %S/Inputs/custom-modules/module.modulemap -Xcc -o -Xcc %t/script.pcm -Xcc -fmodules -Xcc -triple -Xcc %target-triple -Xcc -x -Xcc objective-c -dump-clang-diagnostics 2> %t.diags.txt
3+
// RUN: %swift-frontend -emit-pcm -direct-clang-cc1-module-build -module-name script -o %t/script.pcm %S/Inputs/custom-modules/module.modulemap -Xcc %S/Inputs/custom-modules/module.modulemap -Xcc -o -Xcc %t/script.pcm -Xcc -fmodules -Xcc -triple -Xcc %target-triple -Xcc -x -Xcc objective-c -dump-clang-diagnostics 2> %t.diags.txt
44

55
// Verify some of the output of the -dump-pcm flag.
66
// RUN: %swift-dump-pcm %t/script.pcm | %FileCheck %s --check-prefix=CHECK-DUMP

test/ScanDependencies/module_deps.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ import SubE
103103

104104
// CHECK: "commandLine": [
105105
// CHECK-NEXT: "-frontend"
106-
// CHECK-NEXT: "-only-use-extra-clang-opts"
106+
// CHECK: "-direct-clang-cc1-module-build"
107107
// CHECK-NOT: "BUILD_DIR/bin/clang"
108108
// CHECK: "-Xcc"
109109
// CHECK-NEXT: "-resource-dir"

test/ScanDependencies/module_deps_cache_reuse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ import SubE
142142
// CHECK: "-emit-pcm",
143143
// CHECK: "-module-name",
144144
// CHECK-NEXT: "C"
145-
// CHECK-NEXT: "-only-use-extra-clang-opts
145+
// CHECK: "-direct-clang-cc1-module-build"
146146

147147
/// --------Clang module B
148148
// CHECK-LABEL: "modulePath": "{{.*}}/B-{{.*}}.pcm",

0 commit comments

Comments
 (0)