mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 08:30:47 +03:00
Merge branch 'master' into merge-2.067
This commit is contained in:
commit
cddb59f7b7
4 changed files with 15 additions and 13 deletions
|
@ -1043,20 +1043,20 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
|||
// pass the previous block into this block
|
||||
gIR->DBuilder.EmitStopPoint(fd->endloc);
|
||||
if (func->getReturnType() == LLType::getVoidTy(gIR->context())) {
|
||||
llvm::ReturnInst::Create(gIR->context(), gIR->scopebb());
|
||||
gIR->ir->CreateRetVoid();
|
||||
}
|
||||
else if (!fd->isMain()) {
|
||||
CompoundAsmStatement* asmb = fd->fbody->endsWithAsm();
|
||||
if (asmb) {
|
||||
assert(asmb->abiret);
|
||||
llvm::ReturnInst::Create(gIR->context(), asmb->abiret, bb);
|
||||
gIR->ir->CreateRet(asmb->abiret);
|
||||
}
|
||||
else {
|
||||
llvm::ReturnInst::Create(gIR->context(), llvm::UndefValue::get(func->getReturnType()), bb);
|
||||
gIR->ir->CreateRet(llvm::UndefValue::get(func->getReturnType()));
|
||||
}
|
||||
}
|
||||
else
|
||||
llvm::ReturnInst::Create(gIR->context(), LLConstant::getNullValue(func->getReturnType()), bb);
|
||||
gIR->ir->CreateRet(LLConstant::getNullValue(func->getReturnType()));
|
||||
}
|
||||
gIR->DBuilder.EmitFuncEnd(fd);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue