From: Jordan Rose Date: Thu, 26 Jul 2012 20:04:08 +0000 (+0000) Subject: [analyzer] Variables with destructors are live until the destructor is run. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7f1d134a03ace51f8d142fbb7f436330704ede5;p=clang [analyzer] Variables with destructors are live until the destructor is run. 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 --- diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index 6e10ac1092..584d81284e 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -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(&elem)){ + val.liveDecls = DSetFact.add(val.liveDecls, Dtor->getVarDecl()); + continue; + } + if (!isa(elem)) continue;