mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add target variant to -print-target-info
This commit is contained in:
@@ -1894,39 +1894,54 @@ createJSONFixItDiagnosticConsumerIfNeeded(
|
||||
});
|
||||
}
|
||||
|
||||
/// Print information about the selected target in JSON.
|
||||
static void printTargetInfo(const CompilerInvocation &invocation,
|
||||
/// Print information about the target triple in JSON.
|
||||
static void printTripleInfo(const llvm::Triple &triple,
|
||||
llvm::raw_ostream &out) {
|
||||
out << "{\n";
|
||||
|
||||
// Target information.
|
||||
auto &langOpts = invocation.getLangOptions();
|
||||
out << " \"target\": {\n";
|
||||
|
||||
out << " \"triple\": \"";
|
||||
out.write_escaped(langOpts.Target.getTriple());
|
||||
out.write_escaped(triple.getTriple());
|
||||
out << "\",\n";
|
||||
|
||||
out << " \"unversionedTriple\": \"";
|
||||
out.write_escaped(getUnversionedTriple(langOpts.Target).getTriple());
|
||||
out.write_escaped(getUnversionedTriple(triple).getTriple());
|
||||
out << "\",\n";
|
||||
|
||||
out << " \"moduleTriple\": \"";
|
||||
out.write_escaped(getTargetSpecificModuleTriple(langOpts.Target).getTriple());
|
||||
out.write_escaped(getTargetSpecificModuleTriple(triple).getTriple());
|
||||
out << "\",\n";
|
||||
|
||||
if (auto runtimeVersion = getSwiftRuntimeCompatibilityVersionForTarget(
|
||||
langOpts.Target)) {
|
||||
triple)) {
|
||||
out << " \"swiftRuntimeCompatibilityVersion\": \"";
|
||||
out.write_escaped(runtimeVersion->getAsString());
|
||||
out << "\",\n";
|
||||
}
|
||||
|
||||
out << " \"librariesRequireRPath\": "
|
||||
<< (tripleRequiresRPathForSwiftInOS(langOpts.Target) ? "true" : "false")
|
||||
<< (tripleRequiresRPathForSwiftInOS(triple) ? "true" : "false")
|
||||
<< "\n";
|
||||
|
||||
out << " },\n";
|
||||
out << " }";
|
||||
|
||||
}
|
||||
|
||||
/// Print information about the selected target in JSON.
|
||||
static void printTargetInfo(const CompilerInvocation &invocation,
|
||||
llvm::raw_ostream &out) {
|
||||
out << "{\n";
|
||||
|
||||
// Target triple and target variant triple.
|
||||
auto &langOpts = invocation.getLangOptions();
|
||||
out << " \"target\": ";
|
||||
printTripleInfo(langOpts.Target, out);
|
||||
out << ",\n";
|
||||
|
||||
if (auto &variant = langOpts.TargetVariant) {
|
||||
out << " \"targetVariant\": ";
|
||||
printTripleInfo(*variant, out);
|
||||
out << ",\n";
|
||||
}
|
||||
|
||||
// Various paths.
|
||||
auto &searchOpts = invocation.getSearchPathOptions();
|
||||
|
||||
Reference in New Issue
Block a user