LLVM 24.0.0git
FileCheck.h
Go to the documentation of this file.
1//==-- llvm/FileCheck/FileCheck.h --------------------------------*- C++ -*-==//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9/// \file This file has some utilities to use FileCheck as an API
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_FILECHECK_FILECHECK_H
14#define LLVM_FILECHECK_FILECHECK_H
15
16#include "llvm/ADT/StringRef.h"
19#include "llvm/Support/Regex.h"
20#include "llvm/Support/SMLoc.h"
21#include <bitset>
22#include <iterator>
23#include <memory>
24#include <string>
25#include <vector>
26
27namespace llvm {
28class MemoryBuffer;
29class SourceMgr;
30template <typename T> class SmallVectorImpl;
31
32/// Contains info about various FileCheck options.
34 std::vector<StringRef> CheckPrefixes;
35 std::vector<StringRef> CommentPrefixes;
37 std::vector<StringRef> ImplicitCheckNot;
38 std::vector<StringRef> GlobalDefines;
39 bool AllowEmptyInput = false;
40 bool AllowUnusedPrefixes = false;
41 bool MatchFullLines = false;
42 bool IgnoreCase = false;
44 bool EnableVarScope = false;
46 bool Verbose = false;
47 bool VerboseVerbose = false;
48};
49
50namespace Check {
51
63
64 /// Indicates the pattern only matches the end of file. This is used for
65 /// trailing CHECK-NOTs.
67
68 /// Marks when parsing found a -NOT check combined with another CHECK suffix.
70
71 /// Marks when parsing found a -COUNT directive with invalid count value.
73};
74
76 /// Modifies directive to perform literal match.
78
79 // The number of modifier.
81};
82
84 FileCheckKind Kind;
85 int Count; ///< optional Count for some checks
86 /// Modifers for the check directive.
87 std::bitset<FileCheckKindModifier::Size> Modifiers;
88
89public:
90 FileCheckType(FileCheckKind Kind = CheckNone) : Kind(Kind), Count(1) {}
91 FileCheckType(const FileCheckType &) = default;
93
94 operator FileCheckKind() const { return Kind; }
95
96 int getCount() const { return Count; }
98
99 bool isLiteralMatch() const {
101 }
104 return *this;
105 }
106
107 // \returns a description of \p Prefix.
108 LLVM_ABI std::string getDescription(StringRef Prefix) const;
109
110 // \returns a description of \p Modifiers.
111 LLVM_ABI std::string getModifiersDescription() const;
112};
113} // namespace Check
114
115class MatchResultDiag;
116
117/// Abstract base class for recording a FileCheck diagnostic for a pattern
118/// (e.g., \c CHECK-NEXT directive or \c --implicit-check-not).
119///
120/// \c FileCheckDiag has two direct derived classes:
121/// - \c MatchResultDiag records a match result for a pattern. There might be
122/// more than one for a single pattern. For example, for \c CHECK-DAG there
123/// might be several discarded matches before either a good match or a failure
124/// to match.
125/// - \c MatchNoteDiag provides an additional note about the most recent
126/// \c MatchResultDiag emitted by a FileCheck invocation. For example, there
127/// might be a fuzzy match after a failure to match.
128///
129/// Throughout this class hierarchy, a pattern is said to be either expected or
130/// excluded depending on whether the pattern must have or must not have a match
131/// in order for it to succeed. For example, a \c CHECK directive's pattern is
132/// expected, and a \c CHECK-NOT directive's pattern is excluded.
134public:
147
148private:
149 const FileCheckDiagKind Kind;
150
151public:
152 FileCheckDiag(FileCheckDiagKind Kind) : Kind(Kind) {}
153 /// Destructor is purely virtual to ensure this remains an abstract class.
154 virtual ~FileCheckDiag() = 0;
155 /// Of what derived class is this an instance?
156 FileCheckDiagKind getKind() const { return Kind; }
157 /// If this is a \c MatchResultDiag, return itself. If this is a
158 /// \c MatchNoteDiag, return its associated \c MatchResultDiag.
159 virtual const MatchResultDiag &getMatchResultDiag() const = 0;
160 /// Does this diagnostic reveal a new error?
161 ///
162 /// For \c MatchResultDiag, \c !isError() is not always the same as a
163 /// successful pattern match result. For \c MatchNoteDiag, \c !isError()
164 /// does not indicate the lack of an error but rather the lack of an
165 /// additional error beyond its associated \c MatchResultDiag. See
166 /// documentation on derived types for details.
167 virtual bool isError() const = 0;
168 /// Return the input range for which this diagnostic indicates text that was
169 /// matched in some way (e.g., successful pattern match, discarded pattern
170 /// match, or variable capture), or return \c std::nullopt if the diagnostic
171 /// has no such input range.
172 virtual std::optional<SMRange> getMatchRange() const = 0;
173};
174
175/// Abstract base class for recording a FileCheck diagnostic that reports a
176/// match result for a pattern.
178private:
179 Check::FileCheckType CheckTy;
180 SMLoc CheckLoc;
181 SMRange SearchRange;
182
183public:
185 SMLoc CheckLoc, SMRange SearchRange)
186 : FileCheckDiag(Kind), CheckTy(CheckTy), CheckLoc(CheckLoc),
187 SearchRange(SearchRange) {}
188 /// Destructor is purely virtual to ensure this remains an abstract class.
189 virtual ~MatchResultDiag() = 0;
190 /// Is \p FCD an instance of \c MatchResultDiag?
191 static bool classof(const FileCheckDiag *FCD) {
192 FileCheckDiagKind Kind = FCD->getKind();
193 return MatchResultDiag_First <= Kind && Kind <= MatchResultDiag_Last;
194 }
195 /// Get itself.
196 const MatchResultDiag &getMatchResultDiag() const override { return *this; }
197 /// What is the type of pattern for this match result?
198 Check::FileCheckType getCheckTy() const { return CheckTy; }
199 /// Where is the pattern for this match result?
200 SMLoc getCheckLoc() const { return CheckLoc; }
201 /// What is the search range for the match result?
202 SMRange getSearchRange() const { return SearchRange; }
203};
204
205/// \c MatchResultDiag for a pattern that matched the input.
207public:
208 enum StatusTy {
209 /// Indicates a good match for an expected pattern.
211 /// Indicates a match for an excluded pattern (error).
213 /// Indicates a match for an expected pattern, but the match is on the
214 /// wrong line (error).
216 /// Indicates a discarded match for an expected pattern (not an error).
218 };
219
220private:
221 StatusTy Status;
222 SMRange MatchRange;
223
224public:
225 MatchFoundDiag(const Check::FileCheckType &CheckTy, SMLoc CheckLoc,
226 StatusTy Status, SMRange MatchRange, SMRange SearchRange)
227 : MatchResultDiag(FileCheckDiag::MatchFoundDiag, CheckTy, CheckLoc,
228 SearchRange),
229 Status(Status), MatchRange(MatchRange) {}
230 /// Is \p FCD an instance of \c MatchFoundDiag?
231 static bool classof(const FileCheckDiag *FCD) {
232 return FCD->getKind() == FileCheckDiag::MatchFoundDiag;
233 }
234 /// Does this match produce an error?
235 ///
236 /// This is not always the same as \c getStatus()!=Success. For example,
237 /// \c CHECK-DAG discarded matches are neither successful matches nor errors.
238 bool isError() const override {
239 return Status != Success && Status != Discarded;
240 }
241 /// Was this a successful match? If not, why not?
242 ///
243 /// See \c isError comments for the relationship between the two.
244 StatusTy getStatus() const { return Status; }
245 /// Adjust a successful status to a non-successful status.
246 ///
247 /// This is designed to be called while emitting diagnostics. It is not
248 /// designed to be called by a diagnostic presentation layer like
249 /// `-dump-input`.
250 ///
251 /// For example, a match that was originally thought to be successful might
252 /// later be discarded, or it might be determined that it violates a matching
253 /// constraint (e.g., wrong line).
255 assert(Status == Success && S != Success &&
256 "expected to change successful status to unsuccessful");
257 Status = S;
258 }
259 /// Return the match's input range, never \c std::nullopt.
260 std::optional<SMRange> getMatchRange() const override { return MatchRange; }
261};
262
263/// \c MatchResultDiag for a pattern that did not match the input.
265public:
266 enum StatusTy {
267 /// Indicates no match for an excluded pattern.
269 /// Indicates no match due to an expected or excluded pattern that has
270 /// proven to be invalid at match time (error). The exact problems are
271 /// usually reported in subsequent \c MatchNoteDiag objects.
273 /// Indicates no match for an expected pattern (error). In some cases, it
274 /// follows good matches (because multiple matches are expected) or
275 /// discarded matches for the pattern.
277 };
278
279private:
280 StatusTy Status;
281
282public:
283 MatchNoneDiag(const Check::FileCheckType &CheckTy, SMLoc CheckLoc,
284 StatusTy Status, SMRange SearchRange)
285 : MatchResultDiag(FileCheckDiag::MatchNoneDiag, CheckTy, CheckLoc,
286 SearchRange),
287 Status(Status) {}
288 /// Is \p FCD an instance of \c MatchNoneDiag?
289 static bool classof(const FileCheckDiag *FCD) {
290 return FCD->getKind() == FileCheckDiag::MatchNoneDiag;
291 }
292 /// Does the lack of match represent an error?
293 bool isError() const override { return Status != Success; }
294 /// Does the lack of a match indicate a success? If not, why not?
295 StatusTy getStatus() const { return Status; }
296 /// Return \c std::nullopt.
297 std::optional<SMRange> getMatchRange() const override { return std::nullopt; }
298};
299
300/// Abstract base class for recording a FileCheck diagnostic that provides an
301/// additional note (possibly a new error) about the most recent
302/// \c MatchResultDiag.
304private:
305 const MatchResultDiag *MRD;
306
307public:
308 MatchNoteDiag(FileCheckDiagKind Kind) : FileCheckDiag(Kind), MRD(nullptr) {}
309 /// Destructor is purely virtual to ensure this remains an abstract class.
310 virtual ~MatchNoteDiag() = 0;
311 /// Is \p FCD an instance of \c MatchNoteDiag?
312 static bool classof(const FileCheckDiag *FCD) {
313 FileCheckDiagKind Kind = FCD->getKind();
314 return MatchNoteDiag_First <= Kind && Kind <= MatchNoteDiag_Last;
315 }
316 /// Get the note's associated \c MatchResultDiag.
317 const MatchResultDiag &getMatchResultDiag() const override { return *MRD; }
318 /// Set the note's associated \c MatchResultDiag.
320 assert(!MRD && "expected setMatchResultDiag to be called only once");
321 MRD = MRDNew;
322 }
323};
324
328
329/// \c MatchNoteDiag for a fuzzy match that serves as a suggestion for the next
330/// intended match for an expected pattern with too few or no good matches.
332private:
333 SMLoc MatchStart;
334
335public:
337 : MatchNoteDiag(FileCheckDiag::MatchFuzzyDiag), MatchStart(MatchStart) {}
338 /// Is \p FCD an instance of \c MatchFuzzyDiag?
339 static bool classof(const FileCheckDiag *FCD) {
340 return FCD->getKind() == FileCheckDiag::MatchFuzzyDiag;
341 }
342 /// Always false. A fuzzy match is not an error even though it is performed
343 /// due to an error.
344 bool isError() const override { return false; }
345 /// Return an input range (never \c std::nullopt) starting and ending at the
346 /// match start. The actual match end is not computed.
347 std::optional<SMRange> getMatchRange() const override {
348 return SMRange(MatchStart, MatchStart);
349 }
350};
351
352/// \c MatchNoteDiag with a custom note not described by any other class derived
353/// from \c MatchNoteDiag.
355private:
356 std::string Note;
357 bool AddsError;
358 std::optional<SMRange> MatchRange;
359
360public:
361 /// If \p MatchRange is specified, it is a range for input text that was
362 /// matched in some way (e.g., variable capture) and that is described by
363 /// this note. Either way, as usual, the associated \c MatchResultDiag has
364 /// any full match range for the pattern.
365 ///
366 /// If \p AddsError is true, then this note indicates a \a new error that is
367 /// distinct from any error indicated by the associated \c MatchResultDiag.
368 /// The error is described by \c Note, which must be worded appropriately for
369 /// prepending "error: " when presented later. For example, the associated
370 /// \c MatchResultDiag might indicate a match to either an expected pattern
371 /// (success) or an excluded pattern (error), and \c Note might be "unable to
372 /// represent numeric value" to indicate the match could not be processed
373 /// afterward.
374 ///
375 /// If \p AddsError is false, then this note merely provides additional
376 /// information about the associated \c MatchResultDiag. That information
377 /// might be something harmless (e.g., variable substitution), or it might be
378 /// one of potentially many problems summarized as an error by the
379 /// \c MatchResultDiag (e.g., one way in which the pattern was invalid).
380 ///@{
382 bool AddsError = false)
384 AddsError(AddsError), MatchRange(MatchRange) {}
388 ///@}
389 /// Is \p FCD an instance of \c MatchCustomNoteDiag?
390 static bool classof(const FileCheckDiag *FCD) {
392 }
393 const std::string &getNote() const { return Note; }
394 /// Does this note indicate an \a additional error not indicated by the
395 /// associated \c MatchResultDiag?
396 ///
397 /// For details, see the \c MatchCustomNoteDiag::MatchCustomNoteDiag comments
398 /// for its \c AddsError parameter.
399 bool isError() const override { return AddsError; }
400 /// Return the match range described by the note, or \c std::nullopt if none.
401 std::optional<SMRange> getMatchRange() const override { return MatchRange; }
402};
403
404/// A \c FileCheckDiag series emitted by the FileCheck library.
406private:
407 MatchResultDiag *CurMatchResultDiag = nullptr;
408 using vector_type = std::vector<std::unique_ptr<FileCheckDiag>>;
409 vector_type DiagList;
410
411public:
412 /// Emplace a new \c FileCheckDiag of type \c DiagTy. If it's a
413 /// \c MatchNoteDiag, associate it with its \c MatchResultDiag.
414 ///
415 /// \c FileCheckTest.cpp calls \c Pattern::printVariableDefs directly, so it
416 /// can add a \c MatchNoteDiag without a previous \c MatchResultDiag.
417 /// Otherwise, there should always be a previous \c MatchResultDiag.
418 template <typename DiagTy, typename... ArgTys>
419 void emplace(ArgTys &&...Args) {
420 DiagList.emplace_back(
421 std::make_unique<DiagTy>(std::forward<ArgTys>(Args)...));
422 FileCheckDiag *Diag = DiagList.back().get();
424 CurMatchResultDiag = MRD;
425 return;
426 }
428 if (!CurMatchResultDiag)
429 return;
430 Note->setMatchResultDiag(CurMatchResultDiag);
431 }
432 /// Adjust the previous \c MatchResultDiag, which must be a \c MatchFoundDiag,
433 /// from successful status to unsuccessful status.
435 cast<MatchFoundDiag>(CurMatchResultDiag)->markUnsuccessful(Status);
436 }
437 class const_iterator {
438 friend FileCheckDiagList;
439
440 public:
441 using difference_type = std::ptrdiff_t;
443 using pointer = const FileCheckDiag *;
444 using reference = const FileCheckDiag &;
445 using iterator_category = std::forward_iterator_tag;
446
447 private:
448 vector_type::const_iterator Itr;
449 const_iterator(vector_type::const_iterator Itr) : Itr(Itr) {}
450
451 public:
452 reference operator*() const { return **Itr; }
453 pointer operator->() const { return &operator*(); }
454 const_iterator &operator++() {
455 ++Itr;
456 return *this;
457 }
458 const_iterator operator++(int) {
459 const_iterator Old = *this;
460 ++Itr;
461 return Old;
462 }
463 bool operator==(const const_iterator &Other) const {
464 return Itr == Other.Itr;
465 }
466 bool operator!=(const const_iterator &Other) const {
467 return Itr != Other.Itr;
468 }
469 };
470
471 using size_type = vector_type::size_type;
472 const_iterator begin() const { return const_iterator(DiagList.begin()); }
473 const_iterator end() const { return const_iterator(DiagList.end()); }
474 const FileCheckDiag &operator[](size_type I) const { return *DiagList[I]; }
475 size_type size() const { return DiagList.size(); }
476};
477
478class FileCheckPatternContext;
479struct FileCheckString;
480
481/// FileCheck class takes the request and exposes various methods that
482/// use information from the request.
485 std::unique_ptr<FileCheckPatternContext> PatternContext;
486 std::vector<FileCheckString> CheckStrings;
487
488public:
489 LLVM_ABI explicit FileCheck(FileCheckRequest Req);
491
492 /// Reads the check file from \p Buffer and records the expected strings it
493 /// contains. Errors are reported against \p SM.
494 ///
495 /// If \p ImpPatBufferIDRange, then the range (inclusive start, exclusive end)
496 /// of IDs for source buffers added to \p SM for implicit patterns are
497 /// recorded in it. The range is empty if there are none.
498 LLVM_ABI bool
500 std::pair<unsigned, unsigned> *ImpPatBufferIDRange = nullptr);
501
503
504 /// Canonicalizes whitespaces in the file. Line endings are replaced with
505 /// UNIX-style '\n'.
508
509 /// Checks the input to FileCheck provided in the \p Buffer against the
510 /// expected strings read from the check file and record diagnostics emitted
511 /// in \p Diags. Errors are recorded against \p SM.
512 ///
513 /// \returns false if the input fails to satisfy the checks.
514 LLVM_ABI bool checkInput(SourceMgr &SM, StringRef Buffer,
515 FileCheckDiagList *Diags = nullptr);
516};
517
518} // namespace llvm
519
520#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_ABI
Definition Compiler.h:215
#define I(x, y, z)
Definition MD5.cpp:57
LLVM_ABI std::string getDescription(StringRef Prefix) const
FileCheckType(FileCheckKind Kind=CheckNone)
Definition FileCheck.h:90
FileCheckType & operator=(const FileCheckType &)=default
bool isLiteralMatch() const
Definition FileCheck.h:99
LLVM_ABI std::string getModifiersDescription() const
FileCheckType & setLiteralMatch(bool Literal=true)
Definition FileCheck.h:102
LLVM_ABI FileCheckType & setCount(int C)
FileCheckType(const FileCheckType &)=default
bool operator!=(const const_iterator &Other) const
Definition FileCheck.h:466
bool operator==(const const_iterator &Other) const
Definition FileCheck.h:463
std::forward_iterator_tag iterator_category
Definition FileCheck.h:445
A FileCheckDiag series emitted by the FileCheck library.
Definition FileCheck.h:405
const FileCheckDiag & operator[](size_type I) const
Definition FileCheck.h:474
const_iterator begin() const
Definition FileCheck.h:472
const_iterator end() const
Definition FileCheck.h:473
void emplace(ArgTys &&...Args)
Emplace a new FileCheckDiag of type DiagTy.
Definition FileCheck.h:419
vector_type::size_type size_type
Definition FileCheck.h:471
void adjustPrevMatchFoundDiag(MatchFoundDiag::StatusTy Status)
Adjust the previous MatchResultDiag, which must be a MatchFoundDiag, from successful status to unsucc...
Definition FileCheck.h:434
size_type size() const
Definition FileCheck.h:475
Abstract base class for recording a FileCheck diagnostic for a pattern (e.g., CHECK-NEXT directive or...
Definition FileCheck.h:133
virtual ~FileCheckDiag()=0
Destructor is purely virtual to ensure this remains an abstract class.
Definition FileCheck.h:325
virtual const MatchResultDiag & getMatchResultDiag() const =0
If this is a MatchResultDiag, return itself.
virtual std::optional< SMRange > getMatchRange() const =0
Return the input range for which this diagnostic indicates text that was matched in some way (e....
FileCheckDiag(FileCheckDiagKind Kind)
Definition FileCheck.h:152
virtual bool isError() const =0
Does this diagnostic reveal a new error?
FileCheckDiagKind getKind() const
Of what derived class is this an instance?
Definition FileCheck.h:156
LLVM_ABI bool readCheckFile(SourceMgr &SM, StringRef Buffer, std::pair< unsigned, unsigned > *ImpPatBufferIDRange=nullptr)
Reads the check file from Buffer and records the expected strings it contains.
LLVM_ABI StringRef CanonicalizeFile(MemoryBuffer &MB, SmallVectorImpl< char > &OutputBuffer)
Canonicalizes whitespaces in the file.
LLVM_ABI FileCheck(FileCheckRequest Req)
LLVM_ABI ~FileCheck()
LLVM_ABI bool checkInput(SourceMgr &SM, StringRef Buffer, FileCheckDiagList *Diags=nullptr)
Checks the input to FileCheck provided in the Buffer against the expected strings read from the check...
LLVM_ABI bool ValidateCheckPrefixes()
bool isError() const override
Does this note indicate an additional error not indicated by the associated MatchResultDiag?
Definition FileCheck.h:399
MatchCustomNoteDiag(SMRange MatchRange, StringRef Note, bool AddsError=false)
If MatchRange is specified, it is a range for input text that was matched in some way (e....
Definition FileCheck.h:381
static bool classof(const FileCheckDiag *FCD)
Is FCD an instance of MatchCustomNoteDiag?
Definition FileCheck.h:390
const std::string & getNote() const
Definition FileCheck.h:393
MatchCustomNoteDiag(StringRef Note)
Definition FileCheck.h:385
std::optional< SMRange > getMatchRange() const override
Return the match range described by the note, or std::nullopt if none.
Definition FileCheck.h:401
std::optional< SMRange > getMatchRange() const override
Return the match's input range, never std::nullopt.
Definition FileCheck.h:260
@ Success
Indicates a good match for an expected pattern.
Definition FileCheck.h:210
@ Excluded
Indicates a match for an excluded pattern (error).
Definition FileCheck.h:212
@ Discarded
Indicates a discarded match for an expected pattern (not an error).
Definition FileCheck.h:217
@ WrongLine
Indicates a match for an expected pattern, but the match is on the wrong line (error).
Definition FileCheck.h:215
StatusTy getStatus() const
Was this a successful match?
Definition FileCheck.h:244
static bool classof(const FileCheckDiag *FCD)
Is FCD an instance of MatchFoundDiag?
Definition FileCheck.h:231
void markUnsuccessful(StatusTy S)
Adjust a successful status to a non-successful status.
Definition FileCheck.h:254
MatchFoundDiag(const Check::FileCheckType &CheckTy, SMLoc CheckLoc, StatusTy Status, SMRange MatchRange, SMRange SearchRange)
Definition FileCheck.h:225
bool isError() const override
Does this match produce an error?
Definition FileCheck.h:238
std::optional< SMRange > getMatchRange() const override
Return an input range (never std::nullopt) starting and ending at the match start.
Definition FileCheck.h:347
bool isError() const override
Always false.
Definition FileCheck.h:344
MatchFuzzyDiag(SMLoc MatchStart)
Definition FileCheck.h:336
static bool classof(const FileCheckDiag *FCD)
Is FCD an instance of MatchFuzzyDiag?
Definition FileCheck.h:339
static bool classof(const FileCheckDiag *FCD)
Is FCD an instance of MatchNoneDiag?
Definition FileCheck.h:289
bool isError() const override
Does the lack of match represent an error?
Definition FileCheck.h:293
StatusTy getStatus() const
Does the lack of a match indicate a success? If not, why not?
Definition FileCheck.h:295
@ Expected
Indicates no match for an expected pattern (error).
Definition FileCheck.h:276
@ Success
Indicates no match for an excluded pattern.
Definition FileCheck.h:268
@ InvalidPattern
Indicates no match due to an expected or excluded pattern that has proven to be invalid at match time...
Definition FileCheck.h:272
MatchNoneDiag(const Check::FileCheckType &CheckTy, SMLoc CheckLoc, StatusTy Status, SMRange SearchRange)
Definition FileCheck.h:283
std::optional< SMRange > getMatchRange() const override
Return std::nullopt.
Definition FileCheck.h:297
Abstract base class for recording a FileCheck diagnostic that provides an additional note (possibly a...
Definition FileCheck.h:303
MatchNoteDiag(FileCheckDiagKind Kind)
Definition FileCheck.h:308
static bool classof(const FileCheckDiag *FCD)
Is FCD an instance of MatchNoteDiag?
Definition FileCheck.h:312
virtual ~MatchNoteDiag()=0
Destructor is purely virtual to ensure this remains an abstract class.
Definition FileCheck.h:327
const MatchResultDiag & getMatchResultDiag() const override
Get the note's associated MatchResultDiag.
Definition FileCheck.h:317
void setMatchResultDiag(const MatchResultDiag *MRDNew)
Set the note's associated MatchResultDiag.
Definition FileCheck.h:319
Abstract base class for recording a FileCheck diagnostic that reports a match result for a pattern.
Definition FileCheck.h:177
Check::FileCheckType getCheckTy() const
What is the type of pattern for this match result?
Definition FileCheck.h:198
virtual ~MatchResultDiag()=0
Destructor is purely virtual to ensure this remains an abstract class.
Definition FileCheck.h:326
SMLoc getCheckLoc() const
Where is the pattern for this match result?
Definition FileCheck.h:200
SMRange getSearchRange() const
What is the search range for the match result?
Definition FileCheck.h:202
MatchResultDiag(FileCheckDiagKind Kind, const Check::FileCheckType &CheckTy, SMLoc CheckLoc, SMRange SearchRange)
Definition FileCheck.h:184
const MatchResultDiag & getMatchResultDiag() const override
Get itself.
Definition FileCheck.h:196
static bool classof(const FileCheckDiag *FCD)
Is FCD an instance of MatchResultDiag?
Definition FileCheck.h:191
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Represents a location in source code.
Definition SMLoc.h:22
Represents a range in source code.
Definition SMLoc.h:47
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition SourceMgr.h:34
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
FileCheckKindModifier
Definition FileCheck.h:75
@ ModifierLiteral
Modifies directive to perform literal match.
Definition FileCheck.h:77
@ CheckBadNot
Marks when parsing found a -NOT check combined with another CHECK suffix.
Definition FileCheck.h:69
@ CheckBadCount
Marks when parsing found a -COUNT directive with invalid count value.
Definition FileCheck.h:72
@ CheckEOF
Indicates the pattern only matches the end of file.
Definition FileCheck.h:66
@ CheckMisspelled
Definition FileCheck.h:54
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
@ Other
Any other memory.
Definition ModRef.h:68
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
Contains info about various FileCheck options.
Definition FileCheck.h:33
std::vector< StringRef > GlobalDefines
Definition FileCheck.h:38
std::vector< StringRef > ImplicitCheckNot
Definition FileCheck.h:37
std::vector< StringRef > CommentPrefixes
Definition FileCheck.h:35
std::vector< StringRef > CheckPrefixes
Definition FileCheck.h:34