diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-03-05 22:49:16 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-03-05 22:49:16 +0000 |
commit | 5dc7f8b2d6a4f94ab4d1377912499a23cf8bc024 (patch) | |
tree | 25c8f2658482e5479baa3cce316e8999ba3f33a6 | |
parent | f34729ae75457891edfd85c984d457acd236d1b0 (diff) |
Small bug fix when handling CallExprs that generate sink nodes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47970 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Analysis/GRExprEngine.cpp | 13 | ||||
-rw-r--r-- | include/clang/Analysis/PathSensitive/GRCoreEngine.h | 15 |
2 files changed, 11 insertions, 17 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp index f8ebbec597..fa623a49e4 100644 --- a/Analysis/GRExprEngine.cpp +++ b/Analysis/GRExprEngine.cpp @@ -501,17 +501,8 @@ void GRExprEngine::VisitCall(CallExpr* CE, NodeTy* Pred, SaveAndRestore<bool> OldSink(Builder->BuildSinks); if (isa<lval::FuncVal>(L)) - if (cast<lval::FuncVal>(L).getDecl()->getAttr<NoReturnAttr>()) { - for (NodeSet::iterator I=Dst.begin(), E=Dst.end(); I != E; ++I ) { - - NodeTy* N = *I; - - if (!N->isSink()) - N->markAsSink(); - } - + if (cast<lval::FuncVal>(L).getDecl()->getAttr<NoReturnAttr>()) Builder->BuildSinks = true; - } // Evaluate the call. @@ -573,7 +564,7 @@ void GRExprEngine::VisitCall(CallExpr* CE, NodeTy* Pred, EvalCall(Dst, CE, cast<LVal>(L), *DI); - if (Dst.size() == size) + if (!Builder->BuildSinks && Dst.size() == size) Nodify(Dst, CE, *DI, St); } } diff --git a/include/clang/Analysis/PathSensitive/GRCoreEngine.h b/include/clang/Analysis/PathSensitive/GRCoreEngine.h index e38f86e07a..37dddea281 100644 --- a/include/clang/Analysis/PathSensitive/GRCoreEngine.h +++ b/include/clang/Analysis/PathSensitive/GRCoreEngine.h @@ -177,20 +177,23 @@ public: } NodeTy* Nodify(ExplodedNodeSet<StateTy>& Dst, Stmt* S, - NodeTy* Pred, StateTy* St) { + NodeTy* Pred, StateTy* St) { + // If the state hasn't changed, don't generate a new node. - if (St == Pred->getState()) { + if (!BuildSinks && St == Pred->getState()) { Dst.Add(Pred); return NULL; } NodeTy* N = generateNode(S, St, Pred); - if (N && BuildSinks) - N->markAsSink(); - else - Dst.Add(N); + if (N) { + if (BuildSinks) + N->markAsSink(); + else + Dst.Add(N); + } return N; } |