Blame SOURCES/0001-Re-apply-r346985-ADT-Drop-llvm-Optional-clang-specif.patch

ef93f8
From 93d58f71134cb97e79c417e540d12940960b529e Mon Sep 17 00:00:00 2001
ef93f8
From: Tom Stellard <tstellar@redhat.com>
ef93f8
Date: Fri, 16 Nov 2018 00:47:24 +0000
ef93f8
Subject: [PATCH] Re-apply r346985: [ADT] Drop llvm::Optional clang-specific
ef93f8
 optimization for trivially copyable types
ef93f8
ef93f8
Remove a test case that was added with the optimization we are now
ef93f8
removing.
ef93f8
ef93f8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347004 91177308-0d34-0410-b5e6-96231b3b80d8
ef93f8
---
ef93f8
 include/llvm/ADT/Optional.h    | 18 ------------------
ef93f8
 unittests/ADT/OptionalTest.cpp |  8 --------
ef93f8
 2 files changed, 26 deletions(-)
ef93f8
ef93f8
diff --git a/include/llvm/ADT/Optional.h b/include/llvm/ADT/Optional.h
ef93f8
index 353e5d0..9fe9b28 100644
ef93f8
--- a/include/llvm/ADT/Optional.h
ef93f8
+++ b/include/llvm/ADT/Optional.h
ef93f8
@@ -108,24 +108,6 @@ template <typename T, bool IsPodLike> struct OptionalStorage {
ef93f8
   }
ef93f8
 };
ef93f8
 
ef93f8
-#if !defined(__GNUC__) || defined(__clang__) // GCC up to GCC7 miscompiles this.
ef93f8
-/// Storage for trivially copyable types only.
ef93f8
-template <typename T> struct OptionalStorage<T, true> {
ef93f8
-  AlignedCharArrayUnion<T> storage;
ef93f8
-  bool hasVal = false;
ef93f8
-
ef93f8
-  OptionalStorage() = default;
ef93f8
-
ef93f8
-  OptionalStorage(const T &y) : hasVal(true) { new (storage.buffer) T(y); }
ef93f8
-  OptionalStorage &operator=(const T &y) {
ef93f8
-    *reinterpret_cast<T *>(storage.buffer) = y;
ef93f8
-    hasVal = true;
ef93f8
-    return *this;
ef93f8
-  }
ef93f8
-
ef93f8
-  void reset() { hasVal = false; }
ef93f8
-};
ef93f8
-#endif
ef93f8
 } // namespace optional_detail
ef93f8
 
ef93f8
 template <typename T> class Optional {
ef93f8
diff --git a/unittests/ADT/OptionalTest.cpp b/unittests/ADT/OptionalTest.cpp
ef93f8
index 2e09c53..20bc9da 100644
ef93f8
--- a/unittests/ADT/OptionalTest.cpp
ef93f8
+++ b/unittests/ADT/OptionalTest.cpp
ef93f8
@@ -518,13 +518,5 @@ TEST_F(OptionalTest, OperatorGreaterEqual) {
ef93f8
   CheckRelation<GreaterEqual>(InequalityLhs, InequalityRhs, !IsLess);
ef93f8
 }
ef93f8
 
ef93f8
-#if __has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)
ef93f8
-static_assert(std::is_trivially_copyable<Optional<int>>::value,
ef93f8
-              "Should be trivially copyable");
ef93f8
-static_assert(
ef93f8
-    !std::is_trivially_copyable<Optional<NonDefaultConstructible>>::value,
ef93f8
-    "Shouldn't be trivially copyable");
ef93f8
-#endif
ef93f8
-
ef93f8
 } // end anonymous namespace
ef93f8
 
ef93f8
-- 
ef93f8
1.8.3.1
ef93f8