mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Fix deserializing opaque types for computed properties and subscripts
A client shouldn't know about the underlying type of an opaque type unless it can see the body of the naming decl. Attempting to read it can lead to accessing a hidden dependency and a compiler crash. This was protected by a check specific to function decls but var decls and subscripts were not handled. To support them we have to move this logic to the writer side where we have access to the full AbstractStorageDecl and write in the swifmodule whether the underlying type should be visible outside of the module. rdar://117607906
This commit is contained in:
@@ -4490,11 +4490,14 @@ public:
|
||||
}
|
||||
uint8_t rawAccessLevel =
|
||||
getRawStableAccessLevel(opaqueDecl->getFormalAccess());
|
||||
bool exportDetails = opaqueDecl->exportUnderlyingType();
|
||||
|
||||
unsigned abbrCode = S.DeclTypeAbbrCodes[OpaqueTypeLayout::Code];
|
||||
OpaqueTypeLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode,
|
||||
contextID.getOpaqueValue(), namingDeclID,
|
||||
interfaceSigID, interfaceTypeID, genericSigID,
|
||||
underlyingSubsID, rawAccessLevel);
|
||||
underlyingSubsID, rawAccessLevel,
|
||||
exportDetails);
|
||||
writeGenericParams(opaqueDecl->getGenericParams());
|
||||
|
||||
// Serialize all of the conditionally available substitutions expect the
|
||||
|
||||
Reference in New Issue
Block a user