diff --git a/gen/dibuilder.cpp b/gen/dibuilder.cpp index 280dab9563..c196552ad3 100644 --- a/gen/dibuilder.cpp +++ b/gen/dibuilder.cpp @@ -827,7 +827,7 @@ void ldc::DIBuilder::EmitBlockEnd() void ldc::DIBuilder::EmitStopPoint(Loc& loc) { - if (!global.params.symdebug) + if (!global.params.symdebug || !loc.linnum) return; Logger::println("D to dwarf stoppoint at line %u, column %u", loc.linnum, loc.charnum); diff --git a/gen/functions.cpp b/gen/functions.cpp index 73033121c1..d5b7ba01e2 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -1041,7 +1041,7 @@ void DtoDefineFunction(FuncDeclaration* fd) // in automatically, so we do it here. // pass the previous block into this block - gIR->DBuilder.EmitFuncEnd(fd); + gIR->DBuilder.EmitStopPoint(fd->endloc); if (func->getReturnType() == LLType::getVoidTy(gIR->context())) { llvm::ReturnInst::Create(gIR->context(), gIR->scopebb()); } @@ -1058,6 +1058,7 @@ void DtoDefineFunction(FuncDeclaration* fd) else llvm::ReturnInst::Create(gIR->context(), LLConstant::getNullValue(func->getReturnType()), bb); } + gIR->DBuilder.EmitFuncEnd(fd); // erase alloca point if (allocaPoint->getParent()) diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 941b5b2f3f..488132d1f6 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -208,9 +208,6 @@ void DtoAssert(Module* M, Loc& loc, DValue* msg) // call gIR->CreateCallOrInvoke(fn, args); - // end debug info - gIR->DBuilder.EmitFuncEnd(gIR->func()->decl); - // after assert is always unreachable gIR->ir->CreateUnreachable(); } diff --git a/gen/statements.cpp b/gen/statements.cpp index b1d4e58390..e6e6679681 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -402,9 +402,6 @@ public: // emit scopes DtoEnclosingHandlers(stmt->loc, NULL); - // emit dbg end function - gIR->DBuilder.EmitFuncEnd(f->decl); - // emit ret llvm::ReturnInst::Create(gIR->context(), irs->scopebb()); } @@ -466,7 +463,6 @@ public: // emit scopes DtoEnclosingHandlers(stmt->loc, NULL); - gIR->DBuilder.EmitFuncEnd(irs->func()->decl); llvm::ReturnInst::Create(gIR->context(), v, irs->scopebb()); } } @@ -475,7 +471,6 @@ public: { assert(irs->topfunc()->getReturnType() == LLType::getVoidTy(gIR->context())); DtoEnclosingHandlers(stmt->loc, NULL); - gIR->DBuilder.EmitFuncEnd(irs->func()->decl); llvm::ReturnInst::Create(gIR->context(), irs->scopebb()); } @@ -1096,8 +1091,6 @@ public: assert(stmt->exp); DValue* e = toElemDtor(stmt->exp); - gIR->DBuilder.EmitFuncEnd(gIR->func()->decl); - llvm::Function* fn = LLVM_D_GetRuntimeFunction(stmt->loc, gIR->module, "_d_throw_exception"); //Logger::cout() << "calling: " << *fn << '\n'; LLValue* arg = DtoBitCast(e->getRVal(), fn->getFunctionType()->getParamType(0));