While we definitely want this optimization in the future, we're not
currently handling constraints on symbolic /expressions/ correctly.
These should stay live even if the SymExpr itself is no longer referenced
because could recreate an identical SymExpr later. Only once the SymExpr
can no longer be recreated -- i.e. a component symbol is dead -- can we
safely remove the constraints on it.
This liveness issue is tracked by <rdar://problem/
12333297>.
This reverts r163444 /
24c7f98828e039005cff3bd847e7ab404a6a09f8.
llvm-svn: 164275
SymReaper);
NewState.setStore(newStore);
SymReaper.setReapedStore(newStore);
-
- ProgramStateRef Result = getPersistentState(NewState);
- return ConstraintMgr->removeDeadBindings(Result, SymReaper);
+
+ return getPersistentState(NewState);
}
ProgramStateRef ProgramState::bindCompoundLiteral(const CompoundLiteralExpr *CL,
bool Tainted = false;
for (SymExpr::symbol_iterator SI = Sym->symbol_begin(), SE =Sym->symbol_end();
SI != SE; ++SI) {
- if (!isa<SymbolData>(*SI))
- continue;
-
+ assert(isa<SymbolData>(*SI));
const TaintTagType *Tag = get<TaintMap>(*SI);
Tainted = (Tag && *Tag == Kind);
SymExpr::symbol_iterator::symbol_iterator(const SymExpr *SE) {
itr.push_back(SE);
+ while (!isa<SymbolData>(itr.back())) expand();
}
SymExpr::symbol_iterator &SymExpr::symbol_iterator::operator++() {
assert(!itr.empty() && "attempting to iterate on an 'end' iterator");
- expand();
+ assert(isa<SymbolData>(itr.back()));
+ itr.pop_back();
+ if (!itr.empty())
+ while (!isa<SymbolData>(itr.back())) expand();
return *this;
}
SymbolRef SymExpr::symbol_iterator::operator*() {
assert(!itr.empty() && "attempting to dereference an 'end' iterator");
- return itr.back();
+ return cast<SymbolData>(itr.back());
}
void SymExpr::symbol_iterator::expand() {
+++ /dev/null
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.DumpTraversal %s | FileCheck %s
-
-int a();
-int b();
-int c();
-
-void testRemoveDeadBindings() {
- int i = a();
- if (i)
- a();
- else
- b();
-
- // At this point the symbol bound to 'i' is dead.
- // The effects of a() and b() are identical (they both invalidate globals).
- // We should unify the two paths here and only get one end-of-path node.
- c();
-}
-
-// CHECK: --END PATH--
-// CHECK-NOT: --END PATH--
\ No newline at end of file