about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--include/klee/util/Ref.h18
-rw-r--r--lib/Expr/Constraints.cpp2
-rw-r--r--lib/Expr/Expr.cpp2
-rw-r--r--lib/Expr/ExprPPrinter.cpp15
-rw-r--r--lib/Expr/ExprUtil.cpp2
-rw-r--r--unittests/Expr/ExprTest.cpp2
6 files changed, 11 insertions, 30 deletions
diff --git a/include/klee/util/Ref.h b/include/klee/util/Ref.h
index d1c2e56b..61e91f3c 100644
--- a/include/klee/util/Ref.h
+++ b/include/klee/util/Ref.h
@@ -44,8 +44,6 @@ private:
 
 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);
 
   // constructor from pointer
   ref(T *p) : ptr(p) {
@@ -65,10 +63,6 @@ public:
   }
   
   // pointer operations
-  T *get () {
-    return ptr;
-  }
-
   T *get () const {
     return ptr;
   }
@@ -119,18 +113,6 @@ inline std::ostream &operator<<(std::ostream &os, const ref<T> &e) {
   return os;
 }
 
-class Expr;
-
-template<class U>
-U* dyn_ref_cast(ref<Expr> &src) {
-  return dyn_cast<U>(src.ptr);
-}
-
-template<class U>
-const U* dyn_ref_cast(const ref<Expr> &src) {
-  return dyn_cast<U>(src.ptr);
-}
-
 } // end namespace klee
 
 namespace llvm {
diff --git a/lib/Expr/Constraints.cpp b/lib/Expr/Constraints.cpp
index 3fa58ffd..9103c7c3 100644
--- a/lib/Expr/Constraints.cpp
+++ b/lib/Expr/Constraints.cpp
@@ -94,7 +94,7 @@ ref<Expr> ConstraintManager::simplifyExpr(ref<Expr> e) const {
   
   for (ConstraintManager::constraints_ty::const_iterator 
          it = constraints.begin(), ie = constraints.end(); it != ie; ++it) {
-    if (const EqExpr *ee = dyn_ref_cast<EqExpr>(*it)) {
+    if (const EqExpr *ee = dyn_cast<EqExpr>(*it)) {
       if (ee->left->isConstant()) {
         equalities.insert(std::make_pair(ee->right,
                                          ee->left));
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index 3d3b6dd7..6cd15be7 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -490,7 +490,7 @@ ref<Expr> ExtractExpr::create(ref<Expr> expr, unsigned off, Width w) {
   } 
   else 
     // Extract(Concat)
-    if (ConcatExpr *ce = dyn_ref_cast<ConcatExpr>(expr)) {
+    if (ConcatExpr *ce = dyn_cast<ConcatExpr>(expr)) {
       // if the extract skips the right side of the concat
       if (off >= ce->getRight()->getWidth())
 	return ExtractExpr::create(ce->getLeft(), off - ce->getRight()->getWidth(), w);
diff --git a/lib/Expr/ExprPPrinter.cpp b/lib/Expr/ExprPPrinter.cpp
index 6be93c38..e26568d9 100644
--- a/lib/Expr/ExprPPrinter.cpp
+++ b/lib/Expr/ExprPPrinter.cpp
@@ -112,7 +112,7 @@ class PPrinter : public ExprPPrinter {
   bool isSimple(const ref<Expr> &e) { 
     if (isVerySimple(e)) {
       return true;
-    } else if (const ReadExpr *re = dyn_ref_cast<ReadExpr>(e)) {
+    } else if (const ReadExpr *re = dyn_cast<ReadExpr>(e)) {
       return isVerySimple(re->index) && isVerySimpleUpdate(re->updates.head);
     } else {
       Expr *ep = e.get();
@@ -148,7 +148,7 @@ class PPrinter : public ExprPPrinter {
         Expr *ep = e.get();
         for (unsigned i=0; i<ep->getNumKids(); i++)
           scan1(ep->getKid(i));
-        if (const ReadExpr *re = dyn_ref_cast<ReadExpr>(e)) 
+        if (const ReadExpr *re = dyn_cast<ReadExpr>(e)) 
           scanUpdate(re->updates.head);
       } else {
         shouldPrint.insert(e);
@@ -233,8 +233,7 @@ class PPrinter : public ExprPPrinter {
 
   
   bool isReadExprAtOffset(ref<Expr> e, const ReadExpr *base, ref<Expr> offset) {
-    
-    const ReadExpr *re = dyn_ref_cast<ReadExpr>(e.get());
+    const ReadExpr *re = dyn_cast<ReadExpr>(e.get());
       
     // right now, all Reads are byte reads but some
     // transformations might change this
@@ -262,7 +261,7 @@ class PPrinter : public ExprPPrinter {
     assert(e->getKind() == Expr::Concat);
     assert(stride == 1 || stride == -1);
     
-    const ReadExpr *base = dyn_ref_cast<ReadExpr>(e->getKid(0));
+    const ReadExpr *base = dyn_cast<ReadExpr>(e->getKid(0));
     
     // right now, all Reads are byte reads but some
     // transformations might change this
@@ -402,7 +401,7 @@ public:
 
         // Detect Not.
         // FIXME: This should be in common code.
-        if (const EqExpr *ee = dyn_ref_cast<EqExpr>(e)) {
+        if (const EqExpr *ee = dyn_cast<EqExpr>(e)) {
           if (ee->left == ConstantExpr::alloc(false, Expr::Bool)) {
             PC << "(Not";
             printWidth(PC, e);
@@ -443,9 +442,9 @@ public:
         // Indent at first argument and dispatch to appropriate print
         // routine for exprs which require special handling.
         unsigned indent = PC.pos;
-        if (const ReadExpr *re = dyn_ref_cast<ReadExpr>(e)) {
+        if (const ReadExpr *re = dyn_cast<ReadExpr>(e)) {
           printRead(re, PC, indent);
-        } else if (const ExtractExpr *ee = dyn_ref_cast<ExtractExpr>(e)) {
+        } else if (const ExtractExpr *ee = dyn_cast<ExtractExpr>(e)) {
           printExtract(ee, PC, indent);
         } else if (e->getKind() == Expr::Concat || e->getKind() == Expr::SExt)
 	  printExpr(e.get(), PC, indent, true);
diff --git a/lib/Expr/ExprUtil.cpp b/lib/Expr/ExprUtil.cpp
index 192c18a5..780398f0 100644
--- a/lib/Expr/ExprUtil.cpp
+++ b/lib/Expr/ExprUtil.cpp
@@ -35,7 +35,7 @@ void klee::findReads(ref<Expr> e,
     ref<Expr> top = stack.back();
     stack.pop_back();
 
-    if (ReadExpr *re = dyn_ref_cast<ReadExpr>(top)) {
+    if (ReadExpr *re = dyn_cast<ReadExpr>(top)) {
       // We memoized so can just add to list without worrying about
       // repeats.
       results.push_back(re);
diff --git a/unittests/Expr/ExprTest.cpp b/unittests/Expr/ExprTest.cpp
index 84179661..a5e5d5d7 100644
--- a/unittests/Expr/ExprTest.cpp
+++ b/unittests/Expr/ExprTest.cpp
@@ -58,7 +58,7 @@ TEST(ExprTest, ConcatExtract) {
 
   ref<Expr> extract4 = ExtractExpr::create(concat1, 27, 2);
   EXPECT_EQ(Expr::Extract, extract4->getKind());
-  const ExtractExpr* tmp = dyn_ref_cast<ExtractExpr>(extract4);
+  const ExtractExpr* tmp = cast<ExtractExpr>(extract4);
   EXPECT_EQ(3U, tmp->offset);
   EXPECT_EQ(2U, tmp->getWidth());