Skip to content

Commit e0aa6a4

Browse files
authored
Merge pull request #83377 from tshortli/infer-target-for-swift-synthesize-interface
SwiftSynthesizeInterface: Infer target triple
2 parents 436a279 + e8ced33 commit e0aa6a4

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

lib/DriverTool/swift_symbolgraph_extract_main.cpp

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

9089
std::string OutputDir;

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/SymbolGraph/Relationships/MemberOf/Basic.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/Output)
23
// RUN: %target-build-swift %s -module-name Basic -emit-module -emit-module-path %t/
3-
// RUN: %target-swift-symbolgraph-extract -module-name Basic -I %t -pretty-print -output-dir %t
4-
// RUN: %FileCheck %s --input-file %t/Basic.symbols.json
4+
// RUN: %target-swift-symbolgraph-extract -module-name Basic -I %t -pretty-print -output-dir %t/Output
5+
// RUN: %FileCheck %s --input-file %t/Output/Basic.symbols.json
6+
7+
// Verify that -target can be inferred
8+
// RUN: %empty-directory(%t/Output)
9+
// RUN: %swift-symbolgraph-extract -module-name Basic -I %t -pretty-print -output-dir %t/Output
10+
// RUN: %FileCheck %s --input-file %t/Output/Basic.symbols.json
11+
512
public struct S {
613
public var x: Int
714
}

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ 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-symbolgraph-extract', config.swift_symbolgraph_extract) )
759+
config.substitutions.append( ('%swift-synthesize-interface', config.swift_synthesize_interface) )
758760
config.substitutions.append( ('%validate-json', f"{config.python} -m json.tool") )
759761

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

0 commit comments

Comments
 (0)