diff options
author | Abraham Corea Diaz <abrahamcd@google.com> | 2022-07-21 16:50:43 +0000 |
---|---|---|
committer | Christopher Di Bella <cjdb@google.com> | 2022-07-21 16:51:15 +0000 |
commit | 119d22310bd622d4b39e9760667b6fa58d15a8c5 (patch) | |
tree | 59e34c7ce1c40639717916a22a815a6367d40734 /clang/include | |
parent | 66e01f47e46bcda11c4cbd942c7a7cafad1d38da (diff) | |
download | llvm-119d22310bd622d4b39e9760667b6fa58d15a8c5.zip llvm-119d22310bd622d4b39e9760667b6fa58d15a8c5.tar.gz llvm-119d22310bd622d4b39e9760667b6fa58d15a8c5.tar.bz2 |
[clang] Add -fdiagnostics-format=sarif option for future SARIF output
Adds `sarif` option to the existing `-fdiagnostics-format` flag
for intended future work with SARIF diagnostics. Currently issues a warning
against the use of diagnostics in SARIF mode, then defaults to clang style for
diagnostics.
Reviewed By: cjdb, denik, aaron.ballman
Differential Revision: https://reviews.llvm.org/D129886
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/Basic/DiagnosticDriverKinds.td | 4 | ||||
-rw-r--r-- | clang/include/clang/Basic/DiagnosticOptions.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Driver/Options.td | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 68685ba..3c5f7e0 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -678,4 +678,8 @@ def err_drv_invalid_format_dxil_validator_version : Error< def err_drv_invalid_empty_dxil_validator_version : Error< "invalid validator version : %0\n" "If validator major version is 0, minor version must also be 0.">; + +def warn_drv_sarif_format_unstable : Warning< + "diagnostic formatting in SARIF mode is currently unstable">, + InGroup<DiagGroup<"sarif-format-unstable">>; } diff --git a/clang/include/clang/Basic/DiagnosticOptions.h b/clang/include/clang/Basic/DiagnosticOptions.h index 17533b3..c4134835 100644 --- a/clang/include/clang/Basic/DiagnosticOptions.h +++ b/clang/include/clang/Basic/DiagnosticOptions.h @@ -74,7 +74,7 @@ class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{ friend class CompilerInvocation; public: - enum TextDiagnosticFormat { Clang, MSVC, Vi }; + enum TextDiagnosticFormat { Clang, MSVC, Vi, SARIF }; // Default values. enum { diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 3bd3550..b9c2e4d 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5588,8 +5588,8 @@ def diagnostic_serialized_file : Separate<["-"], "serialize-diagnostic-file">, def fdiagnostics_format : Separate<["-"], "fdiagnostics-format">, HelpText<"Change diagnostic formatting to match IDE and command line tools">, - Values<"clang,msvc,vi">, - NormalizedValuesScope<"DiagnosticOptions">, NormalizedValues<["Clang", "MSVC", "Vi"]>, + Values<"clang,msvc,vi,sarif,SARIF">, + NormalizedValuesScope<"DiagnosticOptions">, NormalizedValues<["Clang", "MSVC", "Vi", "SARIF", "SARIF"]>, MarshallingInfoEnum<DiagnosticOpts<"Format">, "Clang">; def fdiagnostics_show_category : Separate<["-"], "fdiagnostics-show-category">, HelpText<"Print diagnostic category">, |