Merge branch 'master' into merge-2.067

This commit is contained in:
Kai Nacke 2015-06-04 22:02:52 +02:00
commit cddb59f7b7
4 changed files with 15 additions and 13 deletions

View file

@ -73,7 +73,7 @@ ldc::DIScope ldc::DIBuilder::GetCurrentScope()
return fn->diLexicalBlocks.top();
}
void ldc::DIBuilder::Declare(llvm::Value *var, ldc::DILocalVariable divar
void ldc::DIBuilder::Declare(const Loc &loc, llvm::Value *var, ldc::DILocalVariable divar
#if LDC_LLVM_VER >= 306
, ldc::DIExpression diexpr
#endif
@ -84,10 +84,12 @@ void ldc::DIBuilder::Declare(llvm::Value *var, ldc::DILocalVariable divar
diexpr,
#endif
#if LDC_LLVM_VER >= 307
IR->ir->getCurrentDebugLocation(),
llvm::DebugLoc::get(loc.linnum, loc.charnum, GetCurrentScope()),
#endif
IR->scopebb());
instr->setDebugLoc(IR->ir->getCurrentDebugLocation());
#if LDC_LLVM_VER < 307
instr->setDebugLoc(llvm::DebugLoc::get(loc.linnum, loc.charnum, GetCurrentScope()));
#endif
}
ldc::DIFile ldc::DIBuilder::CreateFile(Loc& loc)
@ -932,9 +934,9 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
// declare
#if LDC_LLVM_VER >= 306
Declare(ll, debugVariable, addr.empty() ? DBuilder.createExpression() : DBuilder.createExpression(addr));
Declare(vd->loc, ll, debugVariable, addr.empty() ? DBuilder.createExpression() : DBuilder.createExpression(addr));
#else
Declare(ll, debugVariable);
Declare(vd->loc, ll, debugVariable);
#endif
}

View file

@ -189,7 +189,7 @@ private:
llvm::LLVMContext &getContext();
Module *getDefinedModule(Dsymbol *s);
DIScope GetCurrentScope();
void Declare(llvm::Value *var, ldc::DILocalVariable divar
void Declare(const Loc &loc, llvm::Value *var, ldc::DILocalVariable divar
#if LDC_LLVM_VER >= 306
, ldc::DIExpression diexpr
#endif

View file

@ -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);

View file

@ -403,7 +403,7 @@ public:
DtoEnclosingHandlers(stmt->loc, NULL);
// emit ret
llvm::ReturnInst::Create(gIR->context(), irs->scopebb());
gIR->ir->CreateRetVoid();
}
// the return type is not void, so this is a normal "register" return
else
@ -463,7 +463,7 @@ public:
// emit scopes
DtoEnclosingHandlers(stmt->loc, NULL);
llvm::ReturnInst::Create(gIR->context(), v, irs->scopebb());
gIR->ir->CreateRet(v);
}
}
// no return value expression means it's a void function
@ -471,7 +471,7 @@ public:
{
assert(irs->topfunc()->getReturnType() == LLType::getVoidTy(gIR->context()));
DtoEnclosingHandlers(stmt->loc, NULL);
llvm::ReturnInst::Create(gIR->context(), irs->scopebb());
gIR->ir->CreateRetVoid();
}
// the return terminated this basicblock, start a new one