|
clang 23.0.0git
|
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed diagnostics. More...
#include "clang/Basic/Diagnostic.h"
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. | |
| virtual void | EndSourceFile () |
| Callback to inform the diagnostic client that processing of a source file 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 = 0 |
| Number of warnings reported. | |
| unsigned | NumErrors = 0 |
| Number of errors reported. | |
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed diagnostics.
The destructor must be called even with -disable-free.
Definition at line 1748 of file Diagnostic.h.
|
default |
|
virtualdefault |
|
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().
| 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::ChainedDiagnosticConsumer, clang::FilterAndStoreDiagnosticConsumer, clang::LogDiagnosticPrinter, clang::SARIFDiagnosticPrinter, clang::TextDiagnosticPrinter, and clang::VerifyDiagnosticConsumer.
Definition at line 1772 of file Diagnostic.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::ASTUnit::enableSourceFileDiagnostics(), and clang::ASTMergeAction::ExecuteAction().
|
inlinevirtual |
Reimplemented in clang::ForwardingDiagnosticConsumer.
Definition at line 1759 of file Diagnostic.h.
References NumErrors, and NumWarnings.
Referenced by clang::FixItRecompile::BeginInvocation(), and clang::ForwardingDiagnosticConsumer::clear().
|
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::ChainedDiagnosticConsumer, clang::LogDiagnosticPrinter, clang::SARIFDiagnosticPrinter, clang::TextDiagnosticPrinter, and clang::VerifyDiagnosticConsumer.
Definition at line 1780 of file Diagnostic.h.
Referenced by clang::FrontendAction::BeginSourceFile(), clang::FrontendAction::EndSourceFile(), clang::ASTMergeAction::ExecuteAction(), and clang::ASTUnit::~ASTUnit().
|
inline |
Definition at line 1757 of file Diagnostic.h.
References NumErrors.
Referenced by clang::CompilerInstance::ExecuteAction(), and clang::CompilerInstance::printDiagnosticStats().
|
inline |
Definition at line 1758 of file Diagnostic.h.
References NumWarnings.
Referenced by clang::CompilerInstance::printDiagnosticStats().
|
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::ChainedDiagnosticConsumer, clang::FilterAndStoreDiagnosticConsumer, clang::FixItRewriter, clang::format::FatalDiagnosticConsumer, clang::ForwardingDiagnosticConsumer, clang::LogDiagnosticPrinter, clang::SARIFDiagnosticPrinter, clang::TextDiagnosticBuffer, clang::TextDiagnosticPrinter, and clang::VerifyDiagnosticConsumer.
Definition at line 767 of file Diagnostic.cpp.
References clang::DiagnosticsEngine::Error, IncludeInDiagnosticCounts(), NumErrors, NumWarnings, and clang::DiagnosticsEngine::Warning.
Referenced by clang::ChainedDiagnosticConsumer::HandleDiagnostic(), clang::FilterAndStoreDiagnosticConsumer::HandleDiagnostic(), clang::FixItRewriter::HandleDiagnostic(), clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::SARIFDiagnosticPrinter::HandleDiagnostic(), clang::TextDiagnosticBuffer::HandleDiagnostic(), and clang::TextDiagnosticPrinter::HandleDiagnostic().
|
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::ChainedDiagnosticConsumer, clang::FixItRewriter, and clang::ForwardingDiagnosticConsumer.
Definition at line 1437 of file Diagnostic.cpp.
Referenced by HandleDiagnostic().
|
protected |
Number of errors reported.
Definition at line 1751 of file Diagnostic.h.
Referenced by clear(), getNumErrors(), and HandleDiagnostic().
|
protected |
Number of warnings reported.
Definition at line 1750 of file Diagnostic.h.
Referenced by clear(), getNumWarnings(), and HandleDiagnostic().