clang 22.0.0git
Sarif.h File Reference

Defines clang::SarifDocumentWriter, clang::SarifRule, clang::SarifResult. More...

#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Version.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/JSON.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <optional>
#include <string>

Go to the source code of this file.

Classes

class  clang::detail::SarifArtifactLocation
class  clang::detail::SarifArtifact
 Since every clang artifact MUST have a location (there being no nested artifacts), the creation method SarifArtifact::create requires a SarifArtifactLocation object. More...
class  clang::ThreadFlow
 A thread flow is a sequence of code locations that specify a possible path through a single thread of execution. More...
class  clang::SarifReportingConfiguration
 A SARIF Reporting Configuration (reportingConfiguration) object contains properties for a SarifRule that can be configured at runtime before analysis begins. More...
class  clang::SarifRule
 A SARIF rule (reportingDescriptor object) contains information that describes a reporting item generated by a tool. More...
class  clang::SarifResult
 A SARIF result (also called a "reporting item") is a unit of output produced when one of the tool's reportingDescriptor encounters a match on the file being analysed by the tool. More...
class  clang::SarifDocumentWriter
 This class handles creating a valid SARIF document given various input attributes. More...

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
namespace  clang::detail

Enumerations

enum class  clang::ThreadFlowImportance { clang::Important , clang::Essential , clang::Unimportant }
enum class  clang::SarifResultLevel { clang::None , clang::Note , clang::Warning , clang::Error }
 The level of severity associated with a SarifResult. More...

Detailed Description

Defines clang::SarifDocumentWriter, clang::SarifRule, clang::SarifResult.

The document built can be accessed as a JSON Object. Several value semantic types are also introduced which represent properties of the SARIF standard, such as 'artifact', 'result', 'rule'.

A SARIF (Static Analysis Results Interchange Format) document is JSON document that describes in detail the results of running static analysis tools on a project. Each (non-trivial) document consists of at least one "run", which are themselves composed of details such as:

  • Tool: The tool that was run
  • Rules: The rules applied during the tool run, represented by reportingDescriptor objects in SARIF
  • Results: The matches for the rules applied against the project(s) being evaluated, represented by result objects in SARIF

Reference:

  1. The SARIF standard
  2. SARIFreportingDescriptor
  3. SARIFresult

Definition in file Sarif.h.