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"
45 static std::unique_ptr<Directive>
49 unsigned Min,
unsigned Max);
53 static const unsigned MaxCount = std::numeric_limits<unsigned>::max();
72 virtual bool match(StringRef S) = 0;
82 assert(!
DirectiveLoc.isInvalid() &&
"DirectiveLoc is invalid!");
84 "DiagnosticLoc is invalid!");
122 std::unique_ptr<DiagnosticConsumer> PrimaryClientOwner;
123 std::unique_ptr<TextDiagnosticBuffer> Buffer;
124 std::unique_ptr<MarkerTracker> Markers;
128 unsigned ActiveSourceFiles = 0;
132 void CheckDiagnostics();
135 assert((!SrcManager || SrcManager == &
SM) &&
"SourceManager changed!");
140 class UnparsedFileStatus {
142 bool FoundDirectives;
146 :
File(
File), FoundDirectives(FoundDirectives) {}
149 bool foundDirectives()
const {
return FoundDirectives; }
152 using ParsedFilesMap = llvm::DenseMap<FileID, const FileEntry *>;
153 using UnparsedFilesMap = llvm::DenseMap<FileID, UnparsedFileStatus>;
155 ParsedFilesMap ParsedFiles;
156 UnparsedFilesMap UnparsedFiles;
166 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
Directive(SourceLocation DirectiveLoc, SourceLocation DiagnosticLoc, StringRef Spelling, bool MatchAnyFileAndLine, bool MatchAnyLine, StringRef Text, unsigned Min, unsigned Max)
virtual bool isValid(std::string &Error)=0
static std::unique_ptr< Directive > create(bool RegexKind, SourceLocation DirectiveLoc, SourceLocation DiagnosticLoc, StringRef Spelling, bool MatchAnyFileAndLine, bool MatchAnyLine, StringRef Text, unsigned Min, unsigned Max)
static const unsigned MaxCount
Constant representing n or more matches.
const std::string Spelling
Directive(const Directive &)=delete
virtual bool match(StringRef S)=0
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
ExpectedData - owns directive objects and deletes on destructor.
std::string FirstNoDiagnosticsDirective