Skip to content

Commit b54974e

Browse files
committed
remove alignment fix
1 parent 56f4cee commit b54974e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/include/llvm/ADT/FunctionExtras.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ using EnableIfCallable = std::enable_if_t<std::disjunction<
8080
template <typename ReturnT, typename... ParamTs> class UniqueFunctionBase {
8181
protected:
8282
static constexpr size_t InlineStorageSize = sizeof(void *) * 3;
83-
static constexpr size_t InlineStorageAlign = alignof(void *);
8483

8584
template <typename T, class = void>
8685
struct IsSizeLessThanThresholdT : std::false_type {};
@@ -162,8 +161,7 @@ template <typename ReturnT, typename... ParamTs> class UniqueFunctionBase {
162161
// provide three pointers worth of storage here.
163162
// This is mutable as an inlined `const unique_function<void() const>` may
164163
// still modify its own mutable members.
165-
alignas(InlineStorageAlign) mutable std::byte
166-
InlineStorage[InlineStorageSize];
164+
alignas(void *) mutable std::byte InlineStorage[InlineStorageSize];
167165
} StorageUnion;
168166

169167
// A compressed pointer to either our dispatching callback or our table of
@@ -264,7 +262,7 @@ template <typename ReturnT, typename... ParamTs> class UniqueFunctionBase {
264262
bool IsInlineStorage = true;
265263
void *CallableAddr = getInlineStorage();
266264
if (sizeof(CallableT) > InlineStorageSize ||
267-
alignof(CallableT) > InlineStorageAlign) {
265+
alignof(CallableT) > alignof(decltype(StorageUnion.InlineStorage))) {
268266
IsInlineStorage = false;
269267
// Allocate out-of-line storage. FIXME: Use an explicit alignment
270268
// parameter in C++17 mode.

0 commit comments

Comments
 (0)