MLIR  20.0.0git
Public Member Functions | Friends | List of all members
mlir::DiagnosedDefiniteFailure Class Reference

A compatibility class connecting InFlightDiagnostic to DiagnosedSilenceableFailure while providing an interface similar to the former. More...

#include "mlir/Dialect/Transform/Utils/DiagnosedSilenceableFailure.h"

Public Member Functions

 DiagnosedDefiniteFailure (DiagnosedDefiniteFailure &&)=default
 Only move-constructible because it carries an in-flight diagnostic. More...
 
template<typename T >
DiagnosedDefiniteFailureoperator<< (T &&value) &
 Forward the message to the diagnostic. More...
 
template<typename T >
DiagnosedDefiniteFailure && operator<< (T &&value) &&
 
DiagnosticattachNote (std::optional< Location > loc=std::nullopt)
 Attaches a note to the error. More...
 
 operator DiagnosedSilenceableFailure ()
 Implicit conversion to DiagnosedSilenceableFailure in the definite failure state. More...
 
 operator LogicalResult ()
 Implicit conversion to LogicalResult in the failure state. More...
 

Friends

DiagnosedDefiniteFailure emitDefiniteFailure (Location loc, const Twine &message)
 Emits a definite failure with the given message. More...
 

Detailed Description

A compatibility class connecting InFlightDiagnostic to DiagnosedSilenceableFailure while providing an interface similar to the former.

Implicitly convertible to DiagnosticSilenceableFailure in definite failure state and to LogicalResult failure. Reports the error on conversion or on destruction. Instances of this class can be created by emitDefiniteFailure().

Definition at line 184 of file DiagnosedSilenceableFailure.h.

Constructor & Destructor Documentation

◆ DiagnosedDefiniteFailure()

mlir::DiagnosedDefiniteFailure::DiagnosedDefiniteFailure ( DiagnosedDefiniteFailure &&  )
default

Only move-constructible because it carries an in-flight diagnostic.

Member Function Documentation

◆ attachNote()

Diagnostic& mlir::DiagnosedDefiniteFailure::attachNote ( std::optional< Location loc = std::nullopt)
inline

Attaches a note to the error.

Definition at line 204 of file DiagnosedSilenceableFailure.h.

References mlir::InFlightDiagnostic::attachNote().

◆ operator DiagnosedSilenceableFailure()

mlir::DiagnosedDefiniteFailure::operator DiagnosedSilenceableFailure ( )
inline

Implicit conversion to DiagnosedSilenceableFailure in the definite failure state.

Reports the error.

Definition at line 210 of file DiagnosedSilenceableFailure.h.

References mlir::DiagnosedSilenceableFailure::definiteFailure(), and mlir::InFlightDiagnostic::report().

◆ operator LogicalResult()

mlir::DiagnosedDefiniteFailure::operator LogicalResult ( )
inline

Implicit conversion to LogicalResult in the failure state.

Reports the error.

Definition at line 217 of file DiagnosedSilenceableFailure.h.

References mlir::InFlightDiagnostic::report().

◆ operator<<() [1/2]

template<typename T >
DiagnosedDefiniteFailure& mlir::DiagnosedDefiniteFailure::operator<< ( T &&  value) &
inline

Forward the message to the diagnostic.

Definition at line 194 of file DiagnosedSilenceableFailure.h.

◆ operator<<() [2/2]

template<typename T >
DiagnosedDefiniteFailure&& mlir::DiagnosedDefiniteFailure::operator<< ( T &&  value) &&
inline

Definition at line 199 of file DiagnosedSilenceableFailure.h.

Friends And Related Function Documentation

◆ emitDefiniteFailure

DiagnosedDefiniteFailure emitDefiniteFailure ( Location  loc,
const Twine &  message 
)
friend

Emits a definite failure with the given message.

The returned object allows for last-minute modification to the error message, such as attaching notes and completing the message. It will be reported when the object is destructed or converted.

Definition at line 243 of file DiagnosedSilenceableFailure.h.


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