diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-06-04 00:49:34 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-06-04 00:49:34 +0000 |
commit | b9c0914f3d27e04e3335760b7fd13c5e9953103d (patch) | |
tree | cf3971704bc3c7bede7592b046f8f28b4751a423 /lib/Expr | |
parent | 32461e170b16d2f6cbcd04830bf68ce2a6372db5 (diff) | |
download | klee-b9c0914f3d27e04e3335760b7fd13c5e9953103d.tar.gz |
Move isConstant from ref<> to Expr::
- Ref.h is now freestanding. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72824 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Expr')
-rw-r--r-- | lib/Expr/Constraints.cpp | 6 | ||||
-rw-r--r-- | lib/Expr/Expr.cpp | 86 | ||||
-rw-r--r-- | lib/Expr/ExprEvaluator.cpp | 6 | ||||
-rw-r--r-- | lib/Expr/ExprPPrinter.cpp | 10 | ||||
-rw-r--r-- | lib/Expr/ExprUtil.cpp | 12 | ||||
-rw-r--r-- | lib/Expr/ExprVisitor.cpp | 6 | ||||
-rw-r--r-- | lib/Expr/Parser.cpp | 2 |
7 files changed, 64 insertions, 64 deletions
diff --git a/lib/Expr/Constraints.cpp b/lib/Expr/Constraints.cpp index 472c0aa3..93384060 100644 --- a/lib/Expr/Constraints.cpp +++ b/lib/Expr/Constraints.cpp @@ -87,7 +87,7 @@ void ConstraintManager::simplifyForValidConstraint(ref<Expr> e) { } ref<Expr> ConstraintManager::simplifyExpr(ref<Expr> e) const { - if (e.isConstant()) + if (e->isConstant()) return e; std::map< ref<Expr>, ref<Expr> > equalities; @@ -95,7 +95,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 (ee->left.isConstant()) { + if (ee->left->isConstant()) { equalities.insert(std::make_pair(ee->right, ee->left)); } else { @@ -135,7 +135,7 @@ void ConstraintManager::addConstraintInternal(ref<Expr> e) { case Expr::Eq: { BinaryExpr *be = static_ref_cast<BinaryExpr>(e); - if (be->left.isConstant()) { + if (be->left->isConstant()) { ExprReplaceVisitor visitor(be->right, be->left); rewriteConstraints(visitor); } diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index 4c6f5e43..9a78f188 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -378,7 +378,7 @@ ref<Expr> ReadExpr::create(const UpdateList &ul, ref<Expr> index) { for (; un; un=un->next) { ref<Expr> cond = EqExpr::create(index, un->index); - if (cond.isConstant()) { + if (cond->isConstant()) { if (cond->getConstantValue()) return un->value; } else { @@ -399,18 +399,18 @@ ref<Expr> SelectExpr::create(ref<Expr> c, ref<Expr> t, ref<Expr> f) { assert(c->getWidth()==Bool && "type mismatch"); assert(kt==f->getWidth() && "type mismatch"); - if (c.isConstant()) { + if (c->isConstant()) { return c->getConstantValue() ? t : f; } else if (t==f) { return t; } else if (kt==Expr::Bool) { // c ? t : f <=> (c and t) or (not c and f) - if (t.isConstant()) { + if (t->isConstant()) { if (t->getConstantValue()) { return OrExpr::create(c, f); } else { return AndExpr::create(Expr::createNot(c), f); } - } else if (f.isConstant()) { + } else if (f->isConstant()) { if (f->getConstantValue()) { return OrExpr::create(Expr::createNot(c), t); } else { @@ -485,7 +485,7 @@ ref<Expr> ExtractExpr::create(ref<Expr> expr, unsigned off, Width w) { if (w == kw) return expr; - else if (expr.isConstant()) { + else if (expr->isConstant()) { return ConstantExpr::create(ints::trunc(expr->getConstantValue() >> off, w, kw), w); } else @@ -521,7 +521,7 @@ ref<Expr> ZExtExpr::create(const ref<Expr> &e, Width w) { } else if (w < kBits) { // trunc return ExtractExpr::createByteOff(e, 0, w); } else { - if (e.isConstant()) { + if (e->isConstant()) { return ConstantExpr::create(ints::zext(e->getConstantValue(), w, kBits), w); } @@ -537,7 +537,7 @@ ref<Expr> SExtExpr::create(const ref<Expr> &e, Width w) { } else if (w < kBits) { // trunc return ExtractExpr::createByteOff(e, 0, w); } else { - if (e.isConstant()) { + if (e->isConstant()) { return ConstantExpr::create(ints::sext(e->getConstantValue(), w, kBits), w); } @@ -557,7 +557,7 @@ static ref<Expr> SubExpr_createPartialR(const ref<Expr> &cl, Expr *r); static ref<Expr> XorExpr_createPartialR(const ref<Expr> &cl, Expr *r); static ref<Expr> AddExpr_createPartialR(const ref<Expr> &cl, Expr *r) { - assert(cl.isConstant() && "non-constant passed in place of constant"); + assert(cl->isConstant() && "non-constant passed in place of constant"); uint64_t value = cl->getConstantValue(); Expr::Width type = cl->getWidth(); @@ -567,10 +567,10 @@ static ref<Expr> AddExpr_createPartialR(const ref<Expr> &cl, Expr *r) { return r; } else { Expr::Kind rk = r->getKind(); - if (rk==Expr::Add && r->getKid(0).isConstant()) { // A + (B+c) == (A+B) + c + if (rk==Expr::Add && r->getKid(0)->isConstant()) { // A + (B+c) == (A+B) + c return AddExpr::create(AddExpr::create(cl, r->getKid(0)), r->getKid(1)); - } else if (rk==Expr::Sub && r->getKid(0).isConstant()) { // A + (B-c) == (A+B) - c + } else if (rk==Expr::Sub && r->getKid(0)->isConstant()) { // A + (B-c) == (A+B) - c return SubExpr::create(AddExpr::create(cl, r->getKid(0)), r->getKid(1)); } else { @@ -588,16 +588,16 @@ static ref<Expr> AddExpr_create(Expr *l, Expr *r) { return XorExpr_create(l, r); } else { Expr::Kind lk = l->getKind(), rk = r->getKind(); - if (lk==Expr::Add && l->getKid(0).isConstant()) { // (k+a)+b = k+(a+b) + if (lk==Expr::Add && l->getKid(0)->isConstant()) { // (k+a)+b = k+(a+b) return AddExpr::create(l->getKid(0), AddExpr::create(l->getKid(1), r)); - } else if (lk==Expr::Sub && l->getKid(0).isConstant()) { // (k-a)+b = k+(b-a) + } else if (lk==Expr::Sub && l->getKid(0)->isConstant()) { // (k-a)+b = k+(b-a) return AddExpr::create(l->getKid(0), SubExpr::create(r, l->getKid(1))); - } else if (rk==Expr::Add && r->getKid(0).isConstant()) { // a + (k+b) = k+(a+b) + } else if (rk==Expr::Add && r->getKid(0)->isConstant()) { // a + (k+b) = k+(a+b) return AddExpr::create(r->getKid(0), AddExpr::create(l, r->getKid(1))); - } else if (rk==Expr::Sub && r->getKid(0).isConstant()) { // a + (k-b) = k+(a-b) + } else if (rk==Expr::Sub && r->getKid(0)->isConstant()) { // a + (k-b) = k+(a-b) return AddExpr::create(r->getKid(0), SubExpr::create(l, r->getKid(1))); } else { @@ -607,17 +607,17 @@ static ref<Expr> AddExpr_create(Expr *l, Expr *r) { } static ref<Expr> SubExpr_createPartialR(const ref<Expr> &cl, Expr *r) { - assert(cl.isConstant() && "non-constant passed in place of constant"); + assert(cl->isConstant() && "non-constant passed in place of constant"); Expr::Width type = cl->getWidth(); if (type==Expr::Bool) { return XorExpr_createPartialR(cl, r); } else { Expr::Kind rk = r->getKind(); - if (rk==Expr::Add && r->getKid(0).isConstant()) { // A - (B+c) == (A-B) - c + if (rk==Expr::Add && r->getKid(0)->isConstant()) { // A - (B+c) == (A-B) - c return SubExpr::create(SubExpr::create(cl, r->getKid(0)), r->getKid(1)); - } else if (rk==Expr::Sub && r->getKid(0).isConstant()) { // A - (B-c) == (A-B) + c + } else if (rk==Expr::Sub && r->getKid(0)->isConstant()) { // A - (B-c) == (A-B) + c return AddExpr::create(SubExpr::create(cl, r->getKid(0)), r->getKid(1)); } else { @@ -626,7 +626,7 @@ static ref<Expr> SubExpr_createPartialR(const ref<Expr> &cl, Expr *r) { } } static ref<Expr> SubExpr_createPartial(Expr *l, const ref<Expr> &cr) { - assert(cr.isConstant() && "non-constant passed in place of constant"); + assert(cr->isConstant() && "non-constant passed in place of constant"); uint64_t value = cr->getConstantValue(); Expr::Width width = cr->getWidth(); uint64_t nvalue = ints::sub(0, value, width); @@ -642,16 +642,16 @@ static ref<Expr> SubExpr_create(Expr *l, Expr *r) { return ConstantExpr::alloc(0, type); } else { Expr::Kind lk = l->getKind(), rk = r->getKind(); - if (lk==Expr::Add && l->getKid(0).isConstant()) { // (k+a)-b = k+(a-b) + if (lk==Expr::Add && l->getKid(0)->isConstant()) { // (k+a)-b = k+(a-b) return AddExpr::create(l->getKid(0), SubExpr::create(l->getKid(1), r)); - } else if (lk==Expr::Sub && l->getKid(0).isConstant()) { // (k-a)-b = k-(a+b) + } else if (lk==Expr::Sub && l->getKid(0)->isConstant()) { // (k-a)-b = k-(a+b) return SubExpr::create(l->getKid(0), AddExpr::create(l->getKid(1), r)); - } else if (rk==Expr::Add && r->getKid(0).isConstant()) { // a - (k+b) = (a-c) - k + } else if (rk==Expr::Add && r->getKid(0)->isConstant()) { // a - (k+b) = (a-c) - k return SubExpr::create(SubExpr::create(l, r->getKid(1)), r->getKid(0)); - } else if (rk==Expr::Sub && r->getKid(0).isConstant()) { // a - (k-b) = (a+b) - k + } else if (rk==Expr::Sub && r->getKid(0)->isConstant()) { // a - (k-b) = (a+b) - k return SubExpr::create(AddExpr::create(l, r->getKid(1)), r->getKid(0)); } else { @@ -661,7 +661,7 @@ static ref<Expr> SubExpr_create(Expr *l, Expr *r) { } static ref<Expr> MulExpr_createPartialR(const ref<Expr> &cl, Expr *r) { - assert(cl.isConstant() && "non-constant passed in place of constant"); + assert(cl->isConstant() && "non-constant passed in place of constant"); uint64_t value = cl->getConstantValue(); Expr::Width type = cl->getWidth(); @@ -689,7 +689,7 @@ static ref<Expr> MulExpr_create(Expr *l, Expr *r) { } static ref<Expr> AndExpr_createPartial(Expr *l, const ref<Expr> &cr) { - assert(cr.isConstant() && "non-constant passed in place of constant"); + assert(cr->isConstant() && "non-constant passed in place of constant"); uint64_t value = cr->getConstantValue(); Expr::Width width = cr->getWidth(); @@ -709,7 +709,7 @@ static ref<Expr> AndExpr_create(Expr *l, Expr *r) { } static ref<Expr> OrExpr_createPartial(Expr *l, const ref<Expr> &cr) { - assert(cr.isConstant() && "non-constant passed in place of constant"); + assert(cr->isConstant() && "non-constant passed in place of constant"); uint64_t value = cr->getConstantValue(); Expr::Width width = cr->getWidth(); @@ -729,7 +729,7 @@ static ref<Expr> OrExpr_create(Expr *l, Expr *r) { } static ref<Expr> XorExpr_createPartialR(const ref<Expr> &cl, Expr *r) { - assert(cl.isConstant() && "non-constant passed in place of constant"); + assert(cl->isConstant() && "non-constant passed in place of constant"); uint64_t value = cl->getConstantValue(); Expr::Width type = cl->getWidth(); @@ -812,8 +812,8 @@ static ref<Expr> AShrExpr_create(const ref<Expr> &l, const ref<Expr> &r) { #define BCREATE_R(_e_op, _op, partialL, partialR) \ ref<Expr> _e_op ::create(const ref<Expr> &l, const ref<Expr> &r) { \ assert(l->getWidth()==r->getWidth() && "type mismatch"); \ - if (l.isConstant()) { \ - if (r.isConstant()) { \ + if (l->isConstant()) { \ + if (r->isConstant()) { \ Expr::Width width = l->getWidth(); \ uint64_t val = ints::_op(l->getConstantValue(), \ r->getConstantValue(), width); \ @@ -821,7 +821,7 @@ ref<Expr> _e_op ::create(const ref<Expr> &l, const ref<Expr> &r) { \ } else { \ return _e_op ## _createPartialR(l, r.get()); \ } \ - } else if (r.isConstant()) { \ + } else if (r->isConstant()) { \ return _e_op ## _createPartial(l.get(), r); \ } \ return _e_op ## _create(l.get(), r.get()); \ @@ -830,8 +830,8 @@ ref<Expr> _e_op ::create(const ref<Expr> &l, const ref<Expr> &r) { \ #define BCREATE(_e_op, _op) \ ref<Expr> _e_op ::create(const ref<Expr> &l, const ref<Expr> &r) { \ assert(l->getWidth()==r->getWidth() && "type mismatch"); \ - if (l.isConstant()) { \ - if (r.isConstant()) { \ + if (l->isConstant()) { \ + if (r->isConstant()) { \ Expr::Width width = l->getWidth(); \ uint64_t val = ints::_op(l->getConstantValue(), \ r->getConstantValue(), width); \ @@ -858,8 +858,8 @@ BCREATE(AShrExpr, ashr) #define CMPCREATE(_e_op, _op) \ ref<Expr> _e_op ::create(const ref<Expr> &l, const ref<Expr> &r) { \ assert(l->getWidth()==r->getWidth() && "type mismatch"); \ - if (l.isConstant()) { \ - if (r.isConstant()) { \ + if (l->isConstant()) { \ + if (r->isConstant()) { \ Expr::Width width = l->getWidth(); \ uint64_t val = ints::_op(l->getConstantValue(), \ r->getConstantValue(), width); \ @@ -872,8 +872,8 @@ ref<Expr> _e_op ::create(const ref<Expr> &l, const ref<Expr> &r) { \ #define CMPCREATE_T(_e_op, _op, _reflexive_e_op, partialL, partialR) \ ref<Expr> _e_op ::create(const ref<Expr> &l, const ref<Expr> &r) { \ assert(l->getWidth()==r->getWidth() && "type mismatch"); \ - if (l.isConstant()) { \ - if (r.isConstant()) { \ + if (l->isConstant()) { \ + if (r->isConstant()) { \ Expr::Width width = l->getWidth(); \ uint64_t val = ints::_op(l->getConstantValue(), \ r->getConstantValue(), width); \ @@ -881,7 +881,7 @@ ref<Expr> _e_op ::create(const ref<Expr> &l, const ref<Expr> &r) { \ } else { \ return partialR(l, r.get()); \ } \ - } else if (r.isConstant()) { \ + } else if (r->isConstant()) { \ return partialL(l.get(), r); \ } else { \ return _e_op ## _create(l.get(), r.get()); \ @@ -904,7 +904,7 @@ static ref<Expr> EqExpr_create(const ref<Expr> &l, const ref<Expr> &r) { /// returns the initial equality expression. static ref<Expr> TryConstArrayOpt(const ref<Expr> &cl, ReadExpr *rd) { - assert(cl.isConstant() && "constant expression required"); + assert(cl->isConstant() && "constant expression required"); assert(rd->getKind() == Expr::Read && "read expression required"); uint64_t ct = cl->getConstantValue(); @@ -926,7 +926,7 @@ static ref<Expr> TryConstArrayOpt(const ref<Expr> &cl, ref<Expr> idx = un->index; ref<Expr> val = un->value; - if (!idx.isConstant() || !val.isConstant()) { + if (!idx->isConstant() || !val->isConstant()) { all_const = false; //llvm::cerr << "Idx or val not constant\n"; break; @@ -973,7 +973,7 @@ static ref<Expr> TryConstArrayOpt(const ref<Expr> &cl, static ref<Expr> EqExpr_createPartialR(const ref<Expr> &cl, Expr *r) { - assert(cl.isConstant() && "non-constant passed in place of constant"); + assert(cl->isConstant() && "non-constant passed in place of constant"); uint64_t value = cl->getConstantValue(); Expr::Width width = cl->getWidth(); @@ -988,7 +988,7 @@ static ref<Expr> EqExpr_createPartialR(const ref<Expr> &cl, Expr *r) { const EqExpr *ree = static_ref_cast<EqExpr>(r); // eliminate double negation - if (ree->left.isConstant() && + if (ree->left->isConstant() && ree->left->getWidth()==Expr::Bool) { assert(!ree->left->getConstantValue()); return ree->right; @@ -1029,14 +1029,14 @@ static ref<Expr> EqExpr_createPartialR(const ref<Expr> &cl, Expr *r) { } } else if (rk==Expr::Add) { const AddExpr *ae = static_ref_cast<AddExpr>(r); - if (ae->left.isConstant()) { + if (ae->left->isConstant()) { // c0 = c1 + b => c0 - c1 = b return EqExpr_createPartialR(SubExpr::create(cl, ae->left), ae->right.get()); } } else if (rk==Expr::Sub) { const SubExpr *se = static_ref_cast<SubExpr>(r); - if (se->left.isConstant()) { + if (se->left->isConstant()) { // c0 = c1 - b => c1 - c0 = b return EqExpr_createPartialR(SubExpr::create(se->left, cl), se->right.get()); @@ -1076,7 +1076,7 @@ static ref<Expr> UltExpr_create(const ref<Expr> &l, const ref<Expr> &r) { if (t == Expr::Bool) { // !l && r return AndExpr::create(Expr::createNot(l), r); } else { - if (r.isConstant()) { + if (r->isConstant()) { uint64_t value = r->getConstantValue(); if (value <= 8) { ref<Expr> res = ConstantExpr::alloc(0, Expr::Bool); diff --git a/lib/Expr/ExprEvaluator.cpp b/lib/Expr/ExprEvaluator.cpp index 0c04a538..038fe8b8 100644 --- a/lib/Expr/ExprEvaluator.cpp +++ b/lib/Expr/ExprEvaluator.cpp @@ -16,7 +16,7 @@ ExprVisitor::Action ExprEvaluator::evalRead(const UpdateList &ul, for (const UpdateNode *un=ul.head; un; un=un->next) { ref<Expr> ui = visit(un->index); - if (ui.isConstant()) { + if (ui->isConstant()) { if (ui->getConstantValue() == index) return Action::changeTo(visit(un->value)); } else { @@ -36,7 +36,7 @@ ExprVisitor::Action ExprEvaluator::evalRead(const UpdateList &ul, ExprVisitor::Action ExprEvaluator::visitRead(const ReadExpr &re) { ref<Expr> v = visit(re.index); - if (v.isConstant()) { + if (v->isConstant()) { return evalRead(re.updates, v->getConstantValue()); } else { return Action::doChildren(); @@ -50,7 +50,7 @@ ExprVisitor::Action ExprEvaluator::protectedDivOperation(const BinaryExpr &e) { ref<Expr> kids[2] = { visit(e.left), visit(e.right) }; - if (kids[1].isConstant() && !kids[1]->getConstantValue()) + if (kids[1]->isConstant() && !kids[1]->getConstantValue()) kids[1] = e.right; if (kids[0]!=e.left || kids[1]!=e.right) { diff --git a/lib/Expr/ExprPPrinter.cpp b/lib/Expr/ExprPPrinter.cpp index 08809684..da4f45f9 100644 --- a/lib/Expr/ExprPPrinter.cpp +++ b/lib/Expr/ExprPPrinter.cpp @@ -100,7 +100,7 @@ class PPrinter : public ExprPPrinter { } bool isVerySimple(const ref<Expr> &e) { - return e.isConstant() || bindings.find(e)!=bindings.end(); + return e->isConstant() || bindings.find(e)!=bindings.end(); } bool isVerySimpleUpdate(const UpdateNode *un) { @@ -143,7 +143,7 @@ class PPrinter : public ExprPPrinter { } void scan1(const ref<Expr> &e) { - if (!e.isConstant()) { + if (!e->isConstant()) { if (couldPrint.insert(e).second) { Expr *ep = e.get(); for (unsigned i=0; i<ep->getNumKids(); i++) @@ -208,7 +208,7 @@ class PPrinter : public ExprPPrinter { print(un->value, PC); //PC << ')'; - nextShouldBreak = !(un->index.isConstant() && un->value.isConstant()); + nextShouldBreak = !(un->index->isConstant() && un->value->isConstant()); } if (openedList) @@ -324,7 +324,7 @@ public: } void printConst(const ref<Expr> &e, PrintContext &PC, bool printWidth) { - assert(e.isConstant()); + assert(e->isConstant()); if (e->getWidth() == Expr::Bool) PC << (e->getConstantValue() ? "true" : "false"); @@ -343,7 +343,7 @@ public: } void print(const ref<Expr> &e, PrintContext &PC, bool printConstWidth=false) { - if (e.isConstant()) + if (e->isConstant()) printConst(e, PC, printConstWidth); else { std::map<ref<Expr>, unsigned>::iterator it = bindings.find(e); diff --git a/lib/Expr/ExprUtil.cpp b/lib/Expr/ExprUtil.cpp index f74b519f..192c18a5 100644 --- a/lib/Expr/ExprUtil.cpp +++ b/lib/Expr/ExprUtil.cpp @@ -26,7 +26,7 @@ void klee::findReads(ref<Expr> e, ExprHashSet visited; std::set<const UpdateNode *> updates; - if (!e.isConstant()) { + if (!e->isConstant()) { visited.insert(e); stack.push_back(e); } @@ -40,7 +40,7 @@ void klee::findReads(ref<Expr> e, // repeats. results.push_back(re); - if (!re->index.isConstant() && + if (!re->index->isConstant() && visited.insert(re->index).second) stack.push_back(re->index); @@ -53,20 +53,20 @@ void klee::findReads(ref<Expr> e, // head, which often will be shared among multiple nodes. if (updates.insert(re->updates.head).second) { for (const UpdateNode *un=re->updates.head; un; un=un->next) { - if (!un->index.isConstant() && + if (!un->index->isConstant() && visited.insert(un->index).second) stack.push_back(un->index); - if (!un->value.isConstant() && + if (!un->value->isConstant() && visited.insert(un->value).second) stack.push_back(un->value); } } } - } else if (!top.isConstant()) { + } else if (!top->isConstant()) { Expr *e = top.get(); for (unsigned i=0; i<e->getNumKids(); i++) { ref<Expr> k = e->getKid(i); - if (!k.isConstant() && + if (!k->isConstant() && visited.insert(k).second) stack.push_back(k); } diff --git a/lib/Expr/ExprVisitor.cpp b/lib/Expr/ExprVisitor.cpp index b15cdffa..5e9d0a81 100644 --- a/lib/Expr/ExprVisitor.cpp +++ b/lib/Expr/ExprVisitor.cpp @@ -22,7 +22,7 @@ namespace { using namespace klee; ref<Expr> ExprVisitor::visit(const ref<Expr> &e) { - if (!UseVisitorHash || e.isConstant()) { + if (!UseVisitorHash || e->isConstant()) { return visitActual(e); } else { visited_ty::iterator it = visited.find(e); @@ -38,7 +38,7 @@ ref<Expr> ExprVisitor::visit(const ref<Expr> &e) { } ref<Expr> ExprVisitor::visitActual(const ref<Expr> &e) { - if (e.isConstant()) { + if (e->isConstant()) { return e; } else { Expr &ep = *e.get(); @@ -106,7 +106,7 @@ ref<Expr> ExprVisitor::visitActual(const ref<Expr> &e) { if (recursive) e = visit(e); } - if (!e.isConstant()) { + if (!e->isConstant()) { res = visitExprPost(*e.get()); if (res.kind==Action::ChangeTo) e = res.argument; diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp index 70c1cc76..5f666269 100644 --- a/lib/Expr/Parser.cpp +++ b/lib/Expr/Parser.cpp @@ -929,7 +929,7 @@ ExprResult ParserImpl::ParseExtractParenExpr(const Token &Name, if (!OffsetExpr.isValid() || !Child.isValid()) return ConstantExpr::alloc(0, ResTy); - assert(OffsetExpr.get().isConstant() && "ParseNumber returned non-constant."); + assert(OffsetExpr.get()->isConstant() && "ParseNumber returned non-constant."); unsigned Offset = (unsigned) OffsetExpr.get()->getConstantValue(); if (Offset + ResTy > Child.get()->getWidth()) { |