Skip to content

Commit 0edb969

Browse files
committed
minor bug fixes
1 parent a056b5b commit 0edb969

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/Serialization/DeserializeSIL.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
629629
(cacheEntry.isDeserialized() && (declarationOnly || forDebugScope))) {
630630
auto fn = cacheEntry.get();
631631

632-
if (fn->isZombie())
632+
if (fn->isZombie() && !forDebugScope)
633633
return nullptr;
634634
return fn;
635635
}
@@ -834,7 +834,7 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
834834

835835
// TODO: for functions deserialized for debug scopes, set linkage to private
836836
// 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);
838838
fn->setTransparent(IsTransparent_t(isTransparent == 1));
839839
fn->setSerializedKind(SerializedKind_t(serializedKind));
840840
fn->setThunk(IsThunk_t(isThunk));
@@ -871,10 +871,10 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
871871
for (auto ID : SemanticsIDs) {
872872
fn->addSemanticsAttr(MF->getIdentifierText(ID));
873873
}
874-
if (forDebugScope) {
874+
if (onlyReferencedByDebugInfo) {
875875
SILMod.eraseFunction(fn);
876876
}
877-
if (Callback && !forDebugScope)
877+
if (Callback && !onlyReferencedByDebugInfo)
878878
Callback->didDeserialize(MF->getAssociatedModule(), fn);
879879
}
880880

@@ -994,7 +994,8 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
994994
}
995995

996996
GenericEnvironment *genericEnv = nullptr;
997-
if (!declarationOnly || forDebugScope) {
997+
//generic signatures are stored for declarations as well in a debug context
998+
if (!declarationOnly || onlyReferencedByDebugInfo) {
998999
genericEnv = MF->getGenericSignature(genericSigID).getGenericEnvironment();
9991000
}
10001001

@@ -1005,7 +1006,7 @@ llvm::Expected<SILFunction *> SILDeserializer::readSILFunctionChecked(
10051006
return maybeEntry.takeError();
10061007
entry = maybeEntry.get();
10071008
bool isEmptyFunction = (entry.Kind == llvm::BitstreamEntry::EndBlock);
1008-
assert((!isEmptyFunction || !genericEnv || forDebugScope) &&
1009+
assert((!isEmptyFunction || !genericEnv || onlyReferencedByDebugInfo) &&
10091010
"generic environment without body?!");
10101011

10111012
// Remember this in our cache in case it's a recursive function.

0 commit comments

Comments
 (0)