[cfe-commits] r164275 - in /cfe/trunk: lib/StaticAnalyzer/Core/ProgramState.cpp lib/StaticAnalyzer/Core/SymbolManager.cpp test/Analysis/traversal-path-unification.c
Jordan Rose
jordan_rose at apple.com
Wed Sep 19 18:54:56 PDT 2012
Author: jrose
Date: Wed Sep 19 20:54:56 2012
New Revision: 164275
URL: http://llvm.org/viewvc/llvm-project?rev=164275&view=rev
Log:
Revert "[analyzer] Remove constraints on dead symbols as part of removeDeadBindings."
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.
Removed:
cfe/trunk/test/Analysis/traversal-path-unification.c
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp?rev=164275&r1=164274&r2=164275&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp Wed Sep 19 20:54:56 2012
@@ -106,9 +106,8 @@
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,
@@ -687,9 +686,7 @@
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);
Modified: cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp?rev=164275&r1=164274&r2=164275&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp Wed Sep 19 20:54:56 2012
@@ -117,17 +117,21 @@
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() {
Removed: cfe/trunk/test/Analysis/traversal-path-unification.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/traversal-path-unification.c?rev=164274&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/traversal-path-unification.c (original)
+++ cfe/trunk/test/Analysis/traversal-path-unification.c (removed)
@@ -1,21 +0,0 @@
-// 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
More information about the cfe-commits
mailing list