LLVM 20.0.0git
|
This class represents an efficient way to signal success or failure. More...
#include "llvm/Support/LogicalResult.h"
Public Member Functions | |
constexpr bool | succeeded () const |
Returns true if the provided LogicalResult corresponds to a success value. | |
constexpr bool | failed () const |
Returns true if the provided LogicalResult corresponds to a failure value. | |
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. | |
static LogicalResult | failure (bool IsFailure=true) |
If isFailure is true a failure result is generated, otherwise a 'success' result is generated. | |
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 25 of file LogicalResult.h.
|
inlineconstexpr |
Returns true if the provided LogicalResult corresponds to a failure value.
Definition at line 43 of file LogicalResult.h.
|
inlinestatic |
If isFailure is true a failure
result is generated, otherwise a 'success' result is generated.
Definition at line 35 of file LogicalResult.h.
Referenced by llvm::failure().
|
inlineconstexpr |
Returns true if the provided LogicalResult corresponds to a success value.
Definition at line 40 of file LogicalResult.h.
|
inlinestatic |
If isSuccess is true a success
result is generated, otherwise a 'failure' result is generated.
Definition at line 29 of file LogicalResult.h.
Referenced by llvm::success().