From cc14a3241161313c9f238c22134aba6140a91597 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 15 Nov 2018 19:32:24 +0000 Subject: [PATCH] [ADT] Drop llvm::Optional clang-specific optmization for trivially copyable types Summary: This fixes libLLVM.so ABI mismatches between llvm compiled with clang and llvm compiled with gcc (PR39427). Reviewers: bkramer, sylvestre.ledru, mgorny, hans Reviewed By: bkramer, hans Subscribers: dexonsmith, kristina, llvm-commits Differential Revision: https://reviews.llvm.org/D54540 llvm-svn: 346985 --- llvm/include/llvm/ADT/Optional.h | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h index 353e5d0..9fe9b28 100644 --- a/llvm/include/llvm/ADT/Optional.h +++ b/llvm/include/llvm/ADT/Optional.h @@ -108,24 +108,6 @@ template struct OptionalStorage { } }; -#if !defined(__GNUC__) || defined(__clang__) // GCC up to GCC7 miscompiles this. -/// Storage for trivially copyable types only. -template struct OptionalStorage { - AlignedCharArrayUnion storage; - bool hasVal = false; - - OptionalStorage() = default; - - OptionalStorage(const T &y) : hasVal(true) { new (storage.buffer) T(y); } - OptionalStorage &operator=(const T &y) { - *reinterpret_cast(storage.buffer) = y; - hasVal = true; - return *this; - } - - void reset() { hasVal = false; } -}; -#endif } // namespace optional_detail template class Optional { -- 2.7.4