[cfe-commits] r90462 - /cfe/trunk/lib/Analysis/RegionStore.cpp

Ted Kremenek kremenek at apple.com
Thu Dec 3 09:48:06 PST 2009


Author: kremenek
Date: Thu Dec  3 11:48:05 2009
New Revision: 90462

URL: http://llvm.org/viewvc/llvm-project?rev=90462&view=rev
Log:
Tweak handling of BlockDataRegions in RegionStoreManager::RemoveDeadBindings():  only the VarRegions for variables marked with the '__block' annotation should have their lifetime extended by a BlockDataRegion.

Modified:
    cfe/trunk/lib/Analysis/RegionStore.cpp

Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=90462&r1=90461&r2=90462&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Thu Dec  3 11:48:05 2009
@@ -1776,14 +1776,16 @@
     if (const SymbolicRegion *SymR = dyn_cast<SymbolicRegion>(R))
       SymReaper.markLive(SymR->getSymbol());
     
-    // For BlockDataRegions, enqueue all VarRegions for that are referenced
+    // For BlockDataRegions, enqueue the VarRegions for variables marked
+    // with __block (passed-by-reference).
     // via BlockDeclRefExprs.
     if (const BlockDataRegion *BD = dyn_cast<BlockDataRegion>(R)) {
       for (BlockDataRegion::referenced_vars_iterator
             RI = BD->referenced_vars_begin(), RE = BD->referenced_vars_end();
-           RI != RE; ++RI)
-        WorkList.push_back(std::make_pair(state_N, *RI));
-
+           RI != RE; ++RI) {
+        if ((*RI)->getDecl()->getAttr<BlocksAttr>())
+          WorkList.push_back(std::make_pair(state_N, *RI));
+      }
       // No possible data bindings on a BlockDataRegion.  Continue to the
       // next region in the worklist.
       continue;





More information about the cfe-commits mailing list