[Frontend] Allow additional files for diagnostic verifier

This change adds a frontend flag, -verify-additional-file, which can be used to pass extra files directly to the diagnostic verifier. These files are not otherwise considered to be Swift source files; they are not compiled or even properly parsed.

This feature can be used to verify diagnostics emitted in non-source files, such as in module interfaces or header files.
This commit is contained in:
Brent Royal-Gordon
2020-09-18 17:52:38 -07:00
committed by Alexis Laferrière
parent ba00258c66
commit 5036a55550
7 changed files with 50 additions and 12 deletions

View File

@@ -41,6 +41,10 @@ public:
/// Indicates whether diagnostic passes should be skipped.
bool SkipDiagnosticPasses = false;
/// Additional non-source files which will have diagnostics emitted in them,
/// and which should be scanned for expectations by the diagnostic verifier.
std::vector<std::string> AdditionalVerifierFiles;
/// Keep emitting subsequent diagnostics after a fatal error.
bool ShowDiagnosticsAfterFatalError = false;
@@ -54,22 +58,23 @@ public:
/// Treat all warnings as errors
bool WarningsAsErrors = false;
// When printing diagnostics, include the diagnostic name at the end
/// When printing diagnostics, include the diagnostic name (diag::whatever) at
/// the end.
bool PrintDiagnosticNames = false;
/// If set to true, include educational notes in printed output if available.
/// Educational notes are documentation which supplement diagnostics.
bool PrintEducationalNotes = false;
// If set to true, use the more descriptive experimental formatting style for
// diagnostics.
/// Whether to emit diagnostics in the terse LLVM style or in a more
/// descriptive style that's specific to Swift (currently experimental).
FormattingStyle PrintedFormattingStyle = FormattingStyle::LLVM;
std::string DiagnosticDocumentationPath = "";
std::string LocalizationCode = "";
// Diagnostic messages directory path.
/// Path to a directory of diagnostic localization tables.
std::string LocalizationPath = "";
/// Return a hash code of any components from these options that should