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.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/llvm/Support/ErrorOr.h b/include/llvm/Support/ErrorOr.h
index 877f4063cd23..061fb65db465 100644
--- a/include/llvm/Support/ErrorOr.h
+++ b/include/llvm/Support/ErrorOr.h
@@ -16,13 +16,14 @@
#ifndef LLVM_SUPPORT_ERROROR_H
#define LLVM_SUPPORT_ERROROR_H
-#include "llvm/ADT/PointerIntPair.h"
#include "llvm/Support/AlignOf.h"
#include <cassert>
#include <system_error>
#include <type_traits>
+#include <utility>
namespace llvm {
+
/// \brief Stores a reference that can be changed.
template <typename T>
class ReferenceStorage {
@@ -67,17 +68,19 @@ public:
template<class T>
class ErrorOr {
template <class OtherT> friend class ErrorOr;
+
static const bool isRef = std::is_reference<T>::value;
- typedef ReferenceStorage<typename std::remove_reference<T>::type> wrap;
+
+ using wrap = ReferenceStorage<typename std::remove_reference<T>::type>;
public:
- typedef typename std::conditional<isRef, wrap, T>::type storage_type;
+ using storage_type = typename std::conditional<isRef, wrap, T>::type;
private:
- typedef typename std::remove_reference<T>::type &reference;
- typedef const typename std::remove_reference<T>::type &const_reference;
- typedef typename std::remove_reference<T>::type *pointer;
- typedef const typename std::remove_reference<T>::type *const_pointer;
+ using reference = typename std::remove_reference<T>::type &;
+ using const_reference = const typename std::remove_reference<T>::type &;
+ using pointer = typename std::remove_reference<T>::type *;
+ using const_pointer = const typename std::remove_reference<T>::type *;
public:
template <class E>
@@ -282,6 +285,7 @@ typename std::enable_if<std::is_error_code_enum<E>::value ||
operator==(const ErrorOr<T> &Err, E Code) {
return Err.getError() == Code;
}
+
} // end namespace llvm
#endif // LLVM_SUPPORT_ERROROR_H