diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-18 19:23:43 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-18 19:23:43 +0000 |
commit | cb61292aeafc1dc1bc4064fb3d2733717d1d50e5 (patch) | |
tree | a211da1ffa3b4c26fe8bc6d99c2f00fa27f49ee5 /lib/Analysis/GRExprEngine.cpp | |
parent | 550a0f94938817e3550d79adcc6f1f27410f7593 (diff) |
Added "GetErrorNodes()" to BugType so that -trim-egraph can recognize errors
from registered BugTypes. This helps with debugging.
Add detection of NULL values in ref count checker; this suppresses false positives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49912 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index e3fe239553..63986fb38a 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -1843,7 +1843,9 @@ ValueState* GRExprEngine::Assume(ValueState* St, LVal Cond, bool Assumption, bool& isFeasible) { St = AssumeAux(St, Cond, Assumption, isFeasible); - return isFeasible ? St : TF->EvalAssume(St, Cond, Assumption); + + return isFeasible ? TF->EvalAssume(*this, St, Cond, Assumption, isFeasible) + : St; } ValueState* GRExprEngine::AssumeAux(ValueState* St, LVal Cond, @@ -1881,7 +1883,9 @@ ValueState* GRExprEngine::Assume(ValueState* St, NonLVal Cond, bool Assumption, bool& isFeasible) { St = AssumeAux(St, Cond, Assumption, isFeasible); - return isFeasible ? St : TF->EvalAssume(St, Cond, Assumption); + + return isFeasible ? TF->EvalAssume(*this, St, Cond, Assumption, isFeasible) + : St; } ValueState* GRExprEngine::AssumeAux(ValueState* St, NonLVal Cond, @@ -2258,7 +2262,7 @@ GetGraphNode<llvm::DenseMap<GRExprEngine::NodeTy*, Expr*>::iterator> } template <typename ITERATOR> -static void AddSources(llvm::SmallVector<GRExprEngine::NodeTy*, 10>& Sources, +static void AddSources(std::vector<GRExprEngine::NodeTy*>& Sources, ITERATOR I, ITERATOR E) { llvm::SmallPtrSet<void*,10> CachedSources; @@ -2280,7 +2284,9 @@ static void AddSources(llvm::SmallVector<GRExprEngine::NodeTy*, 10>& Sources, void GRExprEngine::ViewGraph(bool trim) { #ifndef NDEBUG if (trim) { - llvm::SmallVector<NodeTy*, 10> Src; + std::vector<NodeTy*> Src; + + // Fixme: Migrate over to the new way of adding nodes. AddSources(Src, null_derefs_begin(), null_derefs_end()); AddSources(Src, undef_derefs_begin(), undef_derefs_end()); AddSources(Src, explicit_bad_divides_begin(), explicit_bad_divides_end()); @@ -2289,6 +2295,11 @@ void GRExprEngine::ViewGraph(bool trim) { AddSources(Src, undef_arg_begin(), undef_arg_end()); AddSources(Src, undef_branches_begin(), undef_branches_end()); + // The new way. + for (BugTypeSet::iterator I=BugTypes.begin(), E=BugTypes.end(); I!=E; ++I) + (*I)->GetErrorNodes(Src); + + ViewGraph(&Src[0], &Src[0]+Src.size()); } else { |