about summary refs log tree commit diff homepage
path: root/lib/Solver
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-04 08:08:21 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-04 08:08:21 +0000
commit44e3d58b59099f5fd0e6f88893ce431171b3fef6 (patch)
tree12d7d9af1493e650a42f570de49401776cabde3b /lib/Solver
parentc4a0e57c082e567e81ad3609a32ee492d41f03f9 (diff)
downloadklee-44e3d58b59099f5fd0e6f88893ce431171b3fef6.tar.gz
Start removing uses of Expr::isConstant.
 - These should use cast<>, isa<>, or dyn_cast<> as appropriate (or better yet,
   changed to use ref<ConstantExpr> when the type is known).


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72857 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Solver')
-rw-r--r--lib/Solver/CexCachingSolver.cpp5
-rw-r--r--lib/Solver/FastCexSolver.cpp4
-rw-r--r--lib/Solver/STPBuilder.cpp2
-rw-r--r--lib/Solver/Solver.cpp2
4 files changed, 7 insertions, 6 deletions
diff --git a/lib/Solver/CexCachingSolver.cpp b/lib/Solver/CexCachingSolver.cpp
index 546d81fd..49db74e8 100644
--- a/lib/Solver/CexCachingSolver.cpp
+++ b/lib/Solver/CexCachingSolver.cpp
@@ -217,7 +217,8 @@ bool CexCachingSolver::computeValidity(const Query& query,
     return false;
   assert(a && "computeValidity() must have assignment");
   ref<Expr> q = a->evaluate(query.expr);
-  assert(q->isConstant() && "assignment evaluation did not result in constant");
+  assert(isa<ConstantExpr>(q) && 
+         "assignment evaluation did not result in constant");
 
   if (q->getConstantValue()) {
     if (!getAssignment(query, a))
@@ -268,7 +269,7 @@ bool CexCachingSolver::computeValue(const Query& query,
     return false;
   assert(a && "computeValue() must have assignment");
   result = a->evaluate(query.expr);  
-  assert(result->isConstant() && 
+  assert(isa<ConstantExpr>(result) && 
          "assignment evaluation did not result in constant");
   return true;
 }
diff --git a/lib/Solver/FastCexSolver.cpp b/lib/Solver/FastCexSolver.cpp
index cc0068ca..a0d943d3 100644
--- a/lib/Solver/FastCexSolver.cpp
+++ b/lib/Solver/FastCexSolver.cpp
@@ -729,7 +729,7 @@ public:
   bool exprMustBeValue(ref<Expr> e, uint64_t value) {
     CexConstifier cc(objectValues);
     ref<Expr> v = cc.visit(e);
-    if (!v->isConstant()) return false;
+    if (!isa<ConstantExpr>(v)) return false;
     // XXX reenable once all reads and vars are fixed
     //    assert(v.isConstant() && "not all values have been fixed");
     return v->getConstantValue() == value;
@@ -886,7 +886,7 @@ bool FastCexSolver::computeValue(const Query& query, ref<Expr> &result) {
   CexConstifier cc(cd.objectValues);
   ref<Expr> value = cc.visit(query.expr);
 
-  if (value->isConstant()) {
+  if (isa<ConstantExpr>(value)) {
     result = value;
     return true;
   } else {
diff --git a/lib/Solver/STPBuilder.cpp b/lib/Solver/STPBuilder.cpp
index ee5b777b..00fd8e4a 100644
--- a/lib/Solver/STPBuilder.cpp
+++ b/lib/Solver/STPBuilder.cpp
@@ -419,7 +419,7 @@ ExprHandle STPBuilder::getInitialRead(const Array *root, unsigned index) {
 /** if *width_out!=1 then result is a bitvector,
     otherwise it is a bool */
 ExprHandle STPBuilder::construct(ref<Expr> e, int *width_out) {
-  if (!UseConstructHash || e->isConstant()) {
+  if (!UseConstructHash || isa<ConstantExpr>(e)) {
     return constructActual(e, width_out);
   } else {
     ExprHashMap< std::pair<ExprHandle, unsigned> >::iterator it = 
diff --git a/lib/Solver/Solver.cpp b/lib/Solver/Solver.cpp
index 46d6039e..6cbf6ac0 100644
--- a/lib/Solver/Solver.cpp
+++ b/lib/Solver/Solver.cpp
@@ -112,7 +112,7 @@ bool Solver::mayBeFalse(const Query& query, bool &result) {
 
 bool Solver::getValue(const Query& query, ref<Expr> &result) {
   // Maintain invariants implementation expect.
-  if (query.expr->isConstant()) {
+  if (isa<ConstantExpr>(query.expr)) {
     result = query.expr;
     return true;
   }