@@ -629,7 +629,7 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
629
629
(cacheEntry.isDeserialized () && (declarationOnly || forDebugScope))) {
630
630
auto fn = cacheEntry.get ();
631
631
632
- if (fn->isZombie ())
632
+ if (fn->isZombie () && !forDebugScope )
633
633
return nullptr ;
634
634
return fn;
635
635
}
@@ -834,7 +834,7 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
834
834
835
835
// TODO: for functions deserialized for debug scopes, set linkage to private
836
836
// as public symbols make into the final binary even when zombies?
837
- fn->setLinkage (forDebugScope ? SILLinkage::Private : linkage);
837
+ fn->setLinkage (onlyReferencedByDebugInfo ? SILLinkage::Private : linkage);
838
838
fn->setTransparent (IsTransparent_t (isTransparent == 1 ));
839
839
fn->setSerializedKind (SerializedKind_t (serializedKind));
840
840
fn->setThunk (IsThunk_t (isThunk));
@@ -871,10 +871,10 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
871
871
for (auto ID : SemanticsIDs) {
872
872
fn->addSemanticsAttr (MF->getIdentifierText (ID));
873
873
}
874
- if (forDebugScope ) {
874
+ if (onlyReferencedByDebugInfo ) {
875
875
SILMod.eraseFunction (fn);
876
876
}
877
- if (Callback && !forDebugScope )
877
+ if (Callback && !onlyReferencedByDebugInfo )
878
878
Callback->didDeserialize (MF->getAssociatedModule (), fn);
879
879
}
880
880
@@ -994,7 +994,8 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
994
994
}
995
995
996
996
GenericEnvironment *genericEnv = nullptr ;
997
- if (!declarationOnly || forDebugScope) {
997
+ // generic signatures are stored for declarations as well in a debug context
998
+ if (!declarationOnly || onlyReferencedByDebugInfo) {
998
999
genericEnv = MF->getGenericSignature (genericSigID).getGenericEnvironment ();
999
1000
}
1000
1001
@@ -1005,7 +1006,7 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
1005
1006
return maybeEntry.takeError ();
1006
1007
entry = maybeEntry.get ();
1007
1008
bool isEmptyFunction = (entry.Kind == llvm::BitstreamEntry::EndBlock);
1008
- assert ((!isEmptyFunction || !genericEnv || forDebugScope ) &&
1009
+ assert ((!isEmptyFunction || !genericEnv || onlyReferencedByDebugInfo ) &&
1009
1010
" generic environment without body?!" );
1010
1011
1011
1012
// Remember this in our cache in case it's a recursive function.
0 commit comments