forked from OSchip/llvm-project
Add get and getError methods to ErrorOr.
ErrorOr is modeled after boost::optional which has a get method. llvm-svn: 198792
This commit is contained in:
parent
cfd2ca5826
commit
5d16475b31
|
@ -178,10 +178,17 @@ public:
|
|||
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 {
|
||||
return HasError ? *getErrorStorage() : llvm::error_code::success();
|
||||
}
|
||||
|
||||
error_code getError() const {
|
||||
return HasError ? *getErrorStorage() : error_code::success();
|
||||
}
|
||||
|
||||
pointer operator ->() {
|
||||
return toPointer(getStorage());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue