[all-commits] [llvm/llvm-project] 7b6fe7: Refactor StaticAnalyzer to use `clang::SarifDocume...

Vaibhav Yenamandra via All-commits all-commits at lists.llvm.org
Thu Nov 17 11:48:52 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7b6fe711b210a90cbb8facfe5343a0f999de5a0c
      https://github.com/llvm/llvm-project/commit/7b6fe711b210a90cbb8facfe5343a0f999de5a0c
  Author: Vaibhav Yenamandra <vyenamandra at bloomberg.net>
  Date:   2022-11-17 (Thu, 17 Nov 2022)

  Changed paths:
    M clang/include/clang/Basic/SourceLocation.h
    M clang/lib/Basic/Sarif.cpp
    M clang/lib/Basic/SourceLocation.cpp
    M clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
    M clang/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
    M clang/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
    M clang/test/Frontend/sarif-diagnostics.cpp
    M clang/unittests/Basic/SarifTest.cpp

  Log Message:
  -----------
  Refactor StaticAnalyzer to use `clang::SarifDocumentWriter`

Refactor StaticAnalyzer to use clang::SarifDocumentWriter for
serializing sarif diagnostics.

Uses clang::SarifDocumentWriter to generate SARIF output in the
StaticAnalyzer.

Various bugfixes are also made to clang::SarifDocumentWriter.

Summary of changes:

clang/lib/Basic/Sarif.cpp:
  * Fix bug in adjustColumnPos introduced from prev move, it now uses
    FullSourceLoc::getDecomposedExpansionLoc which provides the correct
    location (in the presence of macros) instead of
    FullSourceLoc::getDecomposedLoc.
  * Fix createTextRegion so that it handles caret ranges correctly,
    this should bring it to parity with the previous implementation.

clang/test/Analysis/diagnostics/Inputs/expected-sarif:
  * Update the schema URL to the offical website
  * Add the emitted defaultConfiguration sections to all rules
  * Annotate results with the "level" property

clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp:
  * Update SarifDiagnostics class to hold a clang::SarifDocumentWriter
    that it uses to convert diagnostics to SARIF.




More information about the All-commits mailing list