[llvm] r346985 - [ADT] Drop llvm::Optional clang-specific optmization for trivially copyable types
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 15 11:32:24 PST 2018
Author: tstellar
Date: Thu Nov 15 11:32:24 2018
New Revision: 346985
URL: http://llvm.org/viewvc/llvm-project?rev=346985&view=rev
Log:
[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
Modified:
llvm/trunk/include/llvm/ADT/Optional.h
Modified: llvm/trunk/include/llvm/ADT/Optional.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Optional.h?rev=346985&r1=346984&r2=346985&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Optional.h (original)
+++ llvm/trunk/include/llvm/ADT/Optional.h Thu Nov 15 11:32:24 2018
@@ -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 {
More information about the llvm-commits
mailing list