diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-06-04 05:18:31 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-06-04 05:18:31 +0000 |
commit | c35afac49b59fab490b8a369420c76cfff3d72fa (patch) | |
tree | f6007dd12e54df74048dea00a0f2b8f130e170f8 /include | |
parent | 5ead9bf5153952ae45ea5c1e8933fa03a6dc85c6 (diff) | |
download | klee-c35afac49b59fab490b8a369420c76cfff3d72fa.tar.gz |
Use cast<> instead of static_ref_cast.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72845 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/klee/util/ExprRangeEvaluator.h | 40 | ||||
-rw-r--r-- | include/klee/util/Ref.h | 12 |
2 files changed, 20 insertions, 32 deletions
diff --git a/include/klee/util/ExprRangeEvaluator.h b/include/klee/util/ExprRangeEvaluator.h index b40b9e02..c5637341 100644 --- a/include/klee/util/ExprRangeEvaluator.h +++ b/include/klee/util/ExprRangeEvaluator.h @@ -97,7 +97,7 @@ T ExprRangeEvaluator<T>::evaluate(const ref<Expr> &e) { break; case Expr::Read: { - const ReadExpr *re = static_ref_cast<const ReadExpr>(e); + const ReadExpr *re = cast<ReadExpr>(e); T index = evaluate(re->index); assert(re->getWidth()==Expr::Int8 && "unexpected multibyte read"); @@ -106,7 +106,7 @@ T ExprRangeEvaluator<T>::evaluate(const ref<Expr> &e) { } case Expr::Select: { - const SelectExpr *se = static_ref_cast<const SelectExpr>(e); + const SelectExpr *se = cast<SelectExpr>(e); T cond = evaluate(se->cond); if (cond.mustEqual(1)) { @@ -130,37 +130,37 @@ T ExprRangeEvaluator<T>::evaluate(const ref<Expr> &e) { // Arithmetic case Expr::Add: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); unsigned width = be->left->getWidth(); return evaluate(be->left).add(evaluate(be->right), width); } case Expr::Sub: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); unsigned width = be->left->getWidth(); return evaluate(be->left).sub(evaluate(be->right), width); } case Expr::Mul: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); unsigned width = be->left->getWidth(); return evaluate(be->left).mul(evaluate(be->right), width); } case Expr::UDiv: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); unsigned width = be->left->getWidth(); return evaluate(be->left).udiv(evaluate(be->right), width); } case Expr::SDiv: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); unsigned width = be->left->getWidth(); return evaluate(be->left).sdiv(evaluate(be->right), width); } case Expr::URem: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); unsigned width = be->left->getWidth(); return evaluate(be->left).urem(evaluate(be->right), width); } case Expr::SRem: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); unsigned width = be->left->getWidth(); return evaluate(be->left).srem(evaluate(be->right), width); } @@ -168,31 +168,31 @@ T ExprRangeEvaluator<T>::evaluate(const ref<Expr> &e) { // Binary case Expr::And: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); return evaluate(be->left).binaryAnd(evaluate(be->right)); } case Expr::Or: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); return evaluate(be->left).binaryOr(evaluate(be->right)); } case Expr::Xor: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); return evaluate(be->left).binaryXor(evaluate(be->right)); } case Expr::Shl: { - // BinaryExpr *be = static_ref_cast<BinaryExpr>(e); + // BinaryExpr *be = cast<BinaryExpr>(e); // unsigned width = be->left->getWidth(); // return evaluate(be->left).shl(evaluate(be->right), width); break; } case Expr::LShr: { - // BinaryExpr *be = static_ref_cast<BinaryExpr>(e); + // BinaryExpr *be = cast<BinaryExpr>(e); // unsigned width = be->left->getWidth(); // return evaluate(be->left).lshr(evaluate(be->right), width); break; } case Expr::AShr: { - // BinaryExpr *be = static_ref_cast<BinaryExpr>(e); + // BinaryExpr *be = cast<BinaryExpr>(e); // unsigned width = be->left->getWidth(); // return evaluate(be->left).ashr(evaluate(be->right), width); break; @@ -201,7 +201,7 @@ T ExprRangeEvaluator<T>::evaluate(const ref<Expr> &e) { // Comparison case Expr::Eq: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); T left = evaluate(be->left); T right = evaluate(be->right); @@ -214,7 +214,7 @@ T ExprRangeEvaluator<T>::evaluate(const ref<Expr> &e) { } case Expr::Ult: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); T left = evaluate(be->left); T right = evaluate(be->right); @@ -226,7 +226,7 @@ T ExprRangeEvaluator<T>::evaluate(const ref<Expr> &e) { break; } case Expr::Ule: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); T left = evaluate(be->left); T right = evaluate(be->right); @@ -238,7 +238,7 @@ T ExprRangeEvaluator<T>::evaluate(const ref<Expr> &e) { break; } case Expr::Slt: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); T left = evaluate(be->left); T right = evaluate(be->right); unsigned bits = be->left->getWidth(); @@ -251,7 +251,7 @@ T ExprRangeEvaluator<T>::evaluate(const ref<Expr> &e) { break; } case Expr::Sle: { - const BinaryExpr *be = static_ref_cast<const BinaryExpr>(e); + const BinaryExpr *be = cast<BinaryExpr>(e); T left = evaluate(be->left); T right = evaluate(be->right); unsigned bits = be->left->getWidth(); diff --git a/include/klee/util/Ref.h b/include/klee/util/Ref.h index b56d5d6a..d1c2e56b 100644 --- a/include/klee/util/Ref.h +++ b/include/klee/util/Ref.h @@ -46,8 +46,6 @@ public: template<class U> friend class ref; template<class U> friend U* dyn_ref_cast(ref &src); template<class U> friend const U* dyn_ref_cast(const ref &src); - template<class U> friend U* static_ref_cast(ref &src); - template<class U> friend const U* static_ref_cast(const ref &src); // constructor from pointer ref(T *p) : ptr(p) { @@ -133,16 +131,6 @@ const U* dyn_ref_cast(const ref<Expr> &src) { return dyn_cast<U>(src.ptr); } -template<class U> -U* static_ref_cast(ref<Expr> &src) { - return static_cast<U*>(src.ptr); -} - -template<class U> -const U* static_ref_cast(const ref<Expr> &src) { - return static_cast<const U*>(src.ptr); -} - } // end namespace klee namespace llvm { |