10 #ifndef LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICCONSUMER_H
11 #define LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICCONSUMER_H
15 #include "llvm/ADT/DenseMap.h"
16 #include "llvm/ADT/PointerIntPair.h"
17 #include "llvm/ADT/STLExtras.h"
23 class DiagnosticsEngine;
24 class TextDiagnosticBuffer;
148 static std::unique_ptr<Directive>
create(
bool RegexKind,
152 unsigned Min,
unsigned Max);
171 virtual bool match(StringRef
S) = 0;
175 bool MatchAnyLine, StringRef Text,
unsigned Min,
unsigned Max)
176 : DirectiveLoc(DirectiveLoc), DiagnosticLoc(DiagnosticLoc),
177 Text(Text), Min(Min), Max(Max), MatchAnyLine(MatchAnyLine) {
178 assert(!DirectiveLoc.
isInvalid() &&
"DirectiveLoc is invalid!");
179 assert(!DiagnosticLoc.
isInvalid() &&
"DiagnosticLoc is invalid!");
184 void operator=(
const Directive &) =
delete;
215 std::unique_ptr<DiagnosticConsumer> PrimaryClientOwner;
216 std::unique_ptr<TextDiagnosticBuffer> Buffer;
220 unsigned ActiveSourceFiles;
224 void CheckDiagnostics();
226 assert((!SrcManager || SrcManager == &SM) &&
"SourceManager changed!");
231 class UnparsedFileStatus {
232 llvm::PointerIntPair<const FileEntry *, 1, bool> Data;
234 UnparsedFileStatus(
const FileEntry *File,
bool FoundDirectives)
235 : Data(File, FoundDirectives) {}
236 const FileEntry *getFile()
const {
return Data.getPointer(); }
237 bool foundDirectives()
const {
return Data.getInt(); }
239 typedef llvm::DenseMap<FileID, const FileEntry *> ParsedFilesMap;
240 typedef llvm::DenseMap<FileID, UnparsedFileStatus> UnparsedFilesMap;
241 ParsedFilesMap ParsedFiles;
242 UnparsedFilesMap UnparsedFiles;
252 const Preprocessor *PP)
override;
void UpdateParsedFileStatus(SourceManager &SM, FileID FID, ParsedStatus PS)
Update lists of parsed and unparsed files.
VerifyDiagnosticConsumer(DiagnosticsEngine &Diags)
File has been processed via HandleComment.
SourceLocation DiagnosticLoc
static std::unique_ptr< Directive > create(bool RegexKind, SourceLocation DirectiveLoc, SourceLocation DiagnosticLoc, bool MatchAnyLine, StringRef Text, unsigned Min, unsigned Max)
Directive(SourceLocation DirectiveLoc, SourceLocation DiagnosticLoc, bool MatchAnyLine, StringRef Text, unsigned Min, unsigned Max)
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...
void EndSourceFile() override
Callback to inform the diagnostic client that processing of a source file has ended.
SourceLocation DirectiveLoc
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Concrete class used by the front-end to report problems and issues.
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.
File has diagnostics but guaranteed no directives.
Defines the clang::Preprocessor interface.
bool HandleComment(Preprocessor &PP, SourceRange Comment) override
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
virtual bool match(StringRef S)=0
File has diagnostics and may have directives.
std::vector< std::unique_ptr< Directive > > DirectiveList
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
virtual bool isValid(std::string &Error)=0
Defines the Diagnostic-related interfaces.
~VerifyDiagnosticConsumer() override
static const unsigned MaxCount
Constant representing n or more matches.
Level
The level of the diagnostic, after it has been through mapping.
A trivial tuple used to represent a source range.
This class handles loading and caching of source files into memory.
void BeginSourceFile(const LangOptions &LangOpts, const Preprocessor *PP) override
Callback to inform the diagnostic client that processing of a source file is beginning.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.