Skip to content

Commit cc14a32

Browse files
committed
[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
1 parent 782a15a commit cc14a32

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

llvm/include/llvm/ADT/Optional.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,6 @@ template <typename T, bool IsPodLike> struct OptionalStorage {
108108
}
109109
};
110110

111-
#if !defined(__GNUC__) || defined(__clang__) // GCC up to GCC7 miscompiles this.
112-
/// Storage for trivially copyable types only.
113-
template <typename T> struct OptionalStorage<T, true> {
114-
AlignedCharArrayUnion<T> storage;
115-
bool hasVal = false;
116-
117-
OptionalStorage() = default;
118-
119-
OptionalStorage(const T &y) : hasVal(true) { new (storage.buffer) T(y); }
120-
OptionalStorage &operator=(const T &y) {
121-
*reinterpret_cast<T *>(storage.buffer) = y;
122-
hasVal = true;
123-
return *this;
124-
}
125-
126-
void reset() { hasVal = false; }
127-
};
128-
#endif
129111
} // namespace optional_detail
130112

131113
template <typename T> class Optional {

0 commit comments

Comments
 (0)