MLIR  19.0.0git
Public Member Functions | Public Attributes | List of all members
mlir::detail::ExpectedDiag Struct Reference

This class represents an expected output diagnostic. More...

Public Member Functions

 ExpectedDiag (DiagnosticSeverity kind, unsigned lineNo, SMLoc fileLoc, StringRef substring)
 
LogicalResult emitError (raw_ostream &os, llvm::SourceMgr &mgr, const Twine &msg)
 Emit an error at the location referenced by this diagnostic. More...
 
bool match (StringRef str) const
 Returns true if this diagnostic matches the given string. More...
 
LogicalResult computeRegex (raw_ostream &os, llvm::SourceMgr &mgr)
 Compute the regex matcher for this diagnostic, using the provided stream and manager to emit diagnostics as necessary. More...
 

Public Attributes

DiagnosticSeverity kind
 The severity of the diagnosic expected. More...
 
unsigned lineNo
 The line number the expected diagnostic should be on. More...
 
SMLoc fileLoc
 The location of the expected diagnostic within the input file. More...
 
bool matched = false
 A flag indicating if the expected diagnostic has been matched yet. More...
 
StringRef substring
 The substring that is expected to be within the diagnostic. More...
 
std::optional< llvm::Regex > substringRegex
 An optional regex matcher, if the expected diagnostic sub-string was a regex string. More...
 

Detailed Description

This class represents an expected output diagnostic.

Definition at line 587 of file Diagnostics.cpp.

Constructor & Destructor Documentation

◆ ExpectedDiag()

mlir::detail::ExpectedDiag::ExpectedDiag ( DiagnosticSeverity  kind,
unsigned  lineNo,
SMLoc  fileLoc,
StringRef  substring 
)
inline

Definition at line 588 of file Diagnostics.cpp.

Member Function Documentation

◆ computeRegex()

LogicalResult mlir::detail::ExpectedDiag::computeRegex ( raw_ostream &  os,
llvm::SourceMgr &  mgr 
)
inline

Compute the regex matcher for this diagnostic, using the provided stream and manager to emit diagnostics as necessary.

Definition at line 612 of file Diagnostics.cpp.

References emitError(), substring, substringRegex, and mlir::success().

◆ emitError()

LogicalResult mlir::detail::ExpectedDiag::emitError ( raw_ostream &  os,
llvm::SourceMgr &  mgr,
const Twine &  msg 
)
inline

Emit an error at the location referenced by this diagnostic.

Definition at line 593 of file Diagnostics.cpp.

References mlir::failure(), fileLoc, and substring.

Referenced by computeRegex().

◆ match()

bool mlir::detail::ExpectedDiag::match ( StringRef  str) const
inline

Returns true if this diagnostic matches the given string.

Definition at line 602 of file Diagnostics.cpp.

References substring, and substringRegex.

Member Data Documentation

◆ fileLoc

SMLoc mlir::detail::ExpectedDiag::fileLoc

The location of the expected diagnostic within the input file.

Definition at line 649 of file Diagnostics.cpp.

Referenced by emitError().

◆ kind

DiagnosticSeverity mlir::detail::ExpectedDiag::kind

The severity of the diagnosic expected.

Definition at line 645 of file Diagnostics.cpp.

◆ lineNo

unsigned mlir::detail::ExpectedDiag::lineNo

The line number the expected diagnostic should be on.

Definition at line 647 of file Diagnostics.cpp.

◆ matched

bool mlir::detail::ExpectedDiag::matched = false

A flag indicating if the expected diagnostic has been matched yet.

Definition at line 651 of file Diagnostics.cpp.

◆ substring

StringRef mlir::detail::ExpectedDiag::substring

The substring that is expected to be within the diagnostic.

Definition at line 653 of file Diagnostics.cpp.

Referenced by computeRegex(), emitError(), and match().

◆ substringRegex

std::optional<llvm::Regex> mlir::detail::ExpectedDiag::substringRegex

An optional regex matcher, if the expected diagnostic sub-string was a regex string.

Definition at line 656 of file Diagnostics.cpp.

Referenced by computeRegex(), and match().


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