This is an archive of the discontinued LLVM Phabricator instance.

[clang] Emit SARIF Diagnostics via -fdiagnostics-format=sarif: Create `clang::SarifDocumentWriter`
AbandonedPublicDraft

Authored by vaibhav.y on Sep 13 2021, 8:31 AM.

Details

Reviewers
lattner
Summary

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 properties 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 beyond recognizing -fdiagnostics=sarif as a valid argument.

This change adds the follow features:

  • no-op flag -fdiagnostics-format=sarif
  • Interface for SARIF writer

Previous discussions:

SARIF Standard (2.1.0):

Diff Detail

Event Timeline

vaibhav.y created this revision.Sep 13 2021, 8:31 AM
vaibhav.y retitled this revision from 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 writing adding diagnostic properties to a JSON backed... to [clangBasic] Emit SARIF Diagnostics via -fdiagnostics-format=sarif: Create `clang::SarifDocumentWriter`.Sep 13 2021, 8:34 AM
vaibhav.y edited the summary of this revision. (Show Details)
vaibhav.y added a reviewer: lattner.
vaibhav.y added a subscriber: lattner.
vaibhav.y removed a subscriber: lattner.
vaibhav.y retitled this revision from [clangBasic] Emit SARIF Diagnostics via -fdiagnostics-format=sarif: Create `clang::SarifDocumentWriter` to [clang] Emit SARIF Diagnostics via -fdiagnostics-format=sarif: Create `clang::SarifDocumentWriter`.EditedSep 13 2021, 8:38 AM
vaibhav.y added a project: Restricted Project.
vaibhav.y added subscribers: lebedev.ri, aaron.ballman.

I've added Roman Lebedev, Aaron Ballman as subscribers from the original RFC thread

vaibhav.y edited the summary of this revision. (Show Details)Sep 13 2021, 8:41 AM
vaibhav.y edited the summary of this revision. (Show Details)
vaibhav.y edited the summary of this revision. (Show Details)
vaibhav.y edited the summary of this revision. (Show Details)
vaibhav.y abandoned this revision.Sep 13 2021, 8:44 AM
vaibhav.y edited the summary of this revision. (Show Details)

Needs to drop the diagnostic flag in order to be a no-effect change.