1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

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: 347004
This commit is contained in:
Tom Stellard 2018-11-16 00:47:24 +00:00
parent 305913c0d8
commit eed954fef0
2 changed files with 0 additions and 26 deletions

View File

@ -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 {

View File

@ -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