mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 00:55:49 +03:00
Fix ICE for ref/out params of opaque structs
Fixes dmd-testsuite's new compilable/test21668.d.
This commit is contained in:
parent
3abffca14c
commit
52bcbcc566
3 changed files with 25 additions and 13 deletions
|
@ -183,7 +183,16 @@ llvm::FunctionType *DtoFunctionType(Type *type, IrFuncTy &irFty, Type *thistype,
|
|||
loweredDType = merge(ltd);
|
||||
} else if (passPointer) {
|
||||
// ref/out
|
||||
attrs.addDereferenceableAttr(loweredDType->size());
|
||||
auto ts = loweredDType->toBasetype()->isTypeStruct();
|
||||
if (ts && !ts->sym->members) {
|
||||
// opaque struct
|
||||
attrs.addAttribute(LLAttribute::NonNull);
|
||||
#if LDC_LLVM_VER >= 1100
|
||||
attrs.addAttribute(LLAttribute::NoUndef);
|
||||
#endif
|
||||
} else {
|
||||
attrs.addDereferenceableAttr(loweredDType->size());
|
||||
}
|
||||
} else {
|
||||
if (abi->passByVal(f, loweredDType)) {
|
||||
// LLVM ByVal parameters are pointers to a copy in the function
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue