swift
9c44b791 - [SILGen] Fix the type of closure thunks that are passed const reference structs (#76903)

Commit
1 year ago
[SILGen] Fix the type of closure thunks that are passed const reference structs (#76903) The thunk's parameter needs the @in_guaranteed convention if it's a const reference parameter. However, that convention wasn't being used because clang importer was removing the const reference from the type and SILGen was computing the type of the parameter based on the type without const reference. This commit fixes the bug by passing the clang function type to SILDeclRef so that it can be used to compute the correct thunk type. This fixes a crash when a closure is passed to a C function taking a pointer to a function that has a const reference struct parameter. This recommits e074426 with fixes to serialization/deserialization of function types. The fixes prevent clang types of functions from being dropped during serialization. rdar://131321096
Author
Parents
Loading