LLZK 0.1.0
Veridise's ZK Language IR
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>
InFlightDiagnosticWrapperoperator<< (Arg &&arg) &
 Stream operator for new diagnostic arguments.
template<typename Arg>
InFlightDiagnosticWrapper && operator<< (Arg &&arg) &&
 Stream operator for new diagnostic arguments.
template<typename... Args>
InFlightDiagnosticWrapperappend (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
InFlightDiagnosticWrapperoperator= (InFlightDiagnosticWrapper &&)=delete
InFlightDiagnosticWrapperoperator= (const InFlightDiagnosticWrapper &)=delete

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 57 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 62 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 70 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 112 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 83 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 88 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 93 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 100 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 128 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 118 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 124 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 74 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 78 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 107 of file ErrorHelper.h.


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