Skip to content

Commit bbbaa0a

Browse files
authored
[Explicit Module Builds] Serialize --target= flag instead of -triple (swiftlang#71987)
Serialize a `--target=` flag (a driver option) instead of `-triple` (a frontend option). The `XCC` values are passed as driver flags, where `-triple` is not defined. The target is passed as a joined flag and value, which is more convenient for lldb to consume.
1 parent be1551f commit bbbaa0a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
230230
serializationOpts.ExtraClangOptions = getClangImporterOptions().ExtraArgs;
231231
}
232232
if (LangOpts.ClangTarget) {
233-
serializationOpts.ExtraClangOptions.push_back("-triple");
234-
serializationOpts.ExtraClangOptions.push_back(LangOpts.ClangTarget->str());
233+
serializationOpts.ExtraClangOptions.push_back("--target=" +
234+
LangOpts.ClangTarget->str());
235235
}
236236

237237
serializationOpts.PluginSearchOptions =

test/Serialization/clang-target-option.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
// RUN: %FileCheck %s < %t/has_clang_target.swiftmodule.txt
77

88
// CHECK-LABEL: <OPTIONS_BLOCK
9-
// CHECK: <XCC abbrevid={{[0-9]+}}/> blob data = '-triple'
10-
// CHECK-NEXT: <XCC abbrevid={{[0-9]+}}/> blob data = 'arm64e-apple-macos12.12'
9+
// CHECK: <XCC abbrevid={{[0-9]+}}/> blob data = '--target=arm64e-apple-macos12.12'
1110
// CHECK: </OPTIONS_BLOCK>

0 commit comments

Comments
 (0)