[Frontend] Add some paths to the output of -print-target-info.

Add various target-specific and compiler-determined paths to the output
of `-print-target-info`, such as the runtime resource path, SDK path, and
runtime library paths.
This commit is contained in:
Doug Gregor
2019-12-08 21:10:30 -08:00
parent 61c83d2415
commit c92600b38b
3 changed files with 49 additions and 2 deletions

View File

@@ -1892,6 +1892,38 @@ static void printTargetInfo(CompilerInvocation &invocation,
<< (tripleRequiresRPathForSwiftInOS(langOpts.Target) ? "true" : "false")
<< "\n";
out << " },\n";
// Various paths.
auto &searchOpts = invocation.getSearchPathOptions();
out << " \"paths\": {\n";
if (!searchOpts.SDKPath.empty()) {
out << " \"sdkPath\": \"";
out.write_escaped(searchOpts.SDKPath);
out << "\",\n";
}
auto outputPaths = [&](StringRef name, const std::vector<std::string> &paths){
out << " \"" << name << "\": [\n";
interleave(paths, [&out](const std::string &path) {
out << " \"";
out.write_escaped(path);
out << "\"";
}, [&out] {
out << ",\n";
});
out << "\n ],\n";
};
outputPaths("runtimeLibraryPaths", searchOpts.RuntimeLibraryPaths);
outputPaths("runtimeLibraryImportPaths",
searchOpts.RuntimeLibraryImportPaths);
out << " \"runtimeResourcePath\": \"";
out.write_escaped(searchOpts.RuntimeResourcePath);
out << "\"\n";
out << " }\n";
out << "}\n";