Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/swift/AST/IndexSubset.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class IndexSubset : public llvm::FoldingSetNode {
/// The number of bit words in the index subset.
unsigned numBitWords;

static unsigned getNumBytesNeededForCapacity(unsigned capacity) {
return getNumBitWordsNeededForCapacity(capacity) * bitWordSize;
}

BitWord *getBitWordsData() {
return reinterpret_cast<BitWord *>(this + 1);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4822,7 +4822,7 @@ IndexSubset::get(ASTContext &ctx, const SmallBitVector &indices) {
if (existing)
return existing;
auto sizeToAlloc = sizeof(IndexSubset) +
getNumBitWordsNeededForCapacity(capacity);
getNumBytesNeededForCapacity(capacity);
auto *buf = reinterpret_cast<IndexSubset *>(
ctx.Allocate(sizeToAlloc, alignof(IndexSubset)));
auto *newNode = new (buf) IndexSubset(indices);
Expand Down