summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2008-05-25 05:15:42 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2008-05-25 05:15:42 +0000
commit98070578bfb857b48b3c04a825b4d645dd4c8d6e (patch)
tree56d6e6d53ca9ebd7bf98a266d2565ec9c1043702 /clang/lib/CodeGen/CodeGenFunction.cpp
parentd042a969c9adf00d0f60919d15a4f37bc3afacf5 (diff)
downloadbcm5719-llvm-98070578bfb857b48b3c04a825b4d645dd4c8d6e.tar.gz
bcm5719-llvm-98070578bfb857b48b3c04a825b4d645dd4c8d6e.zip
Generate subprogram debug info with -g.
Also take care of freeing memory at the right places. llvm-svn: 51553
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index b17572ce478..0a016c6416d 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -205,7 +205,7 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
if (body->getLBracLoc().isValid()) {
DI->setLocation(body->getLBracLoc());
}
- DI->EmitFunctionStart(CurFn, Builder);
+ DI->EmitFunctionStart(FD, CurFn, Builder);
}
// Emit allocs for param decls. Give the LLVM Argument nodes names.
@@ -225,21 +225,20 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
// Emit the function body.
EmitStmt(FD->getBody());
+ if (DI) {
+ CompoundStmt* body = cast<CompoundStmt>(CurFuncDecl->getBody());
+ if (body->getRBracLoc().isValid()) {
+ DI->setLocation(body->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();
if (isDummyBlock(BB))
BB->eraseFromParent();
else {
- CGDebugInfo *DI = CGM.getDebugInfo();
- if (DI) {
- CompoundStmt* body = cast<CompoundStmt>(CurFuncDecl->getBody());
- if (body->getRBracLoc().isValid()) {
- DI->setLocation(body->getRBracLoc());
- }
- DI->EmitFunctionEnd(CurFn, Builder);
- }
-
// FIXME: if this is C++ main, this should return 0.
if (CurFn->getReturnType() == llvm::Type::VoidTy)
Builder.CreateRetVoid();
OpenPOWER on IntegriCloud