aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGStmt.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
commit1c6a38bcea17801e9a4738753aee845381af2b6c (patch)
treeececb2af4e35a2ba10f5311d54c941b9f270c1fb /lib/CodeGen/CGStmt.cpp
parent143520261eb41411beb3e2a8cf6d8dc822db7d50 (diff)
Generate subprogram debug info with -g.
Also take care of freeing memory at the right places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51553 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r--lib/CodeGen/CGStmt.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index c38ad04001..067d6ebd09 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -88,10 +88,25 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
// FIXME: handle vla's etc.
if (S.body_empty() || !isa<Expr>(S.body_back())) GetLast = false;
+ CGDebugInfo *DI = CGM.getDebugInfo();
+ if (DI) {
+ if (S.getLBracLoc().isValid()) {
+ DI->setLocation(S.getLBracLoc());
+ }
+ DI->EmitRegionStart(CurFn, Builder);
+ }
+
for (CompoundStmt::const_body_iterator I = S.body_begin(),
E = S.body_end()-GetLast; I != E; ++I)
EmitStmt(*I);
+ if (DI) {
+ if (S.getRBracLoc().isValid()) {
+ DI->setLocation(S.getRBracLoc());
+ }
+ DI->EmitRegionEnd(CurFn, Builder);
+ }
+
if (!GetLast)
return RValue::get(0);
@@ -368,15 +383,6 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
EmitAggExpr(RV, SRetPtr, false);
}
- CGDebugInfo *DI = CGM.getDebugInfo();
- if (DI) {
- CompoundStmt* body = cast<CompoundStmt>(CurFuncDecl->getBody());
- if (body->getRBracLoc().isValid()) {
- DI->setLocation(body->getRBracLoc());
- }
- DI->EmitFunctionEnd(CurFn, Builder);
- }
-
if (RetValue) {
Builder.CreateRet(RetValue);
} else {