@@ -380,13 +380,13 @@ SILFunction *SILDeserializer::readSILFunction(DeclID FID,
380
380
DeclID clangNodeOwnerID;
381
381
TypeID funcTyID;
382
382
unsigned rawLinkage, isTransparent, isFragile, isThunk, isGlobal,
383
- inlineStrategy, effect, numSpecAttrs;
383
+ inlineStrategy, effect, numSpecAttrs, hasQualifiedOwnership ;
384
384
ArrayRef<uint64_t > SemanticsIDs;
385
385
// TODO: read fragile
386
386
SILFunctionLayout::readRecord (scratch, rawLinkage, isTransparent, isFragile,
387
387
isThunk, isGlobal, inlineStrategy, effect,
388
- numSpecAttrs, funcTyID, clangNodeOwnerID ,
389
- SemanticsIDs);
388
+ numSpecAttrs, hasQualifiedOwnership, funcTyID ,
389
+ clangNodeOwnerID, SemanticsIDs);
390
390
391
391
if (funcTyID == 0 ) {
392
392
DEBUG (llvm::dbgs () << " SILFunction typeID is 0.\n " );
@@ -454,6 +454,8 @@ SILFunction *SILDeserializer::readSILFunction(DeclID FID,
454
454
for (auto ID : SemanticsIDs) {
455
455
fn->addSemanticsAttr (MF->getIdentifier (ID).str ());
456
456
}
457
+ if (!hasQualifiedOwnership)
458
+ fn->setUnqualifiedOwnership ();
457
459
458
460
if (Callback) Callback->didDeserialize (MF->getAssociatedModule (), fn);
459
461
}
@@ -538,7 +540,6 @@ SILFunction *SILDeserializer::readSILFunction(DeclID FID,
538
540
LocalValues.clear ();
539
541
ForwardLocalValues.clear ();
540
542
541
- FunctionOwnershipEvaluator OwnershipEvaluator (fn);
542
543
SILOpenedArchetypesTracker OpenedArchetypesTracker (*fn);
543
544
SILBuilder Builder (*fn);
544
545
// Track the archetypes just like SILGen. This
@@ -572,8 +573,7 @@ SILFunction *SILDeserializer::readSILFunction(DeclID FID,
572
573
return fn;
573
574
574
575
// Handle a SILInstruction record.
575
- if (readSILInstruction (fn, CurrentBB, Builder, OwnershipEvaluator, kind,
576
- scratch)) {
576
+ if (readSILInstruction (fn, CurrentBB, Builder, kind, scratch)) {
577
577
DEBUG (llvm::dbgs () << " readSILInstruction returns error.\n " );
578
578
MF->error ();
579
579
return fn;
@@ -659,10 +659,10 @@ static SILDeclRef getSILDeclRef(ModuleFile *MF,
659
659
return DRef;
660
660
}
661
661
662
- bool SILDeserializer::readSILInstruction (
663
- SILFunction *Fn, SILBasicBlock *BB, SILBuilder &Builder,
664
- FunctionOwnershipEvaluator &OwnershipEvaluator, unsigned RecordKind,
665
- SmallVectorImpl<uint64_t > &scratch) {
662
+ bool SILDeserializer::readSILInstruction (SILFunction *Fn, SILBasicBlock *BB,
663
+ SILBuilder &Builder,
664
+ unsigned RecordKind,
665
+ SmallVectorImpl<uint64_t > &scratch) {
666
666
// Return error if Basic Block is null.
667
667
if (!BB)
668
668
return true ;
@@ -1900,11 +1900,6 @@ bool SILDeserializer::readSILInstruction(
1900
1900
llvm_unreachable (" todo" );
1901
1901
}
1902
1902
1903
- // Evaluate ResultVal's ownership. If we find that as a result of ResultVal,
1904
- // we are mixing qualified and unqualified ownership instructions, bail.
1905
- if (!OwnershipEvaluator.evaluate (ResultVal))
1906
- return true ;
1907
-
1908
1903
if (ResultVal->hasValue ()) {
1909
1904
LastValueID = LastValueID + 1 ;
1910
1905
setLocalValue (ResultVal, LastValueID);
@@ -1973,12 +1968,12 @@ bool SILDeserializer::hasSILFunction(StringRef Name,
1973
1968
DeclID clangOwnerID;
1974
1969
TypeID funcTyID;
1975
1970
unsigned rawLinkage, isTransparent, isFragile, isThunk, isGlobal,
1976
- inlineStrategy, effect, numSpecAttrs;
1971
+ inlineStrategy, effect, numSpecAttrs, hasQualifiedOwnership ;
1977
1972
ArrayRef<uint64_t > SemanticsIDs;
1978
1973
SILFunctionLayout::readRecord (scratch, rawLinkage, isTransparent, isFragile,
1979
1974
isThunk, isGlobal, inlineStrategy, effect,
1980
- numSpecAttrs, funcTyID, clangOwnerID ,
1981
- SemanticsIDs);
1975
+ numSpecAttrs, hasQualifiedOwnership, funcTyID ,
1976
+ clangOwnerID, SemanticsIDs);
1982
1977
auto linkage = fromStableSILLinkage (rawLinkage);
1983
1978
if (!linkage) {
1984
1979
DEBUG (llvm::dbgs () << " invalid linkage code " << rawLinkage
0 commit comments