From 4203dcc7637fce437af56e51ed7d9fef8f1ceeca Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 4 Jun 2009 09:06:35 +0000 Subject: Make ConstantExpr's value and constructor private. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72863 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Expr/Expr.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index c645f37c..bc871808 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -165,7 +165,7 @@ unsigned Expr::computeHash() { } unsigned ConstantExpr::computeHash() { - hashValue = asUInt64 ^ (width * MAGIC_HASH_CONSTANT); + hashValue = value ^ (width * MAGIC_HASH_CONSTANT); return hashValue; } @@ -319,12 +319,6 @@ ref Expr::createPointer(uint64_t v) { return ConstantExpr::create(v, kMachinePointerType); } -Expr* Expr::createConstant(uint64_t val, Width w) { - Expr *r = new ConstantExpr(val, w); - r->computeHash(); - return r; -} - void Expr::print(std::ostream &os) const { const ref tmp((Expr*)this); ExprPPrinter::printOne(os, "", tmp); @@ -345,11 +339,11 @@ ref ConstantExpr::fromMemory(void *address, Width width) { void ConstantExpr::toMemory(void *address) { switch (width) { - case Expr::Bool: *(( uint8_t*) address) = asUInt64; break; - case Expr::Int8: *(( uint8_t*) address) = asUInt64; break; - case Expr::Int16: *((uint16_t*) address) = asUInt64; break; - case Expr::Int32: *((uint32_t*) address) = asUInt64; break; - case Expr::Int64: *((uint64_t*) address) = asUInt64; break; + case Expr::Bool: *(( uint8_t*) address) = value; break; + case Expr::Int8: *(( uint8_t*) address) = value; break; + case Expr::Int16: *((uint16_t*) address) = value; break; + case Expr::Int32: *((uint32_t*) address) = value; break; + case Expr::Int64: *((uint64_t*) address) = value; break; default: assert(0 && "invalid type"); } } -- cgit 1.4.1