Skip to content

Commit 3ffb218

Browse files
committed
swift-synthesize-interface: Infer target triple.
Infer the `-target` argument to `swift-synthesize-interface` to be the host triple when unspecified instead of emitting an error. Resolves rdar://156353450.
1 parent c447f58 commit 3ffb218

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

lib/DriverTool/swift_synthesize_interface_main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ int swift_synthesize_interface_main(ArrayRef<const char *> Args,
8484
if (auto *A = ParsedArgs.getLastArg(OPT_target)) {
8585
Target = llvm::Triple(A->getValue());
8686
} else {
87-
Diags.diagnose(SourceLoc(), diag::error_option_required, "-target");
88-
return EXIT_FAILURE;
87+
Target = llvm::Triple(llvm::sys::getDefaultTargetTriple());
8988
}
9089

9190
std::string OutputFile;

test/SynthesizeInterfaceTool/synthesize-interface.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-synthesize-interface -module-name m1 -I %S/Inputs -o - | %FileCheck %s
2+
// RUN: %swift-synthesize-interface -module-name m1 -I %S/Inputs -o - | %FileCheck %s
23

34
// CHECK: public struct MyStruct {
45
// CHECK-DAG: public init()

test/lit.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ config.substitutions.append( ('%swift-path', config.swift) )
755755
config.substitutions.append( ('%swift-plugin-server', config.swift_plugin_server) )
756756
config.substitutions.append( ('%swift-parse-test', config.swift_parse_test) )
757757
config.substitutions.append( ('%swift-scan-test', config.swift_scan_test) )
758+
config.substitutions.append( ('%swift-synthesize-interface', config.swift_synthesize_interface) )
758759
config.substitutions.append( ('%validate-json', f"{config.python} -m json.tool") )
759760

760761
config.clang_include_dir = make_path(config.llvm_obj_root, 'include')

0 commit comments

Comments
 (0)