LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
llzk::InFlightDiagnosticWrapper Class Reference

Wrapper around InFlightDiagnostic that can either be a regular InFlightDiagnostic or a special version that asserts false after reporting the diagnostic. More...

#include <ErrorHelper.h>

Public Member Functions

 InFlightDiagnosticWrapper (mlir::InFlightDiagnostic &&diag)
 Constructor for regular InFlightDiagnostic.
 InFlightDiagnosticWrapper (mlir::MLIRContext *ctx)
 Constructor for DefaultAndFailInFlightDiagnostic from MLIRContext.
 InFlightDiagnosticWrapper (const mlir::Location &loc)
 Constructor for DefaultAndFailInFlightDiagnostic from Location.
template<typename Arg>
InFlightDiagnosticWrapper & operator<< (Arg &&arg) &
 Stream operator for new diagnostic arguments.
template<typename Arg>
InFlightDiagnosticWrapper && operator<< (Arg &&arg) &&
 Stream operator for new diagnostic arguments.
template<typename... Args>
InFlightDiagnosticWrapper & append (Args &&...args) &
 Append arguments to the diagnostic.
template<typename... Args>
InFlightDiagnosticWrapper && append (Args &&...args) &&
 Append arguments to the diagnostic.
mlir::Diagnostic & attachNote (std::optional< mlir::Location > noteLoc=std::nullopt)
 Attaches a note to this diagnostic.
mlir::Diagnostic * getUnderlyingDiagnostic ()
 Returns the underlying diagnostic or nullptr if this diagnostic isn't active.
void report ()
 Reports the diagnostic to the engine.
void abandon ()
 Abandons this diagnostic so that it will no longer be reported.
 operator mlir::LogicalResult () const
 Allow an inflight diagnostic to be converted to 'failure', otherwise 'success' if this is an empty diagnostic.
 operator mlir::ParseResult () const
 Allow an inflight diagnostic to be converted to 'failure', otherwise 'success' if this is an empty diagnostic.
template<typename T>
 operator mlir::FailureOr< T > () const
 Allow an inflight diagnostic to be converted to FailureOr<T>.
 InFlightDiagnosticWrapper (InFlightDiagnosticWrapper &&)=default
 InFlightDiagnosticWrapper (const InFlightDiagnosticWrapper &)=delete
InFlightDiagnosticWrapper & operator= (InFlightDiagnosticWrapper &&)=delete
InFlightDiagnosticWrapper & operator= (const InFlightDiagnosticWrapper &)=delete

Static Public Member Functions

static InFlightDiagnosticWrapper createSilent (mlir::MLIRContext *ctx)
 Construct a silent diagnostic that does nothing when appended to or reported.

Detailed Description

Wrapper around InFlightDiagnostic that can either be a regular InFlightDiagnostic or a special version that asserts false after reporting the diagnostic.

See wrapNullableInFlightDiagnostic() below for details.

Definition at line 26 of file ErrorHelper.h.

Constructor & Destructor Documentation

◆ InFlightDiagnosticWrapper() [1/5]

llzk::InFlightDiagnosticWrapper::InFlightDiagnosticWrapper ( mlir::InFlightDiagnostic && diag)
inlineexplicit

Constructor for regular InFlightDiagnostic.

Definition at line 60 of file ErrorHelper.h.

◆ InFlightDiagnosticWrapper() [2/5]

llzk::InFlightDiagnosticWrapper::InFlightDiagnosticWrapper ( mlir::MLIRContext * ctx)
inlineexplicit

Constructor for DefaultAndFailInFlightDiagnostic from MLIRContext.

NOTE: This is not a common use case since it will always result in an assertion failure immediately after reporting the error; likely only useful in custom type builders.

Definition at line 65 of file ErrorHelper.h.

◆ InFlightDiagnosticWrapper() [3/5]

llzk::InFlightDiagnosticWrapper::InFlightDiagnosticWrapper ( const mlir::Location & loc)
inlineexplicit

Constructor for DefaultAndFailInFlightDiagnostic from Location.

NOTE: This is not a common use case since it will always result in an assertion failure immediately after reporting the error; likely only useful in custom type builders.

Definition at line 73 of file ErrorHelper.h.

◆ InFlightDiagnosticWrapper() [4/5]

llzk::InFlightDiagnosticWrapper::InFlightDiagnosticWrapper ( InFlightDiagnosticWrapper && )
default

◆ InFlightDiagnosticWrapper() [5/5]

llzk::InFlightDiagnosticWrapper::InFlightDiagnosticWrapper ( const InFlightDiagnosticWrapper & )
delete

Member Function Documentation

◆ abandon()

void llzk::InFlightDiagnosticWrapper::abandon ( )
inline

Abandons this diagnostic so that it will no longer be reported.

Definition at line 122 of file ErrorHelper.h.

◆ append() [1/2]

template<typename... Args>
InFlightDiagnosticWrapper & llzk::InFlightDiagnosticWrapper::append ( Args &&... args) &
inline

Append arguments to the diagnostic.

Definition at line 93 of file ErrorHelper.h.

◆ append() [2/2]

template<typename... Args>
InFlightDiagnosticWrapper && llzk::InFlightDiagnosticWrapper::append ( Args &&... args) &&
inline

Append arguments to the diagnostic.

Definition at line 98 of file ErrorHelper.h.

◆ attachNote()

mlir::Diagnostic & llzk::InFlightDiagnosticWrapper::attachNote ( std::optional< mlir::Location > noteLoc = std::nullopt)
inline

Attaches a note to this diagnostic.

Definition at line 103 of file ErrorHelper.h.

◆ createSilent()

InFlightDiagnosticWrapper llzk::InFlightDiagnosticWrapper::createSilent ( mlir::MLIRContext * ctx)
inlinestatic

Construct a silent diagnostic that does nothing when appended to or reported.

Definition at line 77 of file ErrorHelper.h.

◆ getUnderlyingDiagnostic()

mlir::Diagnostic * llzk::InFlightDiagnosticWrapper::getUnderlyingDiagnostic ( )
inline

Returns the underlying diagnostic or nullptr if this diagnostic isn't active.

Definition at line 110 of file ErrorHelper.h.

◆ operator mlir::FailureOr< T >()

template<typename T>
llzk::InFlightDiagnosticWrapper::operator mlir::FailureOr< T > ( ) const
inline

Allow an inflight diagnostic to be converted to FailureOr<T>.

Always results in 'failure' because this cast cannot possibly return an object of 'T'.

Definition at line 138 of file ErrorHelper.h.

◆ operator mlir::LogicalResult()

llzk::InFlightDiagnosticWrapper::operator mlir::LogicalResult ( ) const
inline

Allow an inflight diagnostic to be converted to 'failure', otherwise 'success' if this is an empty diagnostic.

Definition at line 128 of file ErrorHelper.h.

◆ operator mlir::ParseResult()

llzk::InFlightDiagnosticWrapper::operator mlir::ParseResult ( ) const
inline

Allow an inflight diagnostic to be converted to 'failure', otherwise 'success' if this is an empty diagnostic.

Definition at line 134 of file ErrorHelper.h.

◆ operator<<() [1/2]

template<typename Arg>
InFlightDiagnosticWrapper & llzk::InFlightDiagnosticWrapper::operator<< ( Arg && arg) &
inline

Stream operator for new diagnostic arguments.

Definition at line 84 of file ErrorHelper.h.

◆ operator<<() [2/2]

template<typename Arg>
InFlightDiagnosticWrapper && llzk::InFlightDiagnosticWrapper::operator<< ( Arg && arg) &&
inline

Stream operator for new diagnostic arguments.

Definition at line 88 of file ErrorHelper.h.

◆ operator=() [1/2]

InFlightDiagnosticWrapper & llzk::InFlightDiagnosticWrapper::operator= ( const InFlightDiagnosticWrapper & )
delete

◆ operator=() [2/2]

InFlightDiagnosticWrapper & llzk::InFlightDiagnosticWrapper::operator= ( InFlightDiagnosticWrapper && )
delete

◆ report()

void llzk::InFlightDiagnosticWrapper::report ( )
inline

Reports the diagnostic to the engine.

Definition at line 117 of file ErrorHelper.h.


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