aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
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 {