29 #include "llvm/ADT/STLExtras.h" 30 #include "llvm/ADT/SmallPtrSet.h" 31 #include "llvm/ADT/SmallString.h" 32 #include "llvm/ADT/StringRef.h" 33 #include "llvm/ADT/Twine.h" 34 #include "llvm/Support/ErrorHandling.h" 35 #include "llvm/Support/Regex.h" 36 #include "llvm/Support/raw_ostream.h" 47 using namespace clang;
63 : Verify(Verify),
SM(SM) {}
89 class StandardDirective :
public Directive {
92 bool MatchAnyLine, StringRef
Text,
unsigned Min,
94 :
Directive(DirectiveLoc, DiagnosticLoc, MatchAnyLine, Text, Min, Max) {}
96 bool isValid(std::string &
Error)
override {
101 bool match(StringRef S)
override {
102 return S.find(Text) != StringRef::npos;
107 class RegexDirective :
public Directive {
110 bool MatchAnyLine, StringRef
Text,
unsigned Min,
unsigned Max,
112 :
Directive(DirectiveLoc, DiagnosticLoc, MatchAnyLine, Text, Min, Max),
115 bool isValid(std::string &
Error)
override {
119 bool match(StringRef S)
override {
120 return Regex.match(S);
130 ParseHelper(StringRef S)
134 bool Next(StringRef S) {
139 return memcmp(
P, S.data(), S.size()) == 0;
144 bool Next(
unsigned &N) {
148 for (; PEnd < End && *PEnd >=
'0' && *PEnd <=
'9'; ++PEnd) {
162 if (
P ==
End || *
P !=
'#')
181 bool Search(StringRef S,
bool EnsureStartOfWord =
false,
182 bool FinishDirectiveToken =
false) {
185 P = std::search(
C,
End, S.begin(), S.end());
197 if (EnsureStartOfWord
201 || (
P > (
Begin + 1) && (
P[-1] ==
'/' ||
P[-1] ==
'*')
204 if (FinishDirectiveToken) {
206 || *PEnd ==
'-' || *PEnd ==
'_'))
213 assert(
isLetter(*
P) &&
"-verify prefix must start with a letter");
214 while (
isDigit(PEnd[-1]) || PEnd[-1] ==
'-')
224 bool SearchClosingBrace(StringRef OpenBrace, StringRef CloseBrace) {
228 StringRef S(
P,
End -
P);
229 if (S.startswith(OpenBrace)) {
231 P += OpenBrace.size();
232 }
else if (S.startswith(CloseBrace)) {
235 PEnd =
P + CloseBrace.size();
238 P += CloseBrace.size();
255 StringRef Match() {
return StringRef(
P, PEnd -
P); }
258 void SkipWhitespace() {
269 const char *
const Begin;
272 const char *
const End;
282 const char *PEnd =
nullptr;
286 struct UnattachedDirective {
288 bool RegexKind =
false;
291 unsigned Min = 1, Max = 1;
299 std::unique_ptr<Directive> D =
301 MatchAnyLine, UD.Text, UD.Min, UD.Max);
304 if (!D->isValid(Error)) {
305 Diags.
Report(UD.ContentBegin, diag::err_verify_invalid_content)
306 << (UD.RegexKind ?
"regex" :
"string") << Error;
309 UD.DL->push_back(std::move(D));
332 llvm::StringMap<Marker> Markers;
336 llvm::StringMap<llvm::SmallVector<UnattachedDirective, 2>> DeferredDirectives;
343 auto InsertResult = Markers.insert(
346 Marker &M = InsertResult.first->second;
347 if (!InsertResult.second) {
352 auto Deferred = DeferredDirectives.find(MarkerName);
353 if (Deferred != DeferredDirectives.end()) {
354 for (
auto &UD : Deferred->second) {
355 if (M.UseLoc.isInvalid())
356 M.UseLoc = UD.DirectivePos;
357 attachDirective(Diags, UD, Pos);
359 DeferredDirectives.erase(Deferred);
365 void addDirective(StringRef MarkerName,
const UnattachedDirective &UD) {
366 auto MarkerIt = Markers.find(MarkerName);
367 if (MarkerIt != Markers.end()) {
368 Marker &M = MarkerIt->second;
369 if (M.UseLoc.isInvalid())
370 M.UseLoc = UD.DirectivePos;
371 return attachDirective(Diags, UD, M.DefLoc);
373 DeferredDirectives[MarkerName].push_back(UD);
379 for (
auto &MarkerInfo : Markers) {
380 StringRef Name = MarkerInfo.first();
381 Marker &M = MarkerInfo.second;
382 if (M.RedefLoc.isValid() && M.UseLoc.isValid()) {
383 Diags.
Report(M.UseLoc, diag::err_verify_ambiguous_marker) << Name;
384 Diags.
Report(M.DefLoc, diag::note_verify_ambiguous_marker) << Name;
385 Diags.
Report(M.RedefLoc, diag::note_verify_ambiguous_marker) << Name;
389 for (
auto &DeferredPair : DeferredDirectives) {
390 Diags.
Report(DeferredPair.second.front().DirectivePos,
391 diag::err_verify_no_such_marker)
392 << DeferredPair.first();
408 for (ParseHelper PH(S); !PH.Done();) {
409 if (!PH.Search(
"#",
true))
412 if (!PH.NextMarker()) {
422 bool FoundDirective =
false;
423 for (ParseHelper PH(S); !PH.Done();) {
428 if (!(Prefixes.size() == 1 ? PH.Search(*Prefixes.begin(),
true,
true)
429 : PH.Search(
"",
true,
true)))
432 StringRef DToken = PH.Match();
436 UnattachedDirective D;
437 const char *KindStr =
"string";
446 if (DToken.endswith(
"-re")) {
449 DToken = DToken.substr(0, DToken.size()-3);
455 if (DToken.endswith(DType=
"-error"))
456 D.DL = ED ? &ED->
Errors :
nullptr;
457 else if (DToken.endswith(DType=
"-warning"))
458 D.DL = ED ? &ED->
Warnings :
nullptr;
459 else if (DToken.endswith(DType=
"-remark"))
460 D.DL = ED ? &ED->
Remarks :
nullptr;
461 else if (DToken.endswith(DType=
"-note"))
462 D.DL = ED ? &ED->
Notes :
nullptr;
463 else if (DToken.endswith(DType=
"-no-diagnostics")) {
470 DToken = DToken.substr(0, DToken.size()-DType.size());
475 if (!std::binary_search(Prefixes.begin(), Prefixes.end(), DToken))
480 Diags.
Report(Pos, diag::err_verify_invalid_no_diags)
487 Diags.
Report(Pos, diag::err_verify_invalid_no_diags)
501 bool MatchAnyLine =
false;
507 bool FoundPlus = PH.Next(
"+");
508 if (FoundPlus || PH.Next(
"-")) {
511 bool Invalid =
false;
513 if (!Invalid && PH.Next(Line) && (FoundPlus || Line < ExpectedLine)) {
514 if (FoundPlus) ExpectedLine +=
Line;
515 else ExpectedLine -=
Line;
518 }
else if (PH.Next(Line)) {
522 }
else if (PH.NextMarker()) {
524 }
else if (PP && PH.Search(
":")) {
526 StringRef
Filename(PH.C, PH.P-PH.C);
532 PP->
LookupFile(Pos, Filename,
false,
nullptr,
nullptr, CurDir,
533 nullptr,
nullptr,
nullptr,
nullptr,
nullptr);
536 diag::err_verify_missing_file) << Filename << KindStr;
543 if (PH.Next(Line) && Line > 0)
545 else if (PH.Next(
"*")) {
549 }
else if (PH.Next(
"*")) {
554 if (ExpectedLoc.
isInvalid() && !MatchAnyLine && Marker.empty()) {
556 diag::err_verify_missing_line) << KindStr;
566 if (PH.Next(D.Min)) {
573 }
else if (PH.Next(
"-")) {
575 if (!PH.Next(D.Max) || D.Max < D.Min) {
577 diag::err_verify_invalid_range) << KindStr;
584 }
else if (PH.Next(
"+")) {
594 if (!PH.Next(
"{{")) {
596 diag::err_verify_missing_start) << KindStr;
600 const char*
const ContentBegin = PH.C;
602 if (!PH.SearchClosingBrace(
"{{",
"}}")) {
604 diag::err_verify_missing_end) << KindStr;
607 const char*
const ContentEnd = PH.P;
610 D.DirectivePos = Pos;
614 StringRef NewlineStr =
"\\n";
615 StringRef Content(ContentBegin, ContentEnd-ContentBegin);
618 while ((FPos = Content.find(NewlineStr, CPos)) != StringRef::npos) {
619 D.Text += Content.substr(CPos, FPos-CPos);
621 CPos = FPos + NewlineStr.size();
624 D.Text.assign(ContentBegin, ContentEnd);
627 if (D.RegexKind && D.Text.find(
"{{") == StringRef::npos) {
628 Diags.
Report(D.ContentBegin, diag::err_verify_missing_regex) << D.Text;
633 attachDirective(Diags, D, ExpectedLoc, MatchAnyLine);
636 FoundDirective =
true;
639 return FoundDirective;
643 : Diags(Diags_), PrimaryClient(Diags.getClient()),
644 PrimaryClientOwner(Diags.takeClient()),
646 Status(HasNoDirectives) {
652 assert(!ActiveSourceFiles &&
"Incomplete parsing of source files!");
653 assert(!CurrentPreprocessor &&
"CurrentPreprocessor should be invalid!");
654 SrcManager =
nullptr;
657 "The VerifyDiagnosticConsumer takes over ownership of the client!");
665 if (++ActiveSourceFiles == 1) {
667 CurrentPreprocessor = PP;
668 this->LangOpts = &LangOpts;
670 const_cast<Preprocessor *
>(PP)->addCommentHandler(
this);
674 llvm::make_unique<VerifyFileTracker>(*
this, *SrcManager));
679 assert((!PP || CurrentPreprocessor == PP) &&
"Preprocessor changed!");
684 assert(ActiveSourceFiles &&
"No active source files!");
688 if (--ActiveSourceFiles == 0) {
689 if (CurrentPreprocessor)
691 removeCommentHandler(
this);
698 CurrentPreprocessor =
nullptr;
725 if (FE && CurrentPreprocessor && SrcManager->
isLoadedFileID(FID)) {
740 Buffer->HandleDiagnostic(DiagLevel, Info);
750 if (SrcManager && &SM != SrcManager)
762 size_t loc = C.find(
'\\');
763 if (loc == StringRef::npos) {
769 C2.reserve(C.size());
771 for (
size_t last = 0;; loc = C.find(
'\\', last)) {
772 if (loc == StringRef::npos || loc == C.size()) {
773 C2 += C.substr(last);
776 C2 += C.substr(last, loc-last);
779 if (C[last] ==
'\n' || C[last] ==
'\r') {
784 if (C[last] ==
'\n' || C[last] ==
'\r')
785 if (C[last] != C[last-1])
811 const llvm::MemoryBuffer *FromFile = SM.
getBuffer(FID);
812 Lexer RawLex(FID, FromFile, SM, LangOpts);
823 if (!Tok.
is(tok::comment))
continue;
825 std::string Comment = RawLex.
getSpelling(Tok, SM, LangOpts);
826 if (Comment.empty())
continue;
846 if (diag_begin == diag_end)
return 0;
849 llvm::raw_svector_ostream OS(Fmt);
851 if (I->first.isInvalid() || !SourceMgr)
852 OS <<
"\n (frontend)";
857 OS <<
" File " << File->getName();
860 OS <<
": " << I->second;
864 << Kind <<
true << OS.str();
872 std::vector<Directive *> &DL,
const char *
Kind) {
877 llvm::raw_svector_ostream OS(Fmt);
878 for (
const auto *D : DL) {
879 if (D->DiagnosticLoc.isInvalid())
882 OS <<
"\n File " << SourceMgr.
getFilename(D->DiagnosticLoc);
887 if (D->DirectiveLoc != D->DiagnosticLoc)
888 OS <<
" (directive at " 891 OS <<
": " << D->Text;
895 << Kind <<
false << OS.str();
922 bool IgnoreUnexpected) {
923 std::vector<Directive *> LeftOnly;
926 for (
auto &Owner : Left) {
930 for (
unsigned i = 0;
i < D.
Max; ++
i) {
931 DiagList::iterator II, IE;
932 for (II = Right.begin(), IE = Right.end(); II != IE; ++II) {
935 if (LineNo1 != LineNo2)
943 const std::string &RightText = II->second;
944 if (D.
match(RightText))
949 if (
i >= D.
Min)
break;
950 LeftOnly.push_back(&D);
958 unsigned num =
PrintExpected(Diags, SourceMgr, LeftOnly, Label);
959 if (!IgnoreUnexpected)
975 unsigned NumProblems = 0;
1007 setSourceManager(SM);
1017 UnparsedFiles.erase(FID);
1018 ParsedFiles.insert(std::make_pair(FID, FE));
1019 }
else if (!ParsedFiles.count(FID) && !UnparsedFiles.count(FID)) {
1023 bool FoundDirectives;
1025 FoundDirectives =
false;
1027 FoundDirectives = !LangOpts ||
findDirectives(SM, FID, *LangOpts);
1030 UnparsedFiles.insert(std::make_pair(FID,
1031 UnparsedFileStatus(FE, FoundDirectives)));
1036 void VerifyDiagnosticConsumer::CheckDiagnostics() {
1039 std::unique_ptr<DiagnosticConsumer> Owner = Diags.
takeClient();
1049 if (!UnparsedFiles.empty()) {
1051 llvm::SmallPtrSet<const FileEntry *, 8> ParsedFileCache;
1052 for (
const auto &I : ParsedFiles)
1054 ParsedFileCache.insert(FE);
1057 for (
const auto &I : UnparsedFiles) {
1058 const UnparsedFileStatus &Status = I.second;
1062 if (FE && ParsedFileCache.count(FE))
1066 if (Status.foundDirectives()) {
1067 llvm::report_fatal_error(Twine(
"-verify directives found after rather" 1068 " than during normal parsing of ",
1069 StringRef(FE ? FE->
getName() :
"(unknown)")));
1074 UnparsedFiles.clear();
1094 Buffer->err_end(),
"error");
1097 Buffer->warn_end(),
"warn");
1100 Buffer->remark_end(),
"remark");
1103 Buffer->note_end(),
"note");
1106 Diags.
setClient(CurClient, Owner.release() !=
nullptr);
1116 bool MatchAnyLine, StringRef
Text,
1117 unsigned Min,
unsigned Max) {
1123 std::string RegexStr;
1125 while (!S.empty()) {
1126 if (S.startswith(
"{{")) {
1127 S = S.drop_front(2);
1128 size_t RegexMatchLength = S.find(
"}}");
1129 assert(RegexMatchLength != StringRef::npos);
1132 RegexStr.append(S.data(), RegexMatchLength);
1134 S = S.drop_front(RegexMatchLength + 2);
1136 size_t VerbatimMatchLength = S.find(
"{{");
1137 if (VerbatimMatchLength == StringRef::npos)
1138 VerbatimMatchLength = S.size();
1140 RegexStr += llvm::Regex::escape(S.substr(0, VerbatimMatchLength));
1141 S = S.drop_front(VerbatimMatchLength);
1145 return llvm::make_unique<RegexDirective>(
static unsigned getSpelling(const Token &Tok, const char *&Buffer, const SourceManager &SourceMgr, const LangOptions &LangOpts, bool *Invalid=nullptr)
getSpelling - This method is used to get the spelling of a token into a preallocated buffer...
bool isWrittenInSameFile(SourceLocation Loc1, SourceLocation Loc2) const
Returns true if the spelling locations for both SourceLocations are part of the same file buffer...
Lexer - This provides a simple interface that turns a text buffer into a stream of tokens...
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
DiagnosticConsumer * getClient()
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
std::vector< std::unique_ptr< Directive > > DirectiveList
VerifyDiagnosticConsumer - Create a diagnostic client which will use markers in the input source to c...
Defines the clang::FileManager interface and associated types.
SourceManager & getSourceManager() const
bool LexFromRawLexer(Token &Result)
LexFromRawLexer - Lex a token from a designated raw lexer (one with no associated preprocessor object...
unsigned NumErrors
Number of errors reported.
bool is(tok::TokenKind K) const
is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {...
Defines the SourceManager interface.
void UpdateParsedFileStatus(SourceManager &SM, FileID FID, ParsedStatus PS)
Update lists of parsed and unparsed files.
const_iterator remark_end() const
static unsigned CheckResults(DiagnosticsEngine &Diags, SourceManager &SourceMgr, const TextDiagnosticBuffer &Buffer, ExpectedData &ED)
CheckResults - This compares the expected results to those that were actually reported.
VerifyDiagnosticConsumer(DiagnosticsEngine &Diags)
Create a new verifying diagnostic client, which will issue errors to the currently-attached diagnosti...
bool isLoadedFileID(FileID FID) const
Returns true if FID came from a PCH/Module.
const char * getCharacterData(SourceLocation SL, bool *Invalid=nullptr) const
Return a pointer to the start of the specified location in the appropriate spelling MemoryBuffer...
File has been processed via HandleComment.
const DiagnosticBuilder & setForceEmit() const
Forces the diagnostic to be emitted.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
std::unique_ptr< DiagnosticConsumer > takeClient()
Return the current diagnostic client along with ownership of that client.
float __ovld __cnfn distance(float p0, float p1)
Returns the distance between p0 and p1.
SourceLocation getImmediateMacroCallerLoc(SourceLocation Loc) const
Gets the location of the immediate macro caller, one level up the stack toward the initial macro type...
virtual void EndSourceFile()
Callback to inform the diagnostic client that processing of a source file has ended.
SourceLocation DiagnosticLoc
static std::unique_ptr< Directive > create(bool RegexKind, 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...
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
bool hasSourceManager() const
This interface provides a way to observe the actions of the preprocessor as it does its thing...
void EndSourceFile() override
Callback to inform the diagnostic client that processing of a source file has ended.
static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM, Preprocessor *PP, SourceLocation Pos, VerifyDiagnosticConsumer::DirectiveStatus &Status, VerifyDiagnosticConsumer::MarkerTracker &Markers)
ParseDirective - Go through the comment and see if it indicates expected diagnostics.
void setClient(DiagnosticConsumer *client, bool ShouldOwnClient=true)
Set the diagnostic client associated with this diagnostic object.
ExpectedData - owns directive objects and deletes on destructor.
LLVM_READONLY bool isLetter(unsigned char c)
Return true if this character is an ASCII letter: [a-zA-Z].
SourceLocation translateFileLineCol(const FileEntry *SourceFile, unsigned Line, unsigned Col) const
Get the source location for the given file:line:col triplet.
SourceLocation DirectiveLoc
Token - This structure provides full information about a lexed token.
void setKind(tok::TokenKind K)
const_iterator err_end() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
const_iterator note_begin() const
const_iterator note_end() const
FileID translateFile(const FileEntry *SourceFile) const
Get the FileID for the given file.
TextDiagnosticBuffer::DiagList DiagList
LLVM_READONLY bool isWhitespace(unsigned char c)
Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t', '\f', '\v', '\n', '\r'.
HeaderSearch & getHeaderSearchInfo() const
const SourceLocation & getLocation() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
Concrete class used by the front-end to report problems and issues.
void addMarker(StringRef MarkerName, SourceLocation Pos)
unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid=nullptr) const
Defines the Diagnostic-related interfaces.
DiagnosticsEngine & getDiagnostics() const
const_iterator err_begin() const
DiagList::const_iterator const_iterator
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
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.
std::vector< std::pair< SourceLocation, std::string > > DiagList
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
const AnnotatedLine * Line
FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, unsigned LoadedOffset=0)
Create a new FileID that represents the specified file being #included from the specified IncludePosi...
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file. ...
Defines the clang::Preprocessor interface.
static unsigned PrintUnexpected(DiagnosticsEngine &Diags, SourceManager *SourceMgr, const_diag_iterator diag_begin, const_diag_iterator diag_end, const char *Kind)
Takes a list of diagnostics that have been generated but not matched by an expected-* directive and p...
bool isWrittenInMainFile(SourceLocation Loc) const
Returns true if the spelling location for the given location is in the main file buffer.
LLVM_READONLY bool isAlphanumeric(unsigned char c)
Return true if this character is an ASCII letter or digit: [a-zA-Z0-9].
MarkerTracker(DiagnosticsEngine &Diags)
SourceLocation getEnd() const
unsigned getPresumedLineNumber(SourceLocation Loc, bool *Invalid=nullptr) const
DirectoryLookup - This class represents one entry in the search list that specifies the search order ...
bool HandleComment(Preprocessor &PP, SourceRange Comment) override
HandleComment - Hook into the preprocessor and extract comments containing expected errors and warnin...
SourceManager & getSourceManager() const
StringRef getFilename(SourceLocation SpellingLoc) const
Return the filename of the file containing a SourceLocation.
static bool IsFromSameFile(SourceManager &SM, SourceLocation DirectiveLoc, SourceLocation DiagnosticLoc)
Determine whether two source locations come from the same file.
Encodes a location in the source.
StringRef getName() const
Cached information about one file (either on disk or in the virtual file system). ...
void addDirective(StringRef MarkerName, const UnattachedDirective &UD)
const FileEntry * LookupFile(SourceLocation FilenameLoc, StringRef Filename, bool isAngled, const DirectoryLookup *FromDir, const FileEntry *FromFile, const DirectoryLookup *&CurDir, SmallVectorImpl< char > *SearchPath, SmallVectorImpl< char > *RelativePath, ModuleMap::KnownHeader *SuggestedModule, bool *IsMapped, bool *IsFrameworkFound, bool SkipCache=false)
Given a "foo" or <foo> reference, look up the indicated file.
SourceManager & getSourceManager() const
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...
bool isNot(tok::TokenKind K) const
virtual bool isValid(std::string &Error)=0
const llvm::MemoryBuffer * getBuffer(FileID FID, SourceLocation Loc, bool *Invalid=nullptr) const
Return the buffer for the specified FileID.
const_iterator warn_end() const
Dataflow Directional Tag Classes.
static unsigned PrintExpected(DiagnosticsEngine &Diags, SourceManager &SourceMgr, std::vector< Directive *> &DL, const char *Kind)
Takes a list of diagnostics that were expected to have been generated but were not and produces a dia...
bool isValid() const
Return true if this is a valid SourceLocation object.
static bool findDirectives(SourceManager &SM, FileID FID, const LangOptions &LangOpts)
Lex the specified source file to determine whether it contains any expected-* directives.
std::vector< std::string > VerifyPrefixes
The prefixes for comment directives sought by -verify ("expected" by default).
VerifyDiagnosticConsumer::DirectiveList DirectiveList
DiagnosticOptions & getDiagnosticOptions() const
Retrieve the diagnostic options.
VerifyDiagnosticConsumer::ExpectedData ExpectedData
SourceLocation translateLineCol(FileID FID, unsigned Line, unsigned Col) const
Get the source location in FID for the given line:col.
~VerifyDiagnosticConsumer() override
TextDiagnosticBuffer::const_iterator const_diag_iterator
LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
Defines the PPCallbacks interface.
Defines the clang::TokenKind enum and support functions.
const_iterator warn_begin() const
Defines the clang::SourceLocation class and associated facilities.
static const unsigned MaxCount
Constant representing n or more matches.
DiagnosticsEngine & getDiagnostics() const
Level
The level of the diagnostic, after it has been through mapping.
const_iterator remark_begin() const
bool hasSourceManager() const
static unsigned CheckLists(DiagnosticsEngine &Diags, SourceManager &SourceMgr, const char *Label, DirectiveList &Left, const_diag_iterator d2_begin, const_diag_iterator d2_end, bool IgnoreUnexpected)
CheckLists - Compare expected to seen diagnostic lists and return the the difference between them...
void SetCommentRetentionState(bool Mode)
SetCommentRetentionMode - Change the comment retention mode of the lexer to the specified mode...
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
DiagnosticLevelMask
A bitmask representing the diagnostic levels used by VerifyDiagnosticConsumer.
A trivial tuple used to represent a source range.
Directive - Abstract class representing a parsed verify directive.
virtual void BeginSourceFile(const LangOptions &LangOpts, const Preprocessor *PP=nullptr)
Callback to inform the diagnostic client that processing of a source file is beginning.
SourceLocation getBegin() const
VerifyDiagnosticConsumer::Directive 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.
bool ownsClient() const
Determine whether this DiagnosticsEngine object own its client.