LLVM 23.0.0git
llvm::MatchFoundDiag Class Reference

MatchResultDiag for a pattern that matched the input. More...

#include "llvm/FileCheck/FileCheck.h"

Inheritance diagram for llvm::MatchFoundDiag:
[legend]

Public Types

enum  StatusTy { Success , Excluded , WrongLine , Discarded }
Public Types inherited from llvm::FileCheckDiag
enum  FileCheckDiagKind {
  MatchResultDiag_First , MatchFoundDiag = MatchResultDiag_First , MatchNoneDiag , MatchResultDiag_Last = MatchNoneDiag ,
  MatchNoteDiag_First , MatchFuzzyDiag = MatchNoteDiag_First , MatchCustomNoteDiag , MatchNoteDiag_Last = MatchCustomNoteDiag
}

Public Member Functions

 MatchFoundDiag (const Check::FileCheckType &CheckTy, SMLoc CheckLoc, StatusTy Status, SMRange MatchRange, SMRange SearchRange)
bool isError () const override
 Does this match produce an error?
StatusTy getStatus () const
 Was this a successful match?
void markUnsuccessful (StatusTy S)
 Adjust a successful status to a non-successful status.
std::optional< SMRangegetMatchRange () const override
 Return the match's input range, never std::nullopt.
Public Member Functions inherited from llvm::MatchResultDiag
 MatchResultDiag (FileCheckDiagKind Kind, const Check::FileCheckType &CheckTy, SMLoc CheckLoc, SMRange SearchRange)
virtual ~MatchResultDiag ()=0
 Destructor is purely virtual to ensure this remains an abstract class.
const MatchResultDiaggetMatchResultDiag () const override
 Get itself.
Check::FileCheckType getCheckTy () const
 What is the type of pattern for this match result?
SMLoc getCheckLoc () const
 Where is the pattern for this match result?
SMRange getSearchRange () const
 What is the search range for the match result?
Public Member Functions inherited from llvm::FileCheckDiag
 FileCheckDiag (FileCheckDiagKind Kind)
virtual ~FileCheckDiag ()=0
 Destructor is purely virtual to ensure this remains an abstract class.
FileCheckDiagKind getKind () const
 Of what derived class is this an instance?

Static Public Member Functions

static bool classof (const FileCheckDiag *FCD)
 Is FCD an instance of MatchFoundDiag?
Static Public Member Functions inherited from llvm::MatchResultDiag
static bool classof (const FileCheckDiag *FCD)
 Is FCD an instance of MatchResultDiag?

Detailed Description

MatchResultDiag for a pattern that matched the input.

Definition at line 206 of file FileCheck.h.

Member Enumeration Documentation

◆ StatusTy

Enumerator
Success 

Indicates a good match for an expected pattern.

Excluded 

Indicates a match for an excluded pattern (error).

WrongLine 

Indicates a match for an expected pattern, but the match is on the wrong line (error).

Discarded 

Indicates a discarded match for an expected pattern (not an error).

Definition at line 208 of file FileCheck.h.

Constructor & Destructor Documentation

◆ MatchFoundDiag()

llvm::MatchFoundDiag::MatchFoundDiag ( const Check::FileCheckType & CheckTy,
SMLoc CheckLoc,
StatusTy Status,
SMRange MatchRange,
SMRange SearchRange )
inline

Definition at line 225 of file FileCheck.h.

References MatchFoundDiag(), and llvm::MatchResultDiag::MatchResultDiag().

Referenced by MatchFoundDiag().

Member Function Documentation

◆ classof()

bool llvm::MatchFoundDiag::classof ( const FileCheckDiag * FCD)
inlinestatic

Is FCD an instance of MatchFoundDiag?

Definition at line 231 of file FileCheck.h.

References llvm::FileCheckDiag::getKind(), and llvm::FileCheckDiag::MatchFoundDiag.

◆ getMatchRange()

std::optional< SMRange > llvm::MatchFoundDiag::getMatchRange ( ) const
inlineoverridevirtual

Return the match's input range, never std::nullopt.

Implements llvm::FileCheckDiag.

Definition at line 260 of file FileCheck.h.

◆ getStatus()

StatusTy llvm::MatchFoundDiag::getStatus ( ) const
inline

Was this a successful match?

If not, why not?

See isError comments for the relationship between the two.

Definition at line 244 of file FileCheck.h.

◆ isError()

bool llvm::MatchFoundDiag::isError ( ) const
inlineoverridevirtual

Does this match produce an error?

This is not always the same as getStatus()!=Success. For example, CHECK-DAG discarded matches are neither successful matches nor errors.

Implements llvm::FileCheckDiag.

Definition at line 238 of file FileCheck.h.

References Discarded, and Success.

◆ markUnsuccessful()

void llvm::MatchFoundDiag::markUnsuccessful ( StatusTy S)
inline

Adjust a successful status to a non-successful status.

This is designed to be called while emitting diagnostics. It is not designed to be called by a diagnostic presentation layer like -dump-input.

For example, a match that was originally thought to be successful might later be discarded, or it might be determined that it violates a matching constraint (e.g., wrong line).

Definition at line 254 of file FileCheck.h.

References assert(), and Success.


The documentation for this class was generated from the following file: