9 #ifndef LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICCONSUMER_H 10 #define LLVM_CLANG_FRONTEND_VERIFYDIAGNOSTICCONSUMER_H 16 #include "llvm/ADT/DenseMap.h" 17 #include "llvm/ADT/PointerIntPair.h" 18 #include "llvm/ADT/StringRef.h" 30 class TextDiagnosticBuffer;
192 static std::unique_ptr<Directive>
create(
bool RegexKind,
196 unsigned Min,
unsigned Max);
217 virtual bool match(StringRef S) = 0;
221 bool MatchAnyLine, StringRef Text,
unsigned Min,
unsigned Max)
222 : DirectiveLoc(DirectiveLoc), DiagnosticLoc(DiagnosticLoc),
223 Text(Text), Min(Min), Max(Max), MatchAnyLine(MatchAnyLine) {
224 assert(!DirectiveLoc.
isInvalid() &&
"DirectiveLoc is invalid!");
226 "DiagnosticLoc is invalid!");
259 std::unique_ptr<DiagnosticConsumer> PrimaryClientOwner;
260 std::unique_ptr<TextDiagnosticBuffer> Buffer;
261 std::unique_ptr<MarkerTracker> Markers;
265 unsigned ActiveSourceFiles = 0;
269 void CheckDiagnostics();
272 assert((!SrcManager || SrcManager == &SM) &&
"SourceManager changed!");
277 class UnparsedFileStatus {
278 llvm::PointerIntPair<const FileEntry *, 1, bool> Data;
281 UnparsedFileStatus(
const FileEntry *File,
bool FoundDirectives)
282 : Data(File, FoundDirectives) {}
284 const FileEntry *getFile()
const {
return Data.getPointer(); }
285 bool foundDirectives()
const {
return Data.getInt(); }
288 using ParsedFilesMap = llvm::DenseMap<FileID, const FileEntry *>;
289 using UnparsedFilesMap = llvm::DenseMap<FileID, UnparsedFileStatus>;
291 ParsedFilesMap ParsedFiles;
292 UnparsedFilesMap UnparsedFiles;
328 #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
__DEVICE__ int max(int __a, int __b)
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) ...
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.