]> granicus.if.org Git - clang/commitdiff
[analyzer] Variables with destructors are live until the destructor is run.
authorJordan Rose <jordan_rose@apple.com>
Thu, 26 Jul 2012 20:04:08 +0000 (20:04 +0000)
committerJordan Rose <jordan_rose@apple.com>
Thu, 26 Jul 2012 20:04:08 +0000 (20:04 +0000)
Test case in the next commit, which enables destructors under certain
circumstances.

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

lib/Analysis/LiveVariables.cpp

index 6e10ac109278a78e402c16af76c162a416fa924e..584d81284e9121a475dcff15d1c739e434fe5f3b 100644 (file)
@@ -455,6 +455,12 @@ LiveVariablesImpl::runOnBlock(const CFGBlock *block,
   for (CFGBlock::const_reverse_iterator it = block->rbegin(),
        ei = block->rend(); it != ei; ++it) {
     const CFGElement &elem = *it;
+
+    if (const CFGAutomaticObjDtor *Dtor = dyn_cast<CFGAutomaticObjDtor>(&elem)){
+      val.liveDecls = DSetFact.add(val.liveDecls, Dtor->getVarDecl());
+      continue;
+    }
+
     if (!isa<CFGStmt>(elem))
       continue;