]> granicus.if.org Git - clang/commitdiff
Instead of r74522, use another approach to fix xfail_regionstore_wine_crash.c.
authorZhongxing Xu <xuzhongxing@gmail.com>
Tue, 30 Jun 2009 13:00:53 +0000 (13:00 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Tue, 30 Jun 2009 13:00:53 +0000 (13:00 +0000)
Mark the super region of the binding of block level expr in the Environment
as live.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74525 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/Environment.cpp
lib/Analysis/LiveVariables.cpp

index 2b751df830c2fa2ed66be4a8c9d15b833ad56429..1c2802e7fe98a78d5e8f49b0533d0329fbdb85c3 100644 (file)
@@ -143,8 +143,17 @@ EnvironmentManager::RemoveDeadBindings(Environment Env, Stmt* Loc,
       SVal X = I.getData();
 
       // If the block expr's value is a memory region, then mark that region.
-      if (isa<loc::MemRegionVal>(X))
-        DRoots.push_back(cast<loc::MemRegionVal>(X).getRegion());
+      if (isa<loc::MemRegionVal>(X)) {
+        const MemRegion* R = cast<loc::MemRegionVal>(X).getRegion();
+        DRoots.push_back(R);
+        // Mark the super region of the RX as live.
+        // e.g.: int x; char *y = (char*) &x; if (*y) ... 
+        // 'y' => element region. 'x' is its super region.
+        // We only add one level super region for now.
+        if (const SubRegion *SR = dyn_cast<SubRegion>(R)) {
+          DRoots.push_back(SR->getSuperRegion());
+        }
+      }
 
       // Mark all symbols in the block expr's value live.
       MarkLiveCallback cb(SymReaper);
index b354566db02fd1a536cbe9b44f1f76652f3b4e79..aead7f43ad8f657eaf268869d92b9a4e5e2e76f3 100644 (file)
@@ -138,7 +138,6 @@ void TransferFuncs::Visit(Stmt *S) {
   else {
     // For block-level expressions, mark that they are live.
     LiveState(S,AD) = Alive;
-    StmtVisitor<TransferFuncs,void>::Visit(S);
   }
 }