MLIR  14.0.0git
Public Member Functions | Static Public Member Functions | List of all members
mlir::LogicalResult Struct Reference

This class represents an efficient way to signal success or failure. More...

#include "mlir/Support/LogicalResult.h"

Inheritance diagram for mlir::LogicalResult:
Inheritance graph
[legend]

Public Member Functions

bool succeeded () const
 Returns true if the provided LogicalResult corresponds to a success value. More...
 
bool failed () const
 Returns true if the provided LogicalResult corresponds to a failure value. More...
 

Static Public Member Functions

static LogicalResult success (bool isSuccess=true)
 If isSuccess is true a success result is generated, otherwise a 'failure' result is generated. More...
 
static LogicalResult failure (bool isFailure=true)
 If isFailure is true a failure result is generated, otherwise a 'success' result is generated. More...
 

Detailed Description

This class represents an efficient way to signal success or failure.

It should be preferred over the use of bool when appropriate, as it avoids all of the ambiguity that arises in interpreting a boolean result. This class is marked as NODISCARD to ensure that the result is processed. Users may explicitly discard a result by using (void), e.g. (void)functionThatReturnsALogicalResult();. Given the intended nature of this class, it generally shouldn't be used as the result of functions that very frequently have the result ignored. This class is intended to be used in conjunction with the utility functions below.

Definition at line 26 of file LogicalResult.h.

Member Function Documentation

◆ failed()

bool mlir::LogicalResult::failed ( ) const
inline

◆ failure()

static LogicalResult mlir::LogicalResult::failure ( bool  isFailure = true)
inlinestatic

◆ succeeded()

bool mlir::LogicalResult::succeeded ( ) const
inline

◆ success()

static LogicalResult mlir::LogicalResult::success ( bool  isSuccess = true)
inlinestatic

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