mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Frontend] Add compiler version information to -print-target-info output.
Clients that use -print-target-info can avoid an extra frontend invocation by using this information.
This commit is contained in:
@@ -1985,6 +1985,12 @@ static void printTargetInfo(const CompilerInvocation &invocation,
|
||||
llvm::raw_ostream &out) {
|
||||
out << "{\n";
|
||||
|
||||
// Compiler version, as produced by --version.
|
||||
out << " \"compilerVersion\": \"";
|
||||
out.write_escaped(version::getSwiftFullVersion(
|
||||
version::Version::getCurrentLanguageVersion()));
|
||||
out << "\",\n";
|
||||
|
||||
// Target triple and target variant triple.
|
||||
auto &langOpts = invocation.getLangOptions();
|
||||
out << " \"target\": ";
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
// RUN: %swift_driver -print-target-info -target x86_64-apple-ios12.0 | %FileCheck -check-prefix CHECK-IOS-SIM %s
|
||||
|
||||
// CHECK-IOS: "compilerVersion": "Swift version
|
||||
|
||||
// CHECK-IOS: "target": {
|
||||
// CHECK-IOS: "triple": "arm64-apple-ios12.0",
|
||||
// CHECK-IOS: "unversionedTriple": "arm64-apple-ios",
|
||||
@@ -28,6 +30,8 @@
|
||||
// CHECK-IOS: }
|
||||
|
||||
|
||||
// CHECK-LINUX: "compilerVersion": "Swift version
|
||||
|
||||
// CHECK-LINUX: "target": {
|
||||
// CHECK-LINUX: "triple": "x86_64-unknown-linux",
|
||||
// CHECK-LINUX: "moduleTriple": "x86_64-unknown-linux",
|
||||
|
||||
Reference in New Issue
Block a user