Merge pull request #28052 from owenv/educational-notes

[Diagnostics] Introduce "Educational Notes" for diagnostics
This commit is contained in:
Owen Voorhees
2019-11-08 13:19:44 -08:00
committed by GitHub
15 changed files with 138 additions and 1 deletions

View File

@@ -44,6 +44,13 @@ void CompilerInvocation::setMainExecutablePath(StringRef Path) {
llvm::sys::path::remove_filename(LibPath); // Remove /bin
llvm::sys::path::append(LibPath, "lib", "swift");
setRuntimeResourcePath(LibPath.str());
llvm::SmallString<128> DiagnosticDocsPath(Path);
llvm::sys::path::remove_filename(DiagnosticDocsPath); // Remove /swift
llvm::sys::path::remove_filename(DiagnosticDocsPath); // Remove /bin
llvm::sys::path::append(DiagnosticDocsPath, "share", "doc", "swift",
"diagnostics");
DiagnosticOpts.DiagnosticDocumentationPath = DiagnosticDocsPath.str();
}
/// If we haven't explicitly passed -prebuilt-module-cache-path, set it to
@@ -684,7 +691,9 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
Opts.PrintDiagnosticNames |= Args.hasArg(OPT_debug_diagnostic_names);
Opts.EnableDescriptiveDiagnostics |=
Args.hasArg(OPT_enable_descriptive_diagnostics);
if (Arg *A = Args.getLastArg(OPT_diagnostic_documentation_path)) {
Opts.DiagnosticDocumentationPath = A->getValue();
}
assert(!(Opts.WarningsAsErrors && Opts.SuppressWarnings) &&
"conflicting arguments; should have been caught by driver");