[cfe-commits] r134983 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Benjamin Kramer benny.kra at googlemail.com
Tue Jul 12 07:11:05 PDT 2011


Author: d0k
Date: Tue Jul 12 09:11:05 2011
New Revision: 134983

URL: http://llvm.org/viewvc/llvm-project?rev=134983&view=rev
Log:
Pop block scope after reading from it.

Found by valgrind.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=134983&r1=134982&r2=134983&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Jul 12 09:11:05 2011
@@ -8496,10 +8496,6 @@
 
   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 @@
       getCurFunction()->setHasBranchProtectedScope();
   }
 
+  BlockExpr *Result = new (Context) BlockExpr(BSI->TheDecl, BlockTy);
+  const AnalysisBasedWarnings::Policy &WP = AnalysisWarnings.getDefaultPolicy();
+  PopFunctionOrBlockScope(&WP, Result->getBlockDecl(), Result);
+
   return Owned(Result);
 }
 





More information about the cfe-commits mailing list