mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SILGen] Fix swift_once initializer signature for lazy global var
`Builtin.once` has type `(Builtin.RawPointer, (Builtin.RawPointer) -> ())` at Swift level, but lazy global init passes its initializer as `() -> ()`, so their callee and caller signatures doesn't match.
This commit is contained in:
@@ -228,6 +228,12 @@ void SILGenFunction::emitLazyGlobalInitializer(PatternBindingDecl *binding,
|
||||
unsigned pbdEntry) {
|
||||
MagicFunctionName = SILGenModule::getMagicFunctionName(binding->getDeclContext());
|
||||
|
||||
// Add unused context pointer argument required to pass to `Builtin.once`
|
||||
SILBasicBlock &entry = *F.begin();
|
||||
SILType rawPointerSILTy =
|
||||
getLoweredLoadableType(getASTContext().TheRawPointerType);
|
||||
entry.createFunctionArgument(rawPointerSILTy);
|
||||
|
||||
{
|
||||
Scope scope(Cleanups, binding);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user