class DiagnosticConsumer
Declaration
class DiagnosticConsumer { /* full declaration omitted */ };
Description
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed diagnostics.
Declared at: clang/include/clang/Basic/Diagnostic.h:1739
Member Variables
- protected unsigned int NumWarnings = 0
- Number of warnings reported
- protected unsigned int NumErrors = 0
- Number of errors reported
Method Overview
- public virtual void BeginSourceFile(const clang::LangOptions & LangOpts, const clang::Preprocessor * PP = nullptr)
- public DiagnosticConsumer()
- public virtual void EndSourceFile()
- public virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic & Info)
- public virtual bool IncludeInDiagnosticCounts() const
- public virtual void clear()
- public virtual void finish()
- public unsigned int getNumErrors() const
- public unsigned int getNumWarnings() const
- public virtual ~DiagnosticConsumer()
Methods
¶virtual void BeginSourceFile(
const clang::LangOptions& LangOpts,
const clang::Preprocessor* PP = nullptr)
virtual void BeginSourceFile(
const clang::LangOptions& LangOpts,
const clang::Preprocessor* PP = nullptr)
Description
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().
Declared at: clang/include/clang/Basic/Diagnostic.h:1763
Parameters
- const clang::LangOptions& LangOpts
- The language options for the source file being processed.
- const clang::Preprocessor* PP = nullptr
- The preprocessor object being used for the source; this is optional, e.g., it may not be present when processing AST source files.
¶DiagnosticConsumer()
DiagnosticConsumer()
Declared at: clang/include/clang/Basic/Diagnostic.h:1745
¶virtual void EndSourceFile()
virtual void EndSourceFile()
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:1771
¶virtual void HandleDiagnostic(
DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic& Info)
virtual void HandleDiagnostic(
DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic& Info)
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:1789
Parameters
- DiagnosticsEngine::Level DiagLevel
- const clang::Diagnostic& Info
¶virtual bool IncludeInDiagnosticCounts() const
virtual bool IncludeInDiagnosticCounts() const
Description
Indicates whether the diagnostics handled by this DiagnosticConsumer should be included in the number of diagnostics reported by DiagnosticsEngine. The default implementation returns true.
Declared at: clang/include/clang/Basic/Diagnostic.h:1782
¶virtual void clear()
virtual void clear()
Declared at: clang/include/clang/Basic/Diagnostic.h:1750
¶virtual void finish()
virtual void finish()
Description
Callback to inform the diagnostic client that processing of all source files has ended.
Declared at: clang/include/clang/Basic/Diagnostic.h:1775
¶unsigned int getNumErrors() const
unsigned int getNumErrors() const
Declared at: clang/include/clang/Basic/Diagnostic.h:1748
¶unsigned int getNumWarnings() const
unsigned int getNumWarnings() const
Declared at: clang/include/clang/Basic/Diagnostic.h:1749
¶virtual ~DiagnosticConsumer()
virtual ~DiagnosticConsumer()
Declared at: clang/include/clang/Basic/Diagnostic.h:1746