diff options
| author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2008-07-04 11:04:26 +0000 |
|---|---|---|
| committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2008-07-04 11:04:26 +0000 |
| commit | 1e8b6087511c228990d1408833a2354969df4b9c (patch) | |
| tree | 5f2951e38f8da681afcd80d38a8d9e7743674495 /clang/lib/CodeGen | |
| parent | 5708a4661ecfa62865bc6a25af1348f5b6e4f759 (diff) | |
| download | bcm5719-llvm-1e8b6087511c228990d1408833a2354969df4b9c.tar.gz bcm5719-llvm-1e8b6087511c228990d1408833a2354969df4b9c.zip | |
Fixed bugzilla bug# 2489.
This was broken when the GenerateCode function was splitted to use GenerateFunction.
llvm-svn: 53136
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index ebc1ff500d0..ff46fa69c36 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/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<CompoundStmt>(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<CompoundStmt>(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(); |

