Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit cfc3a3c

Browse files
Use std::reference_wrapper instead of llvm::ReferenceStorage
Reviewed By: Bigcheese Differential Revision: https://reviews.llvm.org/D49298 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337444 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent ef2fcbd commit cfc3a3c

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

include/llvm/Support/Error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ template <class T> class LLVM_NODISCARD Expected {
429429

430430
static const bool isRef = std::is_reference<T>::value;
431431

432-
using wrap = ReferenceStorage<typename std::remove_reference<T>::type>;
432+
using wrap = std::reference_wrapper<typename std::remove_reference<T>::type>;
433433

434434
using error_type = std::unique_ptr<ErrorInfoBase>;
435435

include/llvm/Support/ErrorOr.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@
2424

2525
namespace llvm {
2626

27-
/// Stores a reference that can be changed.
28-
template <typename T>
29-
class ReferenceStorage {
30-
T *Storage;
31-
32-
public:
33-
ReferenceStorage(T &Ref) : Storage(&Ref) {}
34-
35-
operator T &() const { return *Storage; }
36-
T &get() const { return *Storage; }
37-
};
38-
3927
/// Represents either an error or a value T.
4028
///
4129
/// ErrorOr<T> is a pointer-like class that represents the result of an
@@ -71,7 +59,7 @@ class ErrorOr {
7159

7260
static const bool isRef = std::is_reference<T>::value;
7361

74-
using wrap = ReferenceStorage<typename std::remove_reference<T>::type>;
62+
using wrap = std::reference_wrapper<typename std::remove_reference<T>::type>;
7563

7664
public:
7765
using storage_type = typename std::conditional<isRef, wrap, T>::type;

0 commit comments

Comments
 (0)