mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
IRGen: Use deinit to destroy move-only structs that have them.
The `deinit` takes full responsibility for destroying the value, using the user-defined deinit body and implicitly destroying any remaining resources not consumed during the deinit. Remaining to do after this patch: - Run the deinit for enums - Pass generic arguments for generic move-only types - Handle deinits that take their parameter indirectly - Teach value witness layout about when types are move-only and/or have deinits, so that we don't attempt to give move-only types standard value witness tables or share box metadata with copyable payloads
This commit is contained in:
@@ -449,7 +449,7 @@ IRGenModule::getOrCreateReleaseFunction(const TypeInfo &ti,
|
||||
loadableTI->getFixedAlignment());
|
||||
Explosion loaded;
|
||||
loadableTI->loadAsTake(IGF, addr, loaded);
|
||||
loadableTI->consume(IGF, loaded, atomicity);
|
||||
loadableTI->consume(IGF, loaded, atomicity, t);
|
||||
IGF.Builder.CreateRet(addr.getAddress());
|
||||
},
|
||||
true /*setIsNoInline*/);
|
||||
|
||||
Reference in New Issue
Block a user