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.
L121 was copied wrong, libStaticAnalyzer (sensibly) uses the expansion loc. This has been fixed as well.