9#ifndef LLVM_SUPPORT_LOGICALRESULT_H
10#define LLVM_SUPPORT_LOGICALRESULT_H
40 constexpr bool succeeded()
const {
return IsSuccess; }
43 constexpr bool failed()
const {
return !IsSuccess; }
76template <
typename T>
class [[nodiscard]]
FailureOr :
public std::optional<T> {
82 "success should be constructed with an instance of 'T'");
88 std::enable_if_t<std::is_constructible<T, U>::value> * =
nullptr>
97 using std::optional<
T>::operator
bool;
98 using std::optional<
T>::has_value;
103 typename = std::enable_if_t<!std::is_convertible_v<T, bool>>>
124 constexpr explicit operator bool()
const {
return failed(); }
std::optional< std::vector< StOtherPiece > > Other
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class provides support for representing a failure result, or a valid value of type T.
FailureOr(LogicalResult Result)
Allow constructing from a LogicalResult.
FailureOr(const FailureOr< U > &Other)
This class represents success/failure for parsing-like operations that find it important to chain tog...
ParseResult(LogicalResult Result=success())
This is an optimization pass for GlobalISel generic memory operations.
bool succeeded(LogicalResult Result)
Utility function that returns true if the provided LogicalResult corresponds to a success value.
bool failed(LogicalResult Result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.
LogicalResult failure(bool IsFailure=true)
Utility function to generate a LogicalResult.
LogicalResult success(bool IsSuccess=true)
Utility function to generate a LogicalResult.
Implement std::hash so that hash_code can be used in STL containers.
This class represents an efficient way to signal success or failure.
static LogicalResult failure(bool IsFailure=true)
If isFailure is true a failure result is generated, otherwise a 'success' result is generated.
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 LogicalResult success(bool IsSuccess=true)
If isSuccess is true a success result is generated, otherwise a 'failure' result is generated.