LLVM 23.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 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
325/// \c MatchNoteDiag for a fuzzy match that serves as a suggestion for the next
326/// intended match for an expected pattern with too few or no good matches.
328private:
329 SMLoc MatchStart;
330
331public:
333 : MatchNoteDiag(FileCheckDiag::MatchFuzzyDiag), MatchStart(MatchStart) {}
334 /// Is \p FCD an instance of \c MatchFuzzyDiag?
335 static bool classof(const FileCheckDiag *FCD) {
336 return FCD->getKind() == FileCheckDiag::MatchFuzzyDiag;
337 }
338 /// Always false. A fuzzy match is not an error even though it is performed
339 /// due to an error.
340 bool isError() const override { return false; }
341 /// Return an input range (never \c std::nullopt) starting and ending at the
342 /// match start. The actual match end is not computed.
343 std::optional<SMRange> getMatchRange() const override {
344 return SMRange(MatchStart, MatchStart);
345 }
346};
347
348/// \c MatchNoteDiag with a custom note not described by any other class derived
349/// from \c MatchNoteDiag.
351private:
352 std::string Note;
353 bool AddsError;
354 std::optional<SMRange> MatchRange;
355
356public:
357 /// If \p MatchRange is specified, it is a range for input text that was
358 /// matched in some way (e.g., variable capture) and that is described by
359 /// this note. Either way, as usual, the associated \c MatchResultDiag has
360 /// any full match range for the pattern.
361 ///
362 /// If \p AddsError is true, then this note indicates a \a new error that is
363 /// distinct from any error indicated by the associated \c MatchResultDiag.
364 /// The error is described by \c Note, which must be worded appropriately for
365 /// prepending "error: " when presented later. For example, the associated
366 /// \c MatchResultDiag might indicate a match to either an expected pattern
367 /// (success) or an excluded pattern (error), and \c Note might be "unable to
368 /// represent numeric value" to indicate the match could not be processed
369 /// afterward.
370 ///
371 /// If \p AddsError is false, then this note merely provides additional
372 /// information about the associated \c MatchResultDiag. That information
373 /// might be something harmless (e.g., variable substitution), or it might be
374 /// one of potentially many problems summarized as an error by the
375 /// \c MatchResultDiag (e.g., one way in which the pattern was invalid).
376 ///@{
378 bool AddsError = false)
380 AddsError(AddsError), MatchRange(MatchRange) {}
384 ///@}
385 /// Is \p FCD an instance of \c MatchCustomNoteDiag?
386 static bool classof(const FileCheckDiag *FCD) {
388 }
389 const std::string &getNote() const { return Note; }
390 /// Does this note indicate an \a additional error not indicated by the
391 /// associated \c MatchResultDiag?
392 ///
393 /// For details, see the \c MatchCustomNoteDiag::MatchCustomNoteDiag comments
394 /// for its \c AddsError parameter.
395 bool isError() const override { return AddsError; }
396 /// Return the match range described by the note, or \c std::nullopt if none.
397 std::optional<SMRange> getMatchRange() const override { return MatchRange; }
398};
399
400/// A \c FileCheckDiag series emitted by the FileCheck library.
402private:
403 MatchResultDiag *CurMatchResultDiag = nullptr;
404 using vector_type = std::vector<std::unique_ptr<FileCheckDiag>>;
405 vector_type DiagList;
406
407public:
408 /// Emplace a new \c FileCheckDiag of type \c DiagTy. If it's a
409 /// \c MatchNoteDiag, associate it with its \c MatchResultDiag.
410 ///
411 /// \c FileCheckTest.cpp calls \c Pattern::printVariableDefs directly, so it
412 /// can add a \c MatchNoteDiag without a previous \c MatchResultDiag.
413 /// Otherwise, there should always be a previous \c MatchResultDiag.
414 template <typename DiagTy, typename... ArgTys>
415 void emplace(ArgTys &&...Args) {
416 DiagList.emplace_back(
417 std::make_unique<DiagTy>(std::forward<ArgTys>(Args)...));
418 FileCheckDiag *Diag = DiagList.back().get();
420 CurMatchResultDiag = MRD;
421 return;
422 }
424 if (!CurMatchResultDiag)
425 return;
426 Note->setMatchResultDiag(CurMatchResultDiag);
427 }
428 /// Adjust the previous \c MatchResultDiag, which must be a \c MatchFoundDiag,
429 /// from successful status to unsuccessful status.
431 cast<MatchFoundDiag>(CurMatchResultDiag)->markUnsuccessful(Status);
432 }
433 class const_iterator {
434 friend FileCheckDiagList;
435
436 public:
437 using difference_type = std::ptrdiff_t;
439 using pointer = const FileCheckDiag *;
440 using reference = const FileCheckDiag &;
441 using iterator_category = std::forward_iterator_tag;
442
443 private:
444 vector_type::const_iterator Itr;
445 const_iterator(vector_type::const_iterator Itr) : Itr(Itr) {}
446
447 public:
448 reference operator*() const { return **Itr; }
449 pointer operator->() const { return &operator*(); }
450 const_iterator &operator++() {
451 ++Itr;
452 return *this;
453 }
454 const_iterator operator++(int) {
455 const_iterator Old = *this;
456 ++Itr;
457 return Old;
458 }
459 bool operator==(const const_iterator &Other) const {
460 return Itr == Other.Itr;
461 }
462 bool operator!=(const const_iterator &Other) const {
463 return Itr != Other.Itr;
464 }
465 };
466
467 using size_type = vector_type::size_type;
468 const_iterator begin() const { return const_iterator(DiagList.begin()); }
469 const_iterator end() const { return const_iterator(DiagList.end()); }
470 const FileCheckDiag &operator[](size_type I) const { return *DiagList[I]; }
471 size_type size() const { return DiagList.size(); }
472};
473
474class FileCheckPatternContext;
475struct FileCheckString;
476
477/// FileCheck class takes the request and exposes various methods that
478/// use information from the request.
481 std::unique_ptr<FileCheckPatternContext> PatternContext;
482 std::vector<FileCheckString> CheckStrings;
483
484public:
485 LLVM_ABI explicit FileCheck(FileCheckRequest Req);
487
488 /// Reads the check file from \p Buffer and records the expected strings it
489 /// contains. Errors are reported against \p SM.
490 ///
491 /// If \p ImpPatBufferIDRange, then the range (inclusive start, exclusive end)
492 /// of IDs for source buffers added to \p SM for implicit patterns are
493 /// recorded in it. The range is empty if there are none.
494 LLVM_ABI bool
496 std::pair<unsigned, unsigned> *ImpPatBufferIDRange = nullptr);
497
499
500 /// Canonicalizes whitespaces in the file. Line endings are replaced with
501 /// UNIX-style '\n'.
504
505 /// Checks the input to FileCheck provided in the \p Buffer against the
506 /// expected strings read from the check file and record diagnostics emitted
507 /// in \p Diags. Errors are recorded against \p SM.
508 ///
509 /// \returns false if the input fails to satisfy the checks.
511 FileCheckDiagList *Diags = nullptr);
512};
513
514} // namespace llvm
515
516#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition Compiler.h:213
#define I(x, y, z)
Definition MD5.cpp:57
static constexpr unsigned SM(unsigned Version)
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:462
bool operator==(const const_iterator &Other) const
Definition FileCheck.h:459
std::forward_iterator_tag iterator_category
Definition FileCheck.h:441
A FileCheckDiag series emitted by the FileCheck library.
Definition FileCheck.h:401
const FileCheckDiag & operator[](size_type I) const
Definition FileCheck.h:470
const_iterator begin() const
Definition FileCheck.h:468
const_iterator end() const
Definition FileCheck.h:469
void emplace(ArgTys &&...Args)
Emplace a new FileCheckDiag of type DiagTy.
Definition FileCheck.h:415
vector_type::size_type size_type
Definition FileCheck.h:467
void adjustPrevMatchFoundDiag(MatchFoundDiag::StatusTy Status)
Adjust the previous MatchResultDiag, which must be a MatchFoundDiag, from successful status to unsucc...
Definition FileCheck.h:430
size_type size() const
Definition FileCheck.h:471
Abstract base class for recording a FileCheck diagnostic for a pattern (e.g., CHECK-NEXT directive or...
Definition FileCheck.h:133
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
virtual ~FileCheckDiag()=0
Destructor is purely virtual to ensure this remains an abstract class.
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:395
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:377
static bool classof(const FileCheckDiag *FCD)
Is FCD an instance of MatchCustomNoteDiag?
Definition FileCheck.h:386
const std::string & getNote() const
Definition FileCheck.h:389
MatchCustomNoteDiag(StringRef Note)
Definition FileCheck.h:381
std::optional< SMRange > getMatchRange() const override
Return the match range described by the note, or std::nullopt if none.
Definition FileCheck.h:397
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:343
bool isError() const override
Always false.
Definition FileCheck.h:340
MatchFuzzyDiag(SMLoc MatchStart)
Definition FileCheck.h:332
static bool classof(const FileCheckDiag *FCD)
Is FCD an instance of MatchFuzzyDiag?
Definition FileCheck.h:335
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
const MatchResultDiag & getMatchResultDiag() const override
Get the note's associated MatchResultDiag.
Definition FileCheck.h:317
virtual ~MatchNoteDiag()=0
Destructor is purely virtual to ensure this remains an abstract class.
void setMatchResultDiag(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.
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:37
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
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