SIL: Make 'isReferenceCounted' a bit on TypeLowering.

This allows types to be lowered as scalar reference-counted types without requiring them to have AST-level reference semantics. For now, put in a staging assertion to ensure isReferenceCounted == hasReferenceSemantics to make sure we set the bit properly everywhere.

Swift SVN r26238
This commit is contained in:
Joe Groff
2015-03-17 21:51:06 +00:00
parent 40ba960379
commit 7f886c924b
8 changed files with 56 additions and 26 deletions

View File

@@ -72,9 +72,9 @@ static void createRefCountOpForPayload(SILBuilder &Builder, SILInstruction *I,
// If we have a retain value...
if (isa<RetainValueInst>(I)) {
// And our payload has reference semantics, insert a strong_retain onto the
// And our payload is refcounted, insert a strong_retain onto the
// payload.
if (UEDITy.hasReferenceSemantics()) {
if (UEDITy.isReferenceCounted(Mod)) {
Builder.createStrongRetain(I->getLoc(), UEDI);
return;
}
@@ -90,7 +90,7 @@ static void createRefCountOpForPayload(SILBuilder &Builder, SILInstruction *I,
"be a release value since enums do not have reference semantics.");
// If our payload has reference semantics, insert the strong release.
if (UEDITy.hasReferenceSemantics()) {
if (UEDITy.isReferenceCounted(Mod)) {
Builder.createStrongRelease(I->getLoc(), UEDI);
return;
}