clang  6.0.0svn
Public Member Functions | Protected Attributes | List of all members
clang::DiagnosticConsumer Class Reference

Abstract interface, implemented by clients of the front-end, which formats and prints fully processed diagnostics. More...

#include "clang/Basic/Diagnostic.h"

Inheritance diagram for clang::DiagnosticConsumer:
Inheritance graph
[legend]
Collaboration diagram for clang::DiagnosticConsumer:
Collaboration graph
[legend]

Public Member Functions

 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. More...
 
virtual void EndSourceFile ()
 Callback to inform the diagnostic client that processing of a source file has ended. More...
 
virtual void finish ()
 Callback to inform the diagnostic client that processing of all source files has ended. More...
 
virtual bool IncludeInDiagnosticCounts () const
 Indicates whether the diagnostics handled by this DiagnosticConsumer should be included in the number of diagnostics reported by DiagnosticsEngine. More...
 
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. More...
 

Protected Attributes

unsigned NumWarnings = 0
 Number of warnings reported. More...
 
unsigned NumErrors = 0
 Number of errors reported. More...
 

Detailed Description

Abstract interface, implemented by clients of the front-end, which formats and prints fully processed diagnostics.

Definition at line 1397 of file Diagnostic.h.

Constructor & Destructor Documentation

◆ DiagnosticConsumer()

clang::DiagnosticConsumer::DiagnosticConsumer ( )
default

◆ ~DiagnosticConsumer()

DiagnosticConsumer::~DiagnosticConsumer ( )
virtual

Definition at line 433 of file Diagnostic.cpp.

Member Function Documentation

◆ BeginSourceFile()

virtual void clang::DiagnosticConsumer::BeginSourceFile ( const LangOptions LangOpts,
const Preprocessor PP = nullptr 
)
inlinevirtual

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 in clang::VerifyDiagnosticConsumer, clang::LogDiagnosticPrinter, clang::TextDiagnosticPrinter, and clang::ChainedDiagnosticConsumer.

Definition at line 1422 of file Diagnostic.h.

Referenced by clang::arcmt::MigrationProcess::applyTransform(), clang::ChainedDiagnosticConsumer::BeginSourceFile(), and clang::ASTMergeAction::ExecuteAction().

◆ clear()

virtual void clang::DiagnosticConsumer::clear ( )
inlinevirtual

◆ EndSourceFile()

virtual void clang::DiagnosticConsumer::EndSourceFile ( )
inlinevirtual

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 in clang::VerifyDiagnosticConsumer, clang::LogDiagnosticPrinter, clang::TextDiagnosticPrinter, and clang::ChainedDiagnosticConsumer.

Definition at line 1430 of file Diagnostic.h.

Referenced by clang::arcmt::MigrationProcess::applyTransform(), clang::ChainedDiagnosticConsumer::EndSourceFile(), clang::FrontendAction::EndSourceFile(), and clang::ASTUnit::~ASTUnit().

◆ finish()

virtual void clang::DiagnosticConsumer::finish ( )
inlinevirtual

Callback to inform the diagnostic client that processing of all source files has ended.

Reimplemented in clang::ChainedDiagnosticConsumer.

Definition at line 1434 of file Diagnostic.h.

Referenced by clang::ChainedDiagnosticConsumer::finish().

◆ getNumErrors()

unsigned clang::DiagnosticConsumer::getNumErrors ( ) const
inline

Definition at line 1407 of file Diagnostic.h.

Referenced by clang::arcmt::MigrationProcess::applyTransform().

◆ getNumWarnings()

unsigned clang::DiagnosticConsumer::getNumWarnings ( ) const
inline

Definition at line 1408 of file Diagnostic.h.

◆ HandleDiagnostic()

void DiagnosticConsumer::HandleDiagnostic ( DiagnosticsEngine::Level  DiagLevel,
const Diagnostic Info 
)
virtual

◆ IncludeInDiagnosticCounts()

bool DiagnosticConsumer::IncludeInDiagnosticCounts ( ) const
virtual

Indicates whether the diagnostics handled by this DiagnosticConsumer should be included in the number of diagnostics reported by DiagnosticsEngine.

IncludeInDiagnosticCounts - This method (whose default implementation returns true) indicates whether the diagnostics handled by this DiagnosticConsumer should be included in the number of diagnostics reported by DiagnosticsEngine.

The default implementation returns true.

Reimplemented in clang::ForwardingDiagnosticConsumer, clang::FixItRewriter, and clang::ChainedDiagnosticConsumer.

Definition at line 1020 of file Diagnostic.cpp.

Referenced by clang::DiagnosticIDs::getNearestOption(), clang::ChainedDiagnosticConsumer::IncludeInDiagnosticCounts(), and clang::DiagnosticsEngine::Report().

Member Data Documentation

◆ NumErrors

unsigned clang::DiagnosticConsumer::NumErrors = 0
protected

Number of errors reported.

Definition at line 1400 of file Diagnostic.h.

◆ NumWarnings

unsigned clang::DiagnosticConsumer::NumWarnings = 0
protected

Number of warnings reported.

Definition at line 1399 of file Diagnostic.h.


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