[PATCH] D96389: [analyzer] Update static analyzer to be support sarif-html
Haowei Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 10 18:35:08 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2407eb08a574: [analyzer] Update static analyzer to be support sarif-html (authored by Daniel Hwang <arkay at google.com>, committed by haowei).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96389/new/
https://reviews.llvm.org/D96389
Files:
clang/include/clang/Driver/Options.td
clang/include/clang/StaticAnalyzer/Core/Analyses.def
clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
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.
//===----------------------------------------------------------------------===//
Index: clang/include/clang/StaticAnalyzer/Core/Analyses.def
===================================================================
--- clang/include/clang/StaticAnalyzer/Core/Analyses.def
+++ clang/include/clang/StaticAnalyzer/Core/Analyses.def
@@ -52,9 +52,14 @@
"Output analysis results using HTML wrapped with Plists",
createPlistHTMLDiagnosticConsumer)
-ANALYSIS_DIAGNOSTICS(SARIF, "sarif", "Output analysis results in a SARIF file",
+ANALYSIS_DIAGNOSTICS(SARIF, "sarif", "Output analysis results using SARIF",
createSarifDiagnosticConsumer)
+ANALYSIS_DIAGNOSTICS(SARIF_HTML, "sarif-html",
+ "Output analysis results using both SARIF and HTML "
+ "output files",
+ createSarifHTMLDiagnosticConsumer)
+
ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results to stderr",
createTextPathDiagnosticConsumer)
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<Wall>;
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<S>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96389.322889.patch
Type: text/x-patch
Size: 2889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210211/be27caf3/attachment-0001.bin>
More information about the cfe-commits
mailing list