mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-29 14:40:40 +03:00
Merge pull request #3441 from kinke/fix_captured_nonpassed
Fix ICE for *captured* parameters *not* passed on the LLVM level
This commit is contained in:
commit
75f18b49ba
5 changed files with 64 additions and 44 deletions
|
@ -815,22 +815,24 @@ void defineParameters(IrFuncTy &irFty, VarDeclarations ¶meters) {
|
|||
size_t llArgIdx = 0;
|
||||
|
||||
for (VarDeclaration *vd : parameters) {
|
||||
Type *paramType = vd->type;
|
||||
IrParameter *irparam = getIrParameter(vd);
|
||||
|
||||
// vd->type (parameter) and irparam->arg->type (argument) don't always
|
||||
// match.
|
||||
// E.g., for a lazy parameter of type T, vd->type is T (with lazy storage
|
||||
// class) while irparam->arg->type is the delegate type.
|
||||
Type *const paramType = (irparam ? irparam->arg->type : vd->type);
|
||||
|
||||
if (!irparam) {
|
||||
// This is a parameter that is not passed on the LLVM level.
|
||||
// Create the param here and set it to a "dummy" alloca that
|
||||
// we do not store to here.
|
||||
irparam = getIrParameter(vd, true);
|
||||
irparam->value = DtoAlloca(vd, vd->ident->toChars());
|
||||
} else if (!irparam->value) {
|
||||
// Captured parameter not passed on the LLVM level.
|
||||
assert(irparam->nestedIndex >= 0);
|
||||
irparam->value = DtoAlloca(vd, vd->ident->toChars());
|
||||
} else {
|
||||
assert(irparam->value);
|
||||
// vd->type (parameter) and irparam->arg->type (argument) don't always
|
||||
// match. E.g., for a lazy parameter of type T, vd->type is T (with lazy
|
||||
// storage class) while irparam->arg->type is the delegate type.
|
||||
paramType = irparam->arg->type;
|
||||
|
||||
if (irparam->arg->byref) {
|
||||
// The argument is an appropriate lvalue passed by reference.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue