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!");
180 "DiagnosticLoc is invalid!");
185 void operator=(
const Directive &) =
delete;
216 std::unique_ptr<DiagnosticConsumer> PrimaryClientOwner;
217 std::unique_ptr<TextDiagnosticBuffer> Buffer;
221 unsigned ActiveSourceFiles;
225 void CheckDiagnostics();
227 assert((!SrcManager || SrcManager == &SM) &&
"SourceManager changed!");
232 class UnparsedFileStatus {
233 llvm::PointerIntPair<const FileEntry *, 1, bool> Data;
235 UnparsedFileStatus(
const FileEntry *File,
bool FoundDirectives)
236 : Data(File, FoundDirectives) {}
237 const FileEntry *getFile()
const {
return Data.getPointer(); }
238 bool foundDirectives()
const {
return Data.getInt(); }
240 typedef llvm::DenseMap<FileID, const FileEntry *> ParsedFilesMap;
241 typedef llvm::DenseMap<FileID, UnparsedFileStatus> UnparsedFilesMap;
242 ParsedFilesMap ParsedFiles;
243 UnparsedFilesMap UnparsedFiles;
VerifyDiagnosticConsumer - Create a diagnostic client which will use markers in the input source to c...
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...
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.
ExpectedData - owns directive objects and deletes on destructor.
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.
Defines the Diagnostic-related interfaces.
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
HandleComment - Hook into the preprocessor and extract comments containing expected errors and warnin...
Encodes a location in the source.
Cached information about one file (either on disk or in the virtual file system). ...
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
Dataflow Directional Tag Classes.
~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 little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
A trivial tuple used to represent a source range.
Directive - Abstract class representing a parsed verify directive.
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.