clang 22.0.0git
clang::FilterAndStoreDiagnosticConsumer Class Reference

Diagnostic consumer that saves each diagnostic it is given. More...

#include "clang/Frontend/ASTUnit.h"

Inheritance diagram for clang::FilterAndStoreDiagnosticConsumer:
[legend]

Public Member Functions

 FilterAndStoreDiagnosticConsumer (SmallVectorImpl< StoredDiagnostic > *StoredDiags, SmallVectorImpl< StandaloneDiagnostic > *StandaloneDiags, bool CaptureNonErrorsFromIncludes)
void BeginSourceFile (const LangOptions &LangOpts, const Preprocessor *PP=nullptr) override
 Callback to inform the diagnostic client that processing of a source file is beginning.
void HandleDiagnostic (DiagnosticsEngine::Level Level, const Diagnostic &Info) override
 Handle this diagnostic, reporting it to the user or capturing it to a log as needed.
Public Member Functions inherited from clang::DiagnosticConsumer
 DiagnosticConsumer ()=default
virtual ~DiagnosticConsumer ()
unsigned getNumErrors () const
unsigned getNumWarnings () const
virtual void clear ()
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.

Additional Inherited Members

Protected Attributes inherited from clang::DiagnosticConsumer
unsigned NumWarnings = 0
 Number of warnings reported.
unsigned NumErrors = 0
 Number of errors reported.

Detailed Description

Diagnostic consumer that saves each diagnostic it is given.

Definition at line 913 of file ASTUnit.h.

Constructor & Destructor Documentation

◆ FilterAndStoreDiagnosticConsumer()

FilterAndStoreDiagnosticConsumer::FilterAndStoreDiagnosticConsumer ( SmallVectorImpl< StoredDiagnostic > * StoredDiags,
SmallVectorImpl< StandaloneDiagnostic > * StandaloneDiags,
bool CaptureNonErrorsFromIncludes )

Definition at line 578 of file ASTUnit.cpp.

Member Function Documentation

◆ BeginSourceFile()

void FilterAndStoreDiagnosticConsumer::BeginSourceFile ( const LangOptions & LangOpts,
const Preprocessor * PP = nullptr )
overridevirtual

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 from clang::DiagnosticConsumer.

Definition at line 588 of file ASTUnit.cpp.

References clang::Preprocessor::getSourceManager().

◆ HandleDiagnostic()

void FilterAndStoreDiagnosticConsumer::HandleDiagnostic ( DiagnosticsEngine::Level DiagLevel,
const Diagnostic & Info )
overridevirtual

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 from clang::DiagnosticConsumer.

Definition at line 603 of file ASTUnit.cpp.

References clang::Diagnostic::getSourceManager(), clang::DiagnosticConsumer::HandleDiagnostic(), clang::Diagnostic::hasSourceManager(), isInMainFile(), and clang::DiagnosticsEngine::Warning.


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