Skip to content

Commit 9581354

Browse files
authored
Merge pull request #7762 from hughbe/refcnt-fixes
2 parents ade42eb + fe48ea7 commit 9581354

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

stdlib/public/SwiftShims/RefCount.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,13 @@ class RefCountBitsT {
433433
}
434434

435435
LLVM_ATTRIBUTE_ALWAYS_INLINE
436-
RefCountBitsT(RefCountBitsT<RefCountIsInline> newbits) {
436+
RefCountBitsT(const RefCountBitsT<RefCountIsInline> *newbitsPtr) {
437437
bits = 0;
438+
439+
assert(newbitsPtr && "expected non null newbits");
440+
RefCountBitsT<RefCountIsInline> newbits = *newbitsPtr;
438441

439-
if (refcountIsInline || sizeof(newbits) == sizeof(*this)) {
442+
if (refcountIsInline || sizeof(newbits) == sizeof(*this)) {
440443
// this and newbits are both inline
441444
// OR this is out-of-line but the same layout as inline.
442445
// (FIXME: use something cleaner than sizeof for same-layout test)
@@ -672,7 +675,7 @@ class SideTableRefCountBits : public RefCountBitsT<RefCountNotInline>
672675

673676
LLVM_ATTRIBUTE_ALWAYS_INLINE
674677
SideTableRefCountBits(InlineRefCountBits newbits)
675-
: RefCountBitsT<RefCountNotInline>(newbits), weakBits(1)
678+
: RefCountBitsT<RefCountNotInline>(&newbits), weakBits(1)
676679
{ }
677680

678681

0 commit comments

Comments
 (0)