[llvm-branch-commits] [llvm-branch] r352582 - Merging r347004:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 29 17:13:37 PST 2019


Author: tstellar
Date: Tue Jan 29 17:13:37 2019
New Revision: 352582

URL: http://llvm.org/viewvc/llvm-project?rev=352582&view=rev
Log:
Merging r347004:

------------------------------------------------------------------------
r347004 | tstellar | 2018-11-16 00:47:24 +0000 (Fri, 16 Nov 2018) | 4 lines

Re-apply r346985: [ADT] Drop llvm::Optional clang-specific optimization for trivially copyable types

Remove a test case that was added with the optimization we are now
removing.
------------------------------------------------------------------------

Modified:
    llvm/branches/release_70/include/llvm/ADT/Optional.h
    llvm/branches/release_70/unittests/ADT/OptionalTest.cpp

Modified: llvm/branches/release_70/include/llvm/ADT/Optional.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_70/include/llvm/ADT/Optional.h?rev=352582&r1=352581&r2=352582&view=diff
==============================================================================
--- llvm/branches/release_70/include/llvm/ADT/Optional.h (original)
+++ llvm/branches/release_70/include/llvm/ADT/Optional.h Tue Jan 29 17:13:37 2019
@@ -108,24 +108,6 @@ template <typename T, bool IsPodLike> st
   }
 };
 
-#if !defined(__GNUC__) || defined(__clang__) // GCC up to GCC7 miscompiles this.
-/// Storage for trivially copyable types only.
-template <typename T> struct OptionalStorage<T, true> {
-  AlignedCharArrayUnion<T> storage;
-  bool hasVal = false;
-
-  OptionalStorage() = default;
-
-  OptionalStorage(const T &y) : hasVal(true) { new (storage.buffer) T(y); }
-  OptionalStorage &operator=(const T &y) {
-    *reinterpret_cast<T *>(storage.buffer) = y;
-    hasVal = true;
-    return *this;
-  }
-
-  void reset() { hasVal = false; }
-};
-#endif
 } // namespace optional_detail
 
 template <typename T> class Optional {

Modified: llvm/branches/release_70/unittests/ADT/OptionalTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_70/unittests/ADT/OptionalTest.cpp?rev=352582&r1=352581&r2=352582&view=diff
==============================================================================
--- llvm/branches/release_70/unittests/ADT/OptionalTest.cpp (original)
+++ llvm/branches/release_70/unittests/ADT/OptionalTest.cpp Tue Jan 29 17:13:37 2019
@@ -518,13 +518,5 @@ TEST_F(OptionalTest, OperatorGreaterEqua
   CheckRelation<GreaterEqual>(InequalityLhs, InequalityRhs, !IsLess);
 }
 
-#if __has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)
-static_assert(std::is_trivially_copyable<Optional<int>>::value,
-              "Should be trivially copyable");
-static_assert(
-    !std::is_trivially_copyable<Optional<NonDefaultConstructible>>::value,
-    "Shouldn't be trivially copyable");
-#endif
-
 } // end anonymous namespace
 




More information about the llvm-branch-commits mailing list