mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
Add get and getError methods to ErrorOr.
ErrorOr is modeled after boost::optional which has a get method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198792 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cb1f0ddce4
commit
d13e173eb6
@ -178,10 +178,17 @@ public:
|
|||||||
return HasError ? 0 : unspecified_bool_true;
|
return HasError ? 0 : unspecified_bool_true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T &get() { return *getStorage(); }
|
||||||
|
const T &get() const { return const_cast<ErrorOr<T> >(this)->get(); }
|
||||||
|
|
||||||
operator llvm::error_code() const {
|
operator llvm::error_code() const {
|
||||||
return HasError ? *getErrorStorage() : llvm::error_code::success();
|
return HasError ? *getErrorStorage() : llvm::error_code::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_code getError() const {
|
||||||
|
return HasError ? *getErrorStorage() : error_code::success();
|
||||||
|
}
|
||||||
|
|
||||||
pointer operator ->() {
|
pointer operator ->() {
|
||||||
return toPointer(getStorage());
|
return toPointer(getStorage());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user