about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2013-08-28 01:45:59 -0700
committerCristian Cadar <c.cadar@imperial.ac.uk>2013-08-28 01:45:59 -0700
commit1b69ae748e3a2ec5adf66396676447b172fffaf7 (patch)
tree4687c0112f804db982c3796db039dc3da056fcba
parentc4147c2ad9ba1e74642e1a3de31be8f4446cc7f3 (diff)
parent3f1b4ec3498585ee5eee48c1e031c8f073009ad7 (diff)
downloadklee-1b69ae748e3a2ec5adf66396676447b172fffaf7.tar.gz
Merge pull request #13 from MartinNowack/FeatureConstantArrays
Patch Set IV - Handle constant arrays as well
-rw-r--r--lib/Core/Executor.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 184b0983..88ede5c8 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -929,8 +929,17 @@ ref<klee::ConstantExpr> Executor::evalConstant(const Constant *c) {
       }
       ref<Expr> res = ConcatExpr::createN(kids.size(), kids.data());
       return cast<ConstantExpr>(res);
+    } else if (const ConstantArray *ca = dyn_cast<ConstantArray>(c)){
+      llvm::SmallVector<ref<Expr>, 4> kids;
+      for (unsigned i = ca->getNumOperands(); i != 0; --i) {
+        unsigned op = i-1;
+        ref<Expr> kid = evalConstant(ca->getOperand(op));
+        kids.push_back(kid);
+      }
+      ref<Expr> res = ConcatExpr::createN(kids.size(), kids.data());
+      return cast<ConstantExpr>(res);
     } else {
-      // Constant{Array,Vector}
+      // Constant{Vector}
       assert(0 && "invalid argument to evalConstant()");
     }
   }