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

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