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 --- include/klee/Expr.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/klee/Expr.h b/include/klee/Expr.h index cc3a392b..bbaa55e4 100644 --- a/include/klee/Expr.h +++ b/include/klee/Expr.h @@ -222,8 +222,6 @@ public: static ref createPointer(uint64_t v); - static Expr *createConstant(uint64_t val, Width w); - struct CreateArg; static ref createFromKind(Kind k, std::vector args); @@ -288,17 +286,17 @@ class ConstantExpr : public Expr { public: static const Kind kind = Constant; static const unsigned numKids = 0; - + +private: + uint64_t value; + + ConstantExpr(uint64_t v, Width w) : value(v), width(w) {} + public: - union { - uint64_t asUInt64; - }; Width width; public: ~ConstantExpr() {}; - // should change the code to make this private - ConstantExpr(uint64_t v, Width w) : asUInt64(v), width(w) {} Width getWidth() const { return width; } Kind getKind() const { return Constant; } @@ -306,14 +304,14 @@ public: unsigned getNumKids() const { return 0; } ref getKid(unsigned i) const { return 0; } - uint64_t getConstantValue() const { return asUInt64; } + uint64_t getConstantValue() const { return value; } int compareContents(const Expr &b) const { const ConstantExpr &cb = static_cast(b); if (width != cb.width) return width < cb.width ? -1 : 1; - if (asUInt64 < cb.asUInt64) { + if (value < cb.value) { return -1; - } else if (asUInt64 > cb.asUInt64) { + } else if (value > cb.value) { return 1; } else { return 0; -- cgit 1.4.1