diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-03-04 00:56:45 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-03-04 00:56:45 +0000 |
commit | ed2d2edecc0c5b92df99baf0ee31ac915b2e7c6a (patch) | |
tree | 7ffae73a053c3f49fdcf86fb417288564e0b839e | |
parent | 1e80aa49ec689d1937e54fb353d6626e0a58f0db (diff) |
Fixed insidious state propagation bug that would sometimes cause the state
to bifurcate at the wrong places and not propagate at others.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47876 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Analysis/GRExprEngine.cpp | 11 | ||||
-rw-r--r-- | include/clang/Analysis/PathSensitive/GRExprEngine.h | 6 |
2 files changed, 8 insertions, 9 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp index 660ed1badb..9513deb3f1 100644 --- a/Analysis/GRExprEngine.cpp +++ b/Analysis/GRExprEngine.cpp @@ -437,8 +437,10 @@ GRExprEngine::NodeTy* GRExprEngine::Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, ValueState* St) { // If the state hasn't changed, don't generate a new node. - if (St == Pred->getState()) + if (St == Pred->getState()) { + Dst.Add(Pred); return NULL; + } NodeTy* N = Builder->generateNode(S, St, Pred); Dst.Add(N); @@ -478,11 +480,8 @@ void GRExprEngine::VisitCall(CallExpr* CE, NodeTy* Pred, if (AI != AE) { - NodeSet DstTmp; - - Visit(*AI, Pred, DstTmp); - - if (DstTmp.empty()) DstTmp.Add(Pred); + NodeSet DstTmp; + Visit(*AI, Pred, DstTmp); Expr* CurrentArg = *AI; ++AI; diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h index 3a4e358d66..e310bf577f 100644 --- a/include/clang/Analysis/PathSensitive/GRExprEngine.h +++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h @@ -33,15 +33,15 @@ public: typedef GRSwitchNodeBuilder<GRExprEngine> SwitchNodeBuilder; class NodeSet { - typedef llvm::SmallVector<NodeTy*,3> ImplTy; + typedef llvm::SmallPtrSet<NodeTy*,10> ImplTy; ImplTy Impl; public: - NodeSet(NodeTy* N) { assert (N && !N->isSink()); Impl.push_back(N); } + NodeSet(NodeTy* N) { assert (N && !N->isSink()); Impl.insert(N); } NodeSet() {} - inline void Add(NodeTy* N) { if (N && !N->isSink()) Impl.push_back(N); } + inline void Add(NodeTy* N) { if (N && !N->isSink()) Impl.insert(N); } typedef ImplTy::iterator iterator; typedef ImplTy::const_iterator const_iterator; |