[PATCH] D54540: [ADT] Drop llvm::Optional clang-specific optmization for trivially copyable types
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 14 13:49:30 PST 2018
tstellar created this revision.
tstellar added reviewers: bkramer, hansw, sylvestre.ledru, mgorny.
Herald added subscribers: kristina, dexonsmith.
This fixes libLLVM.so ABI mismatches between llvm compiled with clang
and llvm compiled with gcc (PR39427).
Repository:
rL LLVM
https://reviews.llvm.org/D54540
Files:
include/llvm/ADT/Optional.h
Index: include/llvm/ADT/Optional.h
===================================================================
--- include/llvm/ADT/Optional.h
+++ include/llvm/ADT/Optional.h
@@ -108,24 +108,6 @@
}
};
-#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 {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54540.174092.patch
Type: text/x-patch
Size: 821 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181114/0a65a6cb/attachment.bin>
More information about the llvm-commits
mailing list