[PATCH] D109701: [clang] Emit SARIF Diagnostics: Create `clang::SarifDocumentWriter` interface
Vaibhav Yenamandra via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 13 09:34:45 PDT 2021
vaibhav.y created this revision.
vaibhav.y added a reviewer: lattner.
Herald added subscribers: dexonsmith, wenlei, mgorny.
vaibhav.y edited the summary of this revision.
vaibhav.y added a project: clang.
vaibhav.y added subscribers: aaron.ballman, lebedev.ri.
vaibhav.y added a comment.
vaibhav.y edited the summary of this revision.
vaibhav.y edited the summary of this revision.
vaibhav.y edited the summary of this revision.
vaibhav.y published this revision for review.
Herald added a subscriber: cfe-commits.
I've added Roman Lebedev and Aaron Ballman as subscribers from the original RFC thread
================
Comment at: clang/lib/Basic/Sarif.cpp:27
+
+StringRef getFileName(const FileEntry &FE) {
+ StringRef Filename = FE.tryGetRealPathName();
----------------
A lot of these are copied from [[ https://github.com/llvm/llvm-project/blob/181d18ef53db1e5810bf6b905fbafc91da9b5baa/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp#L64 | SarifDiagnostics.cpp ]]
Create an interface for writing SARIF documents from within `clang`:
The primary intent of this change is to introduce the interface `clang::SarifDocumentWriter`, which allows incrementally adding diagnostic data to a JSON backed document. The proposed interface is not yet connected to the compiler internals, which will be covered in future work. As such this change will not change the input/output interface of `clang`.
This change also introduces the `clang::FullSourceRange` type that is modeled after `clang::SourceRange` + `clang::FullSourceLoc`, this is useful for packaging a pair of `clang::SourceLocation` objects with their corresponding `SourceManager`s.
Previous discussions:
- RFC for this change: https://lists.llvm.org/pipermail/cfe-dev/2021-March/067907.html
- https://lists.llvm.org/pipermail/cfe-dev/2021-July/068480.html
SARIF Standard (2.1.0):
- https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D109701
Files:
clang/include/clang/Basic/Sarif.h
clang/include/clang/Basic/SourceLocation.h
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/Sarif.cpp
clang/lib/Basic/SourceLocation.cpp
clang/unittests/Basic/CMakeLists.txt
clang/unittests/Basic/SarifTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109701.372274.patch
Type: text/x-patch
Size: 37549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210913/5bc5640a/attachment-0001.bin>
More information about the cfe-commits
mailing list