clang API Documentation

Public Member Functions | Protected Attributes
clang::DiagnosticConsumer Class Reference

#include <Diagnostic.h>

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

List of all members.

Public Member Functions

 DiagnosticConsumer ()
unsigned getNumErrors () const
unsigned getNumWarnings () const
virtual void clear ()
virtual ~DiagnosticConsumer ()
virtual void BeginSourceFile (const LangOptions &LangOpts, const Preprocessor *PP=0)
virtual void EndSourceFile ()
virtual void finish ()
 Callback to inform the diagnostic client that processing of all source files has ended.
virtual bool IncludeInDiagnosticCounts () const
virtual void HandleDiagnostic (DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info)
virtual DiagnosticConsumerclone (DiagnosticsEngine &Diags) const =0
 Clone the diagnostic consumer, producing an equivalent consumer that can be used in a different context.

Protected Attributes

unsigned NumWarnings
unsigned NumErrors

Detailed Description

DiagnosticConsumer - This is an abstract interface implemented by clients of the front-end, which formats and prints fully processed diagnostics.

Definition at line 1145 of file Diagnostic.h.


Constructor & Destructor Documentation

clang::DiagnosticConsumer::DiagnosticConsumer ( ) [inline]

Definition at line 1151 of file Diagnostic.h.

DiagnosticConsumer::~DiagnosticConsumer ( ) [virtual]

Definition at line 405 of file Diagnostic.cpp.


Member Function Documentation

virtual void clang::DiagnosticConsumer::BeginSourceFile ( const LangOptions LangOpts,
const Preprocessor PP = 0 
) [inline, virtual]

BeginSourceFile - 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().

  • LO - The language options for the source file being processed.
  • PP - The preprocessor object being used for the source; this optional and may not be present, for example when processing AST source files.

Reimplemented in clang::VerifyDiagnosticConsumer, clang::LogDiagnosticPrinter, clang::TextDiagnosticPrinter, and clang::ChainedDiagnosticConsumer.

Definition at line 1170 of file Diagnostic.h.

Referenced by clang::arcmt::MigrationProcess::applyTransform(), clang::VerifyDiagnosticConsumer::BeginSourceFile(), clang::FrontendAction::BeginSourceFile(), clang::arcmt::checkForManualIssues(), and clang::ASTMergeAction::ExecuteAction().

virtual void clang::DiagnosticConsumer::clear ( ) [inline, virtual]

Definition at line 1155 of file Diagnostic.h.

References NumErrors, and NumWarnings.

Referenced by clang::FixItRecompile::BeginInvocation().

virtual DiagnosticConsumer* clang::DiagnosticConsumer::clone ( DiagnosticsEngine Diags) const [pure virtual]
virtual void clang::DiagnosticConsumer::EndSourceFile ( ) [inline, virtual]

EndSourceFile - 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

See also:
BeginSourceFile() are inaccessible.

Reimplemented in clang::VerifyDiagnosticConsumer, clang::LogDiagnosticPrinter, clang::TextDiagnosticPrinter, and clang::ChainedDiagnosticConsumer.

Definition at line 1176 of file Diagnostic.h.

Referenced by clang::arcmt::MigrationProcess::applyTransform(), clang::FrontendAction::BeginSourceFile(), clang::arcmt::checkForManualIssues(), clang::VerifyDiagnosticConsumer::EndSourceFile(), clang::FrontendAction::EndSourceFile(), and clang::ASTMergeAction::ExecuteAction().

virtual void clang::DiagnosticConsumer::finish ( ) [inline, virtual]

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

Reimplemented in clang::ChainedDiagnosticConsumer.

Definition at line 1180 of file Diagnostic.h.

Referenced by clang::CompilerInstance::ExecuteAction().

unsigned clang::DiagnosticConsumer::getNumErrors ( ) const [inline]
unsigned clang::DiagnosticConsumer::getNumWarnings ( ) const [inline]

Definition at line 1154 of file Diagnostic.h.

References NumWarnings.

Referenced by clang::CompilerInstance::ExecuteAction().

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

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

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

Reimplemented in clang::FixItRewriter, clang::VerifyDiagnosticConsumer, clang::LogDiagnosticPrinter, clang::ChainedDiagnosticConsumer, clang::TextDiagnosticPrinter, and clang::TextDiagnosticBuffer.

Definition at line 407 of file Diagnostic.cpp.

References clang::DiagnosticsEngine::Error, IncludeInDiagnosticCounts(), NumErrors, NumWarnings, and clang::DiagnosticsEngine::Warning.

Referenced by clang::FixItRewriter::HandleDiagnostic(), and clang::DiagnosticsEngine::Report().

bool DiagnosticConsumer::IncludeInDiagnosticCounts ( ) const [virtual]

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.

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

Definition at line 862 of file Diagnostic.cpp.

Referenced by HandleDiagnostic(), clang::FixItRewriter::IncludeInDiagnosticCounts(), and clang::DiagnosticsEngine::Report().


Member Data Documentation

Definition at line 1148 of file Diagnostic.h.

Referenced by clear(), getNumErrors(), and HandleDiagnostic().

Definition at line 1147 of file Diagnostic.h.

Referenced by clear(), getNumWarnings(), and HandleDiagnostic().


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