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(); 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 #if LDC_LLVM_VER >= 306
, ldc::DIExpression diexpr , ldc::DIExpression diexpr
#endif #endif
@ -84,10 +84,12 @@ void ldc::DIBuilder::Declare(llvm::Value *var, ldc::DILocalVariable divar
diexpr, diexpr,
#endif #endif
#if LDC_LLVM_VER >= 307 #if LDC_LLVM_VER >= 307
IR->ir->getCurrentDebugLocation(), llvm::DebugLoc::get(loc.linnum, loc.charnum, GetCurrentScope()),
#endif #endif
IR->scopebb()); 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) ldc::DIFile ldc::DIBuilder::CreateFile(Loc& loc)
@ -932,9 +934,9 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
// declare // declare
#if LDC_LLVM_VER >= 306 #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 #else
Declare(ll, debugVariable); Declare(vd->loc, ll, debugVariable);
#endif #endif
} }

View file

@ -189,7 +189,7 @@ private:
llvm::LLVMContext &getContext(); llvm::LLVMContext &getContext();
Module *getDefinedModule(Dsymbol *s); Module *getDefinedModule(Dsymbol *s);
DIScope GetCurrentScope(); 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 #if LDC_LLVM_VER >= 306
, ldc::DIExpression diexpr , ldc::DIExpression diexpr
#endif #endif

View file

@ -1043,20 +1043,20 @@ void DtoDefineFunction(FuncDeclaration* fd)
// pass the previous block into this block // pass the previous block into this block
gIR->DBuilder.EmitStopPoint(fd->endloc); gIR->DBuilder.EmitStopPoint(fd->endloc);
if (func->getReturnType() == LLType::getVoidTy(gIR->context())) { if (func->getReturnType() == LLType::getVoidTy(gIR->context())) {
llvm::ReturnInst::Create(gIR->context(), gIR->scopebb()); gIR->ir->CreateRetVoid();
} }
else if (!fd->isMain()) { else if (!fd->isMain()) {
CompoundAsmStatement* asmb = fd->fbody->endsWithAsm(); CompoundAsmStatement* asmb = fd->fbody->endsWithAsm();
if (asmb) { if (asmb) {
assert(asmb->abiret); assert(asmb->abiret);
llvm::ReturnInst::Create(gIR->context(), asmb->abiret, bb); gIR->ir->CreateRet(asmb->abiret);
} }
else { else {
llvm::ReturnInst::Create(gIR->context(), llvm::UndefValue::get(func->getReturnType()), bb); gIR->ir->CreateRet(llvm::UndefValue::get(func->getReturnType()));
} }
} }
else else
llvm::ReturnInst::Create(gIR->context(), LLConstant::getNullValue(func->getReturnType()), bb); gIR->ir->CreateRet(LLConstant::getNullValue(func->getReturnType()));
} }
gIR->DBuilder.EmitFuncEnd(fd); gIR->DBuilder.EmitFuncEnd(fd);

View file

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