summaryrefslogtreecommitdiff
path: root/include/llvm/Support/ErrorOr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Support/ErrorOr.h')
-rw-r--r--include/llvm/Support/ErrorOr.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/include/llvm/Support/ErrorOr.h b/include/llvm/Support/ErrorOr.h
index 8664ced657..fc111109fc 100644
--- a/include/llvm/Support/ErrorOr.h
+++ b/include/llvm/Support/ErrorOr.h
@@ -23,7 +23,6 @@
#include <type_traits>
namespace llvm {
-using std::error_code;
template<class T, class V>
typename std::enable_if< std::is_constructible<T, V>::value
, typename std::remove_reference<V>::type>::type &&
@@ -101,11 +100,11 @@ public:
void *>::type = 0)
: HasError(true) {
using std::make_error_code;
- new (getErrorStorage()) error_code(make_error_code(ErrorCode));
+ new (getErrorStorage()) std::error_code(make_error_code(ErrorCode));
}
ErrorOr(std::error_code EC) : HasError(true) {
- new (getErrorStorage()) error_code(EC);
+ new (getErrorStorage()) std::error_code(EC);
}
ErrorOr(T Val) : HasError(false) {
@@ -165,8 +164,8 @@ public:
reference get() { return *getStorage(); }
const_reference get() const { return const_cast<ErrorOr<T> >(this)->get(); }
- error_code getError() const {
- return HasError ? *getErrorStorage() : error_code();
+ std::error_code getError() const {
+ return HasError ? *getErrorStorage() : std::error_code();
}
pointer operator ->() {
@@ -187,7 +186,7 @@ private:
} else {
// Get other's error.
HasError = true;
- new (getErrorStorage()) error_code(Other.getError());
+ new (getErrorStorage()) std::error_code(Other.getError());
}
}
@@ -219,7 +218,7 @@ private:
} else {
// Get other's error.
HasError = true;
- new (getErrorStorage()) error_code(Other.getError());
+ new (getErrorStorage()) std::error_code(Other.getError());
}
}
@@ -250,19 +249,19 @@ private:
return reinterpret_cast<const storage_type*>(TStorage.buffer);
}
- error_code *getErrorStorage() {
+ std::error_code *getErrorStorage() {
assert(HasError && "Cannot get error when a value exists!");
- return reinterpret_cast<error_code*>(ErrorStorage.buffer);
+ return reinterpret_cast<std::error_code *>(ErrorStorage.buffer);
}
- const error_code *getErrorStorage() const {
+ const std::error_code *getErrorStorage() const {
return const_cast<ErrorOr<T> *>(this)->getErrorStorage();
}
union {
AlignedCharArrayUnion<storage_type> TStorage;
- AlignedCharArrayUnion<error_code> ErrorStorage;
+ AlignedCharArrayUnion<std::error_code> ErrorStorage;
};
bool HasError : 1;
};
@@ -272,7 +271,7 @@ typename std::enable_if<std::is_error_code_enum<E>::value ||
std::is_error_condition_enum<E>::value,
bool>::type
operator==(ErrorOr<T> &Err, E Code) {
- return error_code(Err) == Code;
+ return std::error_code(Err) == Code;
}
} // end namespace llvm