summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/GRExprEngine.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-18 19:23:43 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-18 19:23:43 +0000
commit4d83728a5759faa063fa9ab762378b34b146a7cd (patch)
treedb677f3c2cb3ba1efd213758d4769ad3dca080d3 /clang/lib/Analysis/GRExprEngine.cpp
parent495a516390950ce10e7027634aed6d29618904e5 (diff)
downloadbcm5719-llvm-4d83728a5759faa063fa9ab762378b34b146a7cd.tar.gz
bcm5719-llvm-4d83728a5759faa063fa9ab762378b34b146a7cd.zip
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. llvm-svn: 49912
Diffstat (limited to 'clang/lib/Analysis/GRExprEngine.cpp')
-rw-r--r--clang/lib/Analysis/GRExprEngine.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp
index e3fe2395535..63986fb38a5 100644
--- a/clang/lib/Analysis/GRExprEngine.cpp
+++ b/clang/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 {
OpenPOWER on IntegriCloud