diff options
author | Vaibhav Yenamandra <vyenamandra@bloomberg.net> | 2022-11-17 14:47:02 -0500 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2022-11-17 14:47:02 -0500 |
commit | 7b6fe711b210a90cbb8facfe5343a0f999de5a0c (patch) | |
tree | 887fb2e28c56ff7c77f2ace4c73fb3a9983b87d5 /clang/lib/Basic/SourceLocation.cpp | |
parent | 817340569bf98b696329c53508a0d87cc0daec25 (diff) | |
download | llvm-7b6fe711b210a90cbb8facfe5343a0f999de5a0c.zip llvm-7b6fe711b210a90cbb8facfe5343a0f999de5a0c.tar.gz llvm-7b6fe711b210a90cbb8facfe5343a0f999de5a0c.tar.bz2 |
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.
Diffstat (limited to 'clang/lib/Basic/SourceLocation.cpp')
-rw-r--r-- | clang/lib/Basic/SourceLocation.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceLocation.cpp b/clang/lib/Basic/SourceLocation.cpp index f9ecd52..772f2e6 100644 --- a/clang/lib/Basic/SourceLocation.cpp +++ b/clang/lib/Basic/SourceLocation.cpp @@ -166,6 +166,10 @@ FullSourceLoc FullSourceLoc::getExpansionLoc() const { return FullSourceLoc(SrcMgr->getExpansionLoc(*this), *SrcMgr); } +std::pair<FileID, unsigned> FullSourceLoc::getDecomposedExpansionLoc() const { + return SrcMgr->getDecomposedExpansionLoc(*this); +} + FullSourceLoc FullSourceLoc::getSpellingLoc() const { assert(isValid()); return FullSourceLoc(SrcMgr->getSpellingLoc(*this), *SrcMgr); |