9#ifndef LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICCONSUMER_H
10#define LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICCONSUMER_H
17#include "llvm/ADT/DenseMap.h"
18#include "llvm/ADT/PointerIntPair.h"
19#include "llvm/ADT/StringRef.h"
52 static std::unique_ptr<Directive>
60 static const unsigned MaxCount = std::numeric_limits<unsigned>::max();
92 assert(!
DirectiveLoc.isInvalid() &&
"DirectiveLoc is invalid!");
94 "DiagnosticLoc is invalid!");
134 std::unique_ptr<DiagnosticConsumer> PrimaryClientOwner;
135 std::unique_ptr<TextDiagnosticBuffer> Buffer;
136 std::unique_ptr<MarkerTracker> Markers;
140 unsigned ActiveSourceFiles = 0;
143 bool CheckOrderOfDirectives;
144 bool OneDiagPerDirective;
145 bool DisableWildcardInDiagLoc;
147 void CheckDiagnostics();
150 assert((!SrcManager || SrcManager == &
SM) &&
"SourceManager changed!");
155 class UnparsedFileStatus {
157 bool FoundDirectives;
161 :
File(
File), FoundDirectives(FoundDirectives) {}
164 bool foundDirectives()
const {
return FoundDirectives; }
167 using ParsedFilesMap = llvm::DenseMap<FileID, const FileEntry *>;
168 using UnparsedFilesMap = llvm::DenseMap<FileID, UnparsedFileStatus>;
170 ParsedFilesMap ParsedFiles;
171 UnparsedFilesMap UnparsedFiles;
181 const Preprocessor *PP)
override;
Defines the Diagnostic-related interfaces.
Defines the clang::FileManager interface and associated types.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::Preprocessor interface.
Defines the clang::SourceLocation class and associated facilities.
DiagnosticConsumer()=default
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine a...
Concrete class used by the front-end to report problems and issues.
Level
The level of the diagnostic, after it has been through mapping.
Cached information about one file (either on disk or in the virtual file system).
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Encodes a location in the source.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
virtual ~Directive()=default
virtual bool isValid(std::string &Error)=0
Directive(SourceLocation DirectiveLoc, SourceLocation DiagnosticLoc, StringRef Spelling, bool MatchAnyFileAndLine, bool MatchAnyLine, StringRef Text, unsigned Min, unsigned Max, bool FullMatchRequired)
virtual DiagnosticMatchResult match(StringRef S) const =0
static const unsigned MaxCount
Constant representing n or more matches.
const std::string Spelling
static std::unique_ptr< Directive > create(bool RegexKind, SourceLocation DirectiveLoc, SourceLocation DiagnosticLoc, StringRef Spelling, bool MatchAnyFileAndLine, bool MatchAnyLine, StringRef Text, unsigned Min, unsigned Max, bool FullMatchRequired)
Directive(const Directive &)=delete
Directive & operator=(const Directive &)=delete
SourceLocation DiagnosticLoc
SourceLocation DirectiveLoc
void UpdateParsedFileStatus(SourceManager &SM, FileID FID, ParsedStatus PS)
Update lists of parsed and unparsed files.
VerifyDiagnosticConsumer(DiagnosticsEngine &Diags)
Create a new verifying diagnostic client, which will issue errors to the currently-attached diagnosti...
@ IsUnparsed
File has diagnostics and may have directives.
@ IsUnparsedNoDirectives
File has diagnostics but guaranteed no directives.
@ IsParsed
File has been processed via HandleComment.
void EndSourceFile() override
Callback to inform the diagnostic client that processing of a source file has ended.
void BeginSourceFile(const LangOptions &LangOpts, const Preprocessor *PP) override
Callback to inform the diagnostic client that processing of a source file is beginning.
std::vector< std::unique_ptr< Directive > > DirectiveList
~VerifyDiagnosticConsumer() override
@ HasExpectedNoDiagnostics
@ HasNoDirectivesReported
@ HasOtherExpectedDirectives
bool HandleComment(Preprocessor &PP, SourceRange Comment) override
HandleComment - Hook into the preprocessor and extract comments containing expected errors and warnin...
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.
The JSON file list parser is used to communicate input to InstallAPI.
CustomizableOptional< FileEntryRef > OptionalFileEntryRef
@ AtLeastPartial
Match, but not a full match.
@ Full
Match, but we didn't check for full match.
@ None
The alignment was not explicit in code.
ExpectedData - owns directive objects and deletes on destructor.
std::string FirstNoDiagnosticsDirective
bool AllDirectivesMatchExactlyOneDiag
bool WildcardsAreErroneouslyPresent