Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -3667,7 +3667,7 @@ def _all_warnings : Flag<["--"], "all-warnings">, Alias; def _analyzer_no_default_checks : Flag<["--"], "analyzer-no-default-checks">, Flags<[NoXarchOption]>; def _analyzer_output : JoinedOrSeparate<["--"], "analyzer-output">, Flags<[NoXarchOption]>, - HelpText<"Static analyzer report output format (html|plist|plist-multi-file|plist-html|sarif|text).">; + HelpText<"Static analyzer report output format (html|plist|plist-multi-file|plist-html|sarif|sarif-html|text).">; def _analyze : Flag<["--"], "analyze">, Flags<[NoXarchOption, CoreOption]>, HelpText<"Run the static analyzer">; def _assemble : Flag<["--"], "assemble">, Alias; Index: clang/include/clang/StaticAnalyzer/Core/Analyses.def =================================================================== --- clang/include/clang/StaticAnalyzer/Core/Analyses.def +++ clang/include/clang/StaticAnalyzer/Core/Analyses.def @@ -55,6 +55,10 @@ ANALYSIS_DIAGNOSTICS(SARIF, "sarif", "Output analysis results in a SARIF file", createSarifDiagnosticConsumer) +ANALYSIS_DIAGNOSTICS(SARIF_HTML, "sarif-html", + "Output analysis results in both SARIF and HTML.", + createSarifHTMLDiagnosticConsumer) + ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results to stderr", createTextPathDiagnosticConsumer) Index: clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -176,6 +176,16 @@ CTU); } +void ento::createSarifHTMLDiagnosticConsumer( + PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C, + const std::string &sarif_file, const Preprocessor &PP, + const cross_tu::CrossTranslationUnitContext &CTU) { + createHTMLDiagnosticConsumer(DiagOpts, C, std::string(llvm::sys::path::parent_path(sarif_file)), PP, CTU); + createSarifDiagnosticConsumer(DiagOpts, C, sarif_file, PP, CTU); + createTextMinimalPathDiagnosticConsumer(std::move(DiagOpts), C, sarif_file, PP, + CTU); +} + //===----------------------------------------------------------------------===// // Report processing. //===----------------------------------------------------------------------===//