Skip to content

Commit 8d1e234

Browse files
authored
Avoid uses of incomplete types in ImmutablePointerSet.h. (#9966)
rdar://problem/32237125
1 parent fdc5539 commit 8d1e234

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

include/swift/Basic/ImmutablePointerSet.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,9 @@ template <typename T> class ImmutablePointerSetFactory {
180180
using PtrTy = typename std::add_pointer<T>::type;
181181

182182
using PtrSet = ImmutablePointerSet<T>;
183-
static constexpr unsigned AllocAlignment =
184-
(alignof(PtrSet) > alignof(PtrTy)) ? alignof(PtrSet) : alignof(PtrTy);
183+
// This is computed out-of-line so that ImmutablePointerSetFactory is
184+
// treated as a complete type.
185+
static const unsigned AllocAlignment;
185186

186187
llvm::BumpPtrAllocator &Allocator;
187188
llvm::FoldingSetVector<PtrSet> Set;
@@ -347,6 +348,10 @@ template <typename T>
347348
ImmutablePointerSet<T> ImmutablePointerSetFactory<T>::EmptyPtrSet =
348349
ImmutablePointerSet<T>(nullptr, {});
349350

351+
template <typename T>
352+
constexpr unsigned ImmutablePointerSetFactory<T>::AllocAlignment =
353+
(alignof(PtrSet) > alignof(PtrTy)) ? alignof(PtrSet) : alignof(PtrTy);
354+
350355
} // end swift namespace
351356

352357
#endif // SWIFT_BASIC_IMMUTABLEPOINTERSET_H

0 commit comments

Comments
 (0)