summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Support/ErrorOr.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Support/ErrorOr.h b/include/llvm/Support/ErrorOr.h
index 26af1e8c80..21ab4e721d 100644
--- a/include/llvm/Support/ErrorOr.h
+++ b/include/llvm/Support/ErrorOr.h
@@ -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());
}