From af99417156c652a6f04dff643925036dc3241d60 Mon Sep 17 00:00:00 2001 From: Sanjiv Gupta Date: Fri, 4 Jul 2008 11:04:26 +0000 Subject: Fixed bugzilla bug# 2489. This was broken when the GenerateCode function was splitted to use GenerateFunction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53136 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index ebc1ff500d..ff46fa69c3 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -69,6 +69,16 @@ void CodeGenFunction::GenerateFunction(const Stmt *Body) { // Emit the function body. EmitStmt(Body); + // Emit debug descriptor for function end. + CGDebugInfo *DI = CGM.getDebugInfo(); + if (DI) { + const CompoundStmt* s = dyn_cast(Body); + if (s && s->getRBracLoc().isValid()) { + DI->setLocation(s->getRBracLoc()); + } + DI->EmitRegionEnd(CurFn, Builder); + } + // Emit a return for code that falls off the end. If insert point // is a dummy block with no predecessors then remove the block itself. llvm::BasicBlock *BB = Builder.GetInsertBlock(); @@ -109,6 +119,16 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD) { Builder.SetInsertPoint(EntryBB); + // Emit subprogram debug descriptor. + CGDebugInfo *DI = CGM.getDebugInfo(); + if (DI) { + CompoundStmt* body = dyn_cast(FD->getBody()); + if (body && body->getLBracLoc().isValid()) { + DI->setLocation(body->getLBracLoc()); + } + DI->EmitFunctionStart(FD, CurFn, Builder); + } + // Emit allocs for param decls. Give the LLVM Argument nodes names. llvm::Function::arg_iterator AI = CurFn->arg_begin(); -- cgit v1.2.3-18-g5258