[PATCH] D55792: Allow direct navigation to static analysis checker documentation through SARIF exports

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 17 14:39:16 PST 2018


aaron.ballman created this revision.
aaron.ballman added reviewers: NoQ, george.karpenkov, Szelethus, dcoughlin, dkrupp.
Herald added subscribers: jfb, rnkovacs.

The static analysis checkers are mostly listed on two pages, one for alpha checks and one for released checks (there are also a considerable number of undocumented analyzer checkers). This patch adds anchors to all of the documented checks so that you can directly link to a check by a stable name. This is useful because the SARIF file format has a field for specifying a URI to documentation for a rule and some viewers, like CodeSonar, make use of this information.

This patch exposes those anchors through the SARIF exporter, which requires an automated way to determine the check URIs. Checkers.td now requires each checker to be annotated with an extensible list of documentation kinds (listed in CheckerBase.td) that map to physical URI paths on the static analyzer web page if the check has documentation (mapping is done by the table generator), which is exposed via the `CHECKER` macro. When exporting to SARIF, the checker name itself is used as the anchor target on the page (and I verified that checker names, including dots and dashes, will be valid anchors) and the corresponding edits were made to each HTML file to add the anchors.

This likely has some overlap with D54429 <https://reviews.llvm.org/D54429>, so I've added those reviewers and author to this review.


https://reviews.llvm.org/D55792

Files:
  include/clang/Driver/CC1Options.td
  include/clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h
  include/clang/StaticAnalyzer/Checkers/CheckerBase.td
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
  lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
  lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
  test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
  utils/TableGen/ClangSACheckersEmitter.cpp
  www/analyzer/alpha_checks.html
  www/analyzer/available_checks.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55792.178530.patch
Type: text/x-patch
Size: 114545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181217/6e245629/attachment-0001.bin>


More information about the cfe-commits mailing list