summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <tstellar@redhat.com>2019-01-30 01:13:37 +0000
committerTom Stellard <tstellar@redhat.com>2019-01-30 01:13:37 +0000
commitf7211fd64a89d93a7f4c7762b16b405fef7d8db5 (patch)
tree8e676e333e6eaaf4ed03f023c34d108c972f8313
parent7735ea39c9b988c0f3dec5499d36ba6f1de1b91a (diff)
downloadllvm-f7211fd64a89d93a7f4c7762b16b405fef7d8db5.tar.gz
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. ------------------------------------------------------------------------ llvm-svn: 352582
-rw-r--r--llvm/include/llvm/ADT/Optional.h18
-rw-r--r--llvm/unittests/ADT/OptionalTest.cpp8
2 files changed, 0 insertions, 26 deletions
diff --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h
index 353e5d0ec9df..9fe9b2824ad6 100644
--- a/llvm/include/llvm/ADT/Optional.h
+++ b/llvm/include/llvm/ADT/Optional.h
@@ -108,24 +108,6 @@ template <typename T, bool IsPodLike> struct OptionalStorage {
}
};
-#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 {
diff --git a/llvm/unittests/ADT/OptionalTest.cpp b/llvm/unittests/ADT/OptionalTest.cpp
index 2e09c5340fa3..20bc9da4d594 100644
--- a/llvm/unittests/ADT/OptionalTest.cpp
+++ b/llvm/unittests/ADT/OptionalTest.cpp
@@ -518,13 +518,5 @@ TEST_F(OptionalTest, OperatorGreaterEqual) {
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