From 44e3d58b59099f5fd0e6f88893ce431171b3fef6 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 4 Jun 2009 08:08:21 +0000 Subject: Start removing uses of Expr::isConstant. - These should use cast<>, isa<>, or dyn_cast<> as appropriate (or better yet, changed to use ref when the type is known). git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72857 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Solver/CexCachingSolver.cpp | 5 +++-- lib/Solver/FastCexSolver.cpp | 4 ++-- lib/Solver/STPBuilder.cpp | 2 +- lib/Solver/Solver.cpp | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/Solver') 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 q = a->evaluate(query.expr); - assert(q->isConstant() && "assignment evaluation did not result in constant"); + assert(isa(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(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 e, uint64_t value) { CexConstifier cc(objectValues); ref v = cc.visit(e); - if (!v->isConstant()) return false; + if (!isa(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 &result) { CexConstifier cc(cd.objectValues); ref value = cc.visit(query.expr); - if (value->isConstant()) { + if (isa(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 e, int *width_out) { - if (!UseConstructHash || e->isConstant()) { + if (!UseConstructHash || isa(e)) { return constructActual(e, width_out); } else { ExprHashMap< std::pair >::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 &result) { // Maintain invariants implementation expect. - if (query.expr->isConstant()) { + if (isa(query.expr)) { result = query.expr; return true; } -- cgit 1.4.1