diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-12 21:46:39 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-12 21:46:39 +0000 |
commit | 5c792faa0e5560bc148c973f3df658eb3bb2061e (patch) | |
tree | 6ede225c2e59359a60804bb1d823f9db9072892a /include/llvm/Support/ErrorOr.h | |
parent | 7418e1f4bd5a4bda32af18f46ff2837221d12d5c (diff) | |
download | llvm-5c792faa0e5560bc148c973f3df658eb3bb2061e.tar.gz llvm-5c792faa0e5560bc148c973f3df658eb3bb2061e.tar.bz2 llvm-5c792faa0e5560bc148c973f3df658eb3bb2061e.tar.xz |
Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210835 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/ErrorOr.h')
-rw-r--r-- | include/llvm/Support/ErrorOr.h | 23 |
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 |