diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-07-12 14:11:05 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-07-12 14:11:05 +0000 |
commit | d248619cd1a5e13bb8fb19e97e3e923d792bfea3 (patch) | |
tree | b0c128b8e5b59f96aae2ad337919dbc73e649013 /lib/Sema/SemaExpr.cpp | |
parent | df983a8bcbbcea911b8dce283f044787df119d50 (diff) |
Pop block scope after reading from it.
Found by valgrind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 1e04ac734e..9f91052e4c 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -8496,10 +8496,6 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, BSI->TheDecl->setBody(cast<CompoundStmt>(Body)); - BlockExpr *Result = new (Context) BlockExpr(BSI->TheDecl, BlockTy); - - const AnalysisBasedWarnings::Policy &WP = AnalysisWarnings.getDefaultPolicy(); - PopFunctionOrBlockScope(&WP, Result->getBlockDecl(), Result); for (BlockDecl::capture_const_iterator ci = BSI->TheDecl->capture_begin(), ce = BSI->TheDecl->capture_end(); ci != ce; ++ci) { const VarDecl *variable = ci->getVariable(); @@ -8509,6 +8505,10 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, getCurFunction()->setHasBranchProtectedScope(); } + BlockExpr *Result = new (Context) BlockExpr(BSI->TheDecl, BlockTy); + const AnalysisBasedWarnings::Policy &WP = AnalysisWarnings.getDefaultPolicy(); + PopFunctionOrBlockScope(&WP, Result->getBlockDecl(), Result); + return Owned(Result); } |