clang API Documentation
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed diagnostics. More...
#include <Diagnostic.h>
Public Member Functions | |
DiagnosticConsumer () | |
unsigned | getNumErrors () const |
unsigned | getNumWarnings () const |
virtual void | clear () |
virtual | ~DiagnosticConsumer () |
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. | |
Protected Attributes | |
unsigned | NumWarnings |
Number of warnings reported. | |
unsigned | NumErrors |
Number of errors reported. |
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed diagnostics.
Definition at line 1293 of file Diagnostic.h.
clang::DiagnosticConsumer::DiagnosticConsumer | ( | ) | [inline] |
Definition at line 1299 of file Diagnostic.h.
DiagnosticConsumer::~DiagnosticConsumer | ( | ) | [virtual] |
Definition at line 376 of file Diagnostic.cpp.
virtual void clang::DiagnosticConsumer::BeginSourceFile | ( | const LangOptions & | LangOpts, |
const Preprocessor * | PP = nullptr |
||
) | [inline, virtual] |
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().
LangOpts | The language options for the source file being processed. |
PP | The 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 1318 of file Diagnostic.h.
Referenced by clang::arcmt::MigrationProcess::applyTransform(), clang::ChainedDiagnosticConsumer::BeginSourceFile(), clang::FrontendAction::BeginSourceFile(), clang::VerifyDiagnosticConsumer::BeginSourceFile(), clang::arcmt::checkForManualIssues(), and clang::ASTMergeAction::ExecuteAction().
virtual void clang::DiagnosticConsumer::clear | ( | ) | [inline, virtual] |
Reimplemented in clang::ForwardingDiagnosticConsumer.
Definition at line 1303 of file Diagnostic.h.
References NumErrors, and NumWarnings.
Referenced by clang::FixItRecompile::BeginInvocation(), and clang::ForwardingDiagnosticConsumer::clear().
virtual void clang::DiagnosticConsumer::EndSourceFile | ( | ) | [inline, virtual] |
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 1326 of file Diagnostic.h.
Referenced by clang::arcmt::MigrationProcess::applyTransform(), clang::FrontendAction::BeginSourceFile(), clang::arcmt::checkForManualIssues(), clang::ChainedDiagnosticConsumer::EndSourceFile(), clang::FrontendAction::EndSourceFile(), clang::VerifyDiagnosticConsumer::EndSourceFile(), clang::ASTMergeAction::ExecuteAction(), and clang::ASTUnit::~ASTUnit().
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 1330 of file Diagnostic.h.
Referenced by clang::CompilerInstance::ExecuteAction(), and clang::ChainedDiagnosticConsumer::finish().
unsigned clang::DiagnosticConsumer::getNumErrors | ( | ) | const [inline] |
Definition at line 1301 of file Diagnostic.h.
References NumErrors.
Referenced by clang::arcmt::MigrationProcess::applyTransform(), and clang::CompilerInstance::ExecuteAction().
unsigned clang::DiagnosticConsumer::getNumWarnings | ( | ) | const [inline] |
Definition at line 1302 of file Diagnostic.h.
References NumWarnings.
Referenced by clang::CompilerInstance::ExecuteAction().
void DiagnosticConsumer::HandleDiagnostic | ( | DiagnosticsEngine::Level | DiagLevel, |
const Diagnostic & | Info | ||
) | [virtual] |
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 in clang::ForwardingDiagnosticConsumer, clang::VerifyDiagnosticConsumer, clang::tooling::UnusedInputDiagConsumer, clang::FixItRewriter, clang::LogDiagnosticPrinter, clang::ChainedDiagnosticConsumer, clang::TextDiagnosticPrinter, and clang::TextDiagnosticBuffer.
Definition at line 378 of file Diagnostic.cpp.
References clang::DiagnosticsEngine::Error, IncludeInDiagnosticCounts(), NumErrors, NumWarnings, and clang::DiagnosticsEngine::Warning.
Referenced by clang::ChainedDiagnosticConsumer::HandleDiagnostic(), clang::FixItRewriter::HandleDiagnostic(), clang::tooling::UnusedInputDiagConsumer::HandleDiagnostic(), clang::ForwardingDiagnosticConsumer::HandleDiagnostic(), and clang::DiagnosticsEngine::Report().
bool DiagnosticConsumer::IncludeInDiagnosticCounts | ( | ) | const [virtual] |
Indicates whether the diagnostics handled by this DiagnosticConsumer should be included in the number of diagnostics reported by DiagnosticsEngine.
The default implementation returns true.
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::ForwardingDiagnosticConsumer, clang::FixItRewriter, and clang::ChainedDiagnosticConsumer.
Definition at line 955 of file Diagnostic.cpp.
Referenced by HandleDiagnostic(), clang::ChainedDiagnosticConsumer::IncludeInDiagnosticCounts(), clang::FixItRewriter::IncludeInDiagnosticCounts(), clang::ForwardingDiagnosticConsumer::IncludeInDiagnosticCounts(), and clang::DiagnosticsEngine::Report().
unsigned clang::DiagnosticConsumer::NumErrors [protected] |
Number of errors reported.
Definition at line 1296 of file Diagnostic.h.
Referenced by clear(), getNumErrors(), and HandleDiagnostic().
unsigned clang::DiagnosticConsumer::NumWarnings [protected] |
Number of warnings reported.
Definition at line 1295 of file Diagnostic.h.
Referenced by clear(), getNumWarnings(), and HandleDiagnostic().