10 #ifndef LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICCONSUMER_H 11 #define LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICCONSUMER_H 17 #include "llvm/ADT/DenseMap.h" 18 #include "llvm/ADT/PointerIntPair.h" 19 #include "llvm/ADT/StringRef.h" 31 class TextDiagnosticBuffer;
154 static std::unique_ptr<Directive>
create(
bool RegexKind,
158 unsigned Min,
unsigned Max);
179 virtual bool match(StringRef S) = 0;
183 bool MatchAnyLine, StringRef Text,
unsigned Min,
unsigned Max)
184 : DirectiveLoc(DirectiveLoc), DiagnosticLoc(DiagnosticLoc),
185 Text(Text), Min(Min), Max(Max), MatchAnyLine(MatchAnyLine) {
186 assert(!DirectiveLoc.
isInvalid() &&
"DirectiveLoc is invalid!");
188 "DiagnosticLoc is invalid!");
219 std::unique_ptr<DiagnosticConsumer> PrimaryClientOwner;
220 std::unique_ptr<TextDiagnosticBuffer> Buffer;
224 unsigned ActiveSourceFiles = 0;
228 void CheckDiagnostics();
231 assert((!SrcManager || SrcManager == &SM) &&
"SourceManager changed!");
236 class UnparsedFileStatus {
237 llvm::PointerIntPair<const FileEntry *, 1, bool> Data;
240 UnparsedFileStatus(
const FileEntry *File,
bool FoundDirectives)
241 : Data(File, FoundDirectives) {}
243 const FileEntry *getFile()
const {
return Data.getPointer(); }
244 bool foundDirectives()
const {
return Data.getInt(); }
247 using ParsedFilesMap = llvm::DenseMap<FileID, const FileEntry *>;
248 using UnparsedFilesMap = llvm::DenseMap<FileID, UnparsedFileStatus>;
250 ParsedFilesMap ParsedFiles;
251 UnparsedFilesMap UnparsedFiles;
287 #endif // LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICCONSUMER_H
std::vector< std::unique_ptr< Directive > > DirectiveList
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...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Concrete class used by the front-end to report problems and issues.
Defines the Diagnostic-related interfaces.
Directive(const Directive &)=delete
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...
Directive & operator=(const Directive &)=delete
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.
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.
virtual ~Directive()=default
~VerifyDiagnosticConsumer() override
Defines the clang::SourceLocation class and associated facilities.
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) ...
__DEVICE__ int max(int __a, int __b)
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.