about summary refs log tree commit diff homepage
path: root/lib/Core/Context.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-07-29 17:49:56 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2011-07-29 17:49:56 +0000
commit179a8930253e7e81dda77fda1db11a6d11b22f14 (patch)
treee8f1ceb0ef844deb88adc2c8fea1890993a73c2b /lib/Core/Context.cpp
parentf1b9d5d45886d7c989f14a57fcc0851b8b219917 (diff)
downloadklee-179a8930253e7e81dda77fda1db11a6d11b22f14.tar.gz
Sign extend, rather than zero extend, narrow gep indices
For example, clang creates these for ++ and -- operations on pointers
on 64-bit platforms.

git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@136474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Core/Context.cpp')
-rw-r--r--lib/Core/Context.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Core/Context.cpp b/lib/Core/Context.cpp
index 45dbdca0..979970aa 100644
--- a/lib/Core/Context.cpp
+++ b/lib/Core/Context.cpp
@@ -35,7 +35,11 @@ const Context &Context::get() {
 // FIXME: This is a total hack, just to avoid a layering issue until this stuff
 // moves out of Expr.
 
-ref<Expr> Expr::createCoerceToPointerType(ref<Expr> e) {
+ref<Expr> Expr::createSExtToPointerWidth(ref<Expr> e) {
+  return SExtExpr::create(e, Context::get().getPointerWidth());
+}
+
+ref<Expr> Expr::createZExtToPointerWidth(ref<Expr> e) {
   return ZExtExpr::create(e, Context::get().getPointerWidth());
 }