@@ -1894,39 +1894,54 @@ createJSONFixItDiagnosticConsumerIfNeeded(
1894
1894
});
1895
1895
}
1896
1896
1897
- // / Print information about the selected target in JSON.
1898
- static void printTargetInfo (const CompilerInvocation &invocation ,
1897
+ // / Print information about the target triple in JSON.
1898
+ static void printTripleInfo (const llvm::Triple &triple ,
1899
1899
llvm::raw_ostream &out) {
1900
1900
out << " {\n " ;
1901
1901
1902
- // Target information.
1903
- auto &langOpts = invocation.getLangOptions ();
1904
- out << " \" target\" : {\n " ;
1905
-
1906
1902
out << " \" triple\" : \" " ;
1907
- out.write_escaped (langOpts. Target .getTriple ());
1903
+ out.write_escaped (triple .getTriple ());
1908
1904
out << " \" ,\n " ;
1909
1905
1910
1906
out << " \" unversionedTriple\" : \" " ;
1911
- out.write_escaped (getUnversionedTriple (langOpts. Target ).getTriple ());
1907
+ out.write_escaped (getUnversionedTriple (triple ).getTriple ());
1912
1908
out << " \" ,\n " ;
1913
1909
1914
1910
out << " \" moduleTriple\" : \" " ;
1915
- out.write_escaped (getTargetSpecificModuleTriple (langOpts. Target ).getTriple ());
1911
+ out.write_escaped (getTargetSpecificModuleTriple (triple ).getTriple ());
1916
1912
out << " \" ,\n " ;
1917
1913
1918
1914
if (auto runtimeVersion = getSwiftRuntimeCompatibilityVersionForTarget (
1919
- langOpts. Target )) {
1915
+ triple )) {
1920
1916
out << " \" swiftRuntimeCompatibilityVersion\" : \" " ;
1921
1917
out.write_escaped (runtimeVersion->getAsString ());
1922
1918
out << " \" ,\n " ;
1923
1919
}
1924
1920
1925
1921
out << " \" librariesRequireRPath\" : "
1926
- << (tripleRequiresRPathForSwiftInOS (langOpts. Target ) ? " true" : " false" )
1922
+ << (tripleRequiresRPathForSwiftInOS (triple ) ? " true" : " false" )
1927
1923
<< " \n " ;
1928
1924
1929
- out << " },\n " ;
1925
+ out << " }" ;
1926
+
1927
+ }
1928
+
1929
+ // / Print information about the selected target in JSON.
1930
+ static void printTargetInfo (const CompilerInvocation &invocation,
1931
+ llvm::raw_ostream &out) {
1932
+ out << " {\n " ;
1933
+
1934
+ // Target triple and target variant triple.
1935
+ auto &langOpts = invocation.getLangOptions ();
1936
+ out << " \" target\" : " ;
1937
+ printTripleInfo (langOpts.Target , out);
1938
+ out << " ,\n " ;
1939
+
1940
+ if (auto &variant = langOpts.TargetVariant ) {
1941
+ out << " \" targetVariant\" : " ;
1942
+ printTripleInfo (*variant, out);
1943
+ out << " ,\n " ;
1944
+ }
1930
1945
1931
1946
// Various paths.
1932
1947
auto &searchOpts = invocation.getSearchPathOptions ();
0 commit comments