clang 20.0.0git
Public Member Functions | List of all members
clang::SARIFDiagnosticPrinter Class Reference

#include "clang/Frontend/SARIFDiagnosticPrinter.h"

Inheritance diagram for clang::SARIFDiagnosticPrinter:
Inheritance graph
[legend]

Public Member Functions

 SARIFDiagnosticPrinter (raw_ostream &OS, DiagnosticOptions *Diags)
 
 ~SARIFDiagnosticPrinter ()=default
 
SARIFDiagnosticPrinteroperator= (const SARIFDiagnosticPrinter &&)=delete
 
 SARIFDiagnosticPrinter (SARIFDiagnosticPrinter &&)=delete
 
SARIFDiagnosticPrinteroperator= (const SARIFDiagnosticPrinter &)=delete
 
 SARIFDiagnosticPrinter (const SARIFDiagnosticPrinter &)=delete
 
void setPrefix (llvm::StringRef Value)
 setPrefix - Set the diagnostic printer prefix string, which will be printed at the start of any diagnostics.
 
bool hasSarifWriter () const
 
SarifDocumentWritergetSarifWriter () const
 
void setSarifWriter (std::unique_ptr< SarifDocumentWriter > SarifWriter)
 
void BeginSourceFile (const LangOptions &LO, const Preprocessor *PP) override
 Callback to inform the diagnostic client that processing of a source file is beginning.
 
void EndSourceFile () override
 Callback to inform the diagnostic client that processing of a source file has ended.
 
void HandleDiagnostic (DiagnosticsEngine::Level Level, const Diagnostic &Info) override
 Handle this diagnostic, reporting it to the user or capturing it to a log as needed.
 
- Public Member Functions inherited from clang::DiagnosticConsumer
 DiagnosticConsumer ()=default
 
virtual ~DiagnosticConsumer ()
 
unsigned getNumErrors () const
 
unsigned getNumWarnings () const
 
virtual void clear ()
 
virtual void BeginSourceFile (const LangOptions &LangOpts, const Preprocessor *PP=nullptr)
 Callback to inform the diagnostic client that processing of a source file is beginning.
 
virtual void EndSourceFile ()
 Callback to inform the diagnostic client that processing of a source file has ended.
 
virtual void finish ()
 Callback to inform the diagnostic client that processing of all source files has ended.
 
virtual bool IncludeInDiagnosticCounts () const
 Indicates whether the diagnostics handled by this DiagnosticConsumer should be included in the number of diagnostics reported by DiagnosticsEngine.
 
virtual void HandleDiagnostic (DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info)
 Handle this diagnostic, reporting it to the user or capturing it to a log as needed.
 

Additional Inherited Members

- Protected Attributes inherited from clang::DiagnosticConsumer
unsigned NumWarnings = 0
 Number of warnings reported.
 
unsigned NumErrors = 0
 Number of errors reported.
 

Detailed Description

Definition at line 30 of file SARIFDiagnosticPrinter.h.

Constructor & Destructor Documentation

◆ SARIFDiagnosticPrinter() [1/3]

clang::SARIFDiagnosticPrinter::SARIFDiagnosticPrinter ( raw_ostream &  OS,
DiagnosticOptions Diags 
)

Definition at line 28 of file SARIFDiagnosticPrinter.cpp.

◆ ~SARIFDiagnosticPrinter()

clang::SARIFDiagnosticPrinter::~SARIFDiagnosticPrinter ( )
default

◆ SARIFDiagnosticPrinter() [2/3]

clang::SARIFDiagnosticPrinter::SARIFDiagnosticPrinter ( SARIFDiagnosticPrinter &&  )
delete

◆ SARIFDiagnosticPrinter() [3/3]

clang::SARIFDiagnosticPrinter::SARIFDiagnosticPrinter ( const SARIFDiagnosticPrinter )
delete

Member Function Documentation

◆ BeginSourceFile()

void clang::SARIFDiagnosticPrinter::BeginSourceFile ( const LangOptions LangOpts,
const Preprocessor PP 
)
overridevirtual

Callback to inform the diagnostic client that processing of a source file is beginning.

Note that diagnostics may be emitted outside the processing of a source file, for example during the parsing of command line options. However, diagnostics with source range information are required to only be emitted in between BeginSourceFile() and EndSourceFile().

Parameters
LangOptsThe language options for the source file being processed.
PPThe preprocessor object being used for the source; this is optional, e.g., it may not be present when processing AST source files.

Reimplemented from clang::DiagnosticConsumer.

Definition at line 32 of file SARIFDiagnosticPrinter.cpp.

References hasSarifWriter().

◆ EndSourceFile()

void clang::SARIFDiagnosticPrinter::EndSourceFile ( )
overridevirtual

Callback to inform the diagnostic client that processing of a source file has ended.

The diagnostic client should assume that any objects made available via BeginSourceFile() are inaccessible.

Reimplemented from clang::DiagnosticConsumer.

Definition at line 42 of file SARIFDiagnosticPrinter.cpp.

◆ getSarifWriter()

SarifDocumentWriter & clang::SARIFDiagnosticPrinter::getSarifWriter ( ) const
inline

Definition at line 47 of file SARIFDiagnosticPrinter.h.

◆ HandleDiagnostic()

void clang::SARIFDiagnosticPrinter::HandleDiagnostic ( DiagnosticsEngine::Level  DiagLevel,
const Diagnostic Info 
)
overridevirtual

Handle this diagnostic, reporting it to the user or capturing it to a log as needed.

The default implementation just keeps track of the total number of warnings and errors.

Reimplemented from clang::DiagnosticConsumer.

Definition at line 51 of file SARIFDiagnosticPrinter.cpp.

References clang::Diagnostic::FormatDiagnostic(), clang::Diagnostic::getFixItHints(), clang::Diagnostic::getLocation(), clang::Diagnostic::getRanges(), clang::Diagnostic::getSourceManager(), clang::DiagnosticConsumer::HandleDiagnostic(), clang::Diagnostic::hasSourceManager(), and clang::SourceLocation::isInvalid().

◆ hasSarifWriter()

bool clang::SARIFDiagnosticPrinter::hasSarifWriter ( ) const
inline

Definition at line 45 of file SARIFDiagnosticPrinter.h.

Referenced by BeginSourceFile().

◆ operator=() [1/2]

SARIFDiagnosticPrinter & clang::SARIFDiagnosticPrinter::operator= ( const SARIFDiagnosticPrinter &&  )
delete

◆ operator=() [2/2]

SARIFDiagnosticPrinter & clang::SARIFDiagnosticPrinter::operator= ( const SARIFDiagnosticPrinter )
delete

◆ setPrefix()

void clang::SARIFDiagnosticPrinter::setPrefix ( llvm::StringRef  Value)
inline

setPrefix - Set the diagnostic printer prefix string, which will be printed at the start of any diagnostics.

If empty, no prefix string is used.

Definition at line 43 of file SARIFDiagnosticPrinter.h.

◆ setSarifWriter()

void clang::SARIFDiagnosticPrinter::setSarifWriter ( std::unique_ptr< SarifDocumentWriter SarifWriter)
inline

Definition at line 52 of file SARIFDiagnosticPrinter.h.


The documentation for this class was generated from the following files: