Serialization: Don't fail out of loadNamedMembers()

This cleanup exposed a problem with deserialization recovery and
property wrappers. If deserializing a property backed by a wrapper
failed, the lazy member lookup would fail, but subsequently a
loadAllMembers() call would still load the property.

This behavior is actually incorrect, because silently dropping a
stored property of a @frozen struct can result in miscompiles.
I've filed rdar://59403542 and rdar://59403617 to track fixing this.

In the meantime, I've tweaked the logic a bit to preserve the old
behavior.
This commit is contained in:
Slava Pestov
2020-01-22 01:08:14 -05:00
parent 07c8b1b6ed
commit d5cc01da0c
2 changed files with 5 additions and 13 deletions

View File

@@ -2399,7 +2399,7 @@ ModuleFile::loadNamedMembers(const IterableDeclContext *IDC, DeclBaseName N,
fatalIfUnexpected(DeclMemberTablesCursor.advance());
if (entry.Kind != llvm::BitstreamEntry::Record) {
fatal();
return None;
return results;
}
SmallVector<uint64_t, 64> scratch;
StringRef blobData;
@@ -2424,10 +2424,6 @@ ModuleFile::loadNamedMembers(const IterableDeclContext *IDC, DeclBaseName N,
if (!getContext().LangOpts.EnableDeserializationRecovery)
fatal(mem.takeError());
consumeError(mem.takeError());
// Treat this as a cache-miss to the caller and let them attempt
// to refill through the normal loadAllMembers() path.
return None;
}
}
}