clang: clang::VerifyDiagnosticConsumer Class Reference (original) (raw)
VerifyDiagnosticConsumer - Create a diagnostic client which will use markers in the input source to check that all the emitted diagnostics match those expected. More...
#include "[clang/Frontend/VerifyDiagnosticConsumer.h](VerifyDiagnosticConsumer%5F8h%5Fsource.html)"
Classes | |
---|---|
class | Directive |
Directive - Abstract class representing a parsed verify directive. More... | |
struct | ExpectedData |
ExpectedData - owns directive objects and deletes on destructor. More... | |
class | MarkerTracker |
Public Types | |
---|---|
enum | DirectiveStatus { HasNoDirectives, HasNoDirectivesReported, HasExpectedNoDiagnostics, HasOtherExpectedDirectives } |
enum | ParsedStatus { IsParsed, IsUnparsed, IsUnparsedNoDirectives } |
using | DirectiveList = std::vector< std::unique_ptr< Directive > > |
Public Member Functions | |
---|---|
VerifyDiagnosticConsumer (DiagnosticsEngine &Diags) | |
Create a new verifying diagnostic client, which will issue errors to the currently-attached diagnostic client when a diagnostic does not match what is expected (as indicated in the source file). | |
~VerifyDiagnosticConsumer () override | |
void | BeginSourceFile (const LangOptions &LangOpts, const Preprocessor *PP) override |
Callback to inform the diagnostic client that processing of a source file is beginning. | |
void | EndSourceFile () override |
Callback to inform the diagnostic client that processing of a source file has ended. | |
void | UpdateParsedFileStatus (SourceManager &SM, FileID FID, ParsedStatus PS) |
Update lists of parsed and unparsed files. | |
bool | HandleComment (Preprocessor &PP, SourceRange Comment) override |
HandleComment - Hook into the preprocessor and extract comments containing expected errors and warnings. | |
void | HandleDiagnostic (DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override |
Handle this diagnostic, reporting it to the user or capturing it to a log as needed. | |
![]() |
|
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 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. | |
![]() |
|
virtual | ~CommentHandler () |
virtual bool | HandleComment (Preprocessor &PP, SourceRange Comment)=0 |
Additional Inherited Members | |
---|---|
![]() |
|
unsigned | NumWarnings = 0 |
Number of warnings reported. | |
unsigned | NumErrors = 0 |
Number of errors reported. | |
VerifyDiagnosticConsumer - Create a diagnostic client which will use markers in the input source to check that all the emitted diagnostics match those expected.
See clang/docs/InternalsManual.rst for details about how to write tests to verify diagnostics.
Definition at line 38 of file VerifyDiagnosticConsumer.h.
◆ DirectiveList
◆ DirectiveStatus
Enumerator |
---|
HasNoDirectives |
HasNoDirectivesReported |
HasExpectedNoDiagnostics |
HasOtherExpectedDirectives |
Definition at line 102 of file VerifyDiagnosticConsumer.h.
◆ ParsedStatus
Enumerator | |
---|---|
IsParsed | File has been processed via HandleComment. |
IsUnparsed | File has diagnostics and may have directives. |
IsUnparsedNoDirectives | File has diagnostics but guaranteed no directives. |
Definition at line 162 of file VerifyDiagnosticConsumer.h.
◆ ~VerifyDiagnosticConsumer()
VerifyDiagnosticConsumer::~VerifyDiagnosticConsumer ( ) | override |
---|
◆ BeginSourceFile()
void VerifyDiagnosticConsumer::BeginSourceFile ( const LangOptions & LangOpts, const Preprocessor * PP ) | overridevirtual |
---|
◆ EndSourceFile()
void VerifyDiagnosticConsumer::EndSourceFile ( ) | overridevirtual |
---|
◆ HandleComment()
◆ HandleDiagnostic()
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 730 of file VerifyDiagnosticConsumer.cpp.
References clang::HeaderSearch::findModuleForHeader(), clang::SourceManager::getExpansionLoc(), clang::SourceManager::getFileEntryRefForID(), clang::SourceManager::getFileID(), clang::Preprocessor::getHeaderSearchInfo(), clang::Diagnostic::getLocation(), clang::Diagnostic::getSourceManager(), clang::Diagnostic::hasSourceManager(), clang::SourceManager::isLoadedFileID(), IsUnparsed, IsUnparsedNoDirectives, clang::SourceLocation::isValid(), Loc, and UpdateParsedFileStatus().
◆ UpdateParsedFileStatus()
The documentation for this class was generated from the following files:
- include/clang/Frontend/VerifyDiagnosticConsumer.h
- lib/Frontend/VerifyDiagnosticConsumer.cpp