From 7ca1269cd53c58e21bb318539315d2bca28b9e73 Mon Sep 17 00:00:00 2001 From: Serge Guelton Date: Thu, 19 Jul 2018 09:24:34 +0000 Subject: [PATCH] Use std::reference_wrapper instead of llvm::ReferenceStorage Reviewed By: Bigcheese Differential Revision: https://reviews.llvm.org/D49298 llvm-svn: 337444 --- llvm/include/llvm/Support/Error.h | 2 +- llvm/include/llvm/Support/ErrorOr.h | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h index b026dae..3ea567b 100644 --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -429,7 +429,7 @@ template class LLVM_NODISCARD Expected { static const bool isRef = std::is_reference::value; - using wrap = ReferenceStorage::type>; + using wrap = std::reference_wrapper::type>; using error_type = std::unique_ptr; diff --git a/llvm/include/llvm/Support/ErrorOr.h b/llvm/include/llvm/Support/ErrorOr.h index fdf2d6c..e6ce764 100644 --- a/llvm/include/llvm/Support/ErrorOr.h +++ b/llvm/include/llvm/Support/ErrorOr.h @@ -24,18 +24,6 @@ namespace llvm { -/// Stores a reference that can be changed. -template -class ReferenceStorage { - T *Storage; - -public: - ReferenceStorage(T &Ref) : Storage(&Ref) {} - - operator T &() const { return *Storage; } - T &get() const { return *Storage; } -}; - /// Represents either an error or a value T. /// /// ErrorOr is a pointer-like class that represents the result of an @@ -71,7 +59,7 @@ class ErrorOr { static const bool isRef = std::is_reference::value; - using wrap = ReferenceStorage::type>; + using wrap = std::reference_wrapper::type>; public: using storage_type = typename std::conditional::type; -- 2.7.4