prop::NullRegistrar* d_nullRegistrar;
context::Context* d_nullContext;
// sat solver used for bitblasting and associated CnfStream
- prop::BVSatSolverInterface* d_satSolver;
- prop::CnfStream* d_cnfStream;
+ prop::BVSatSolverInterface* d_satSolver;
+ prop::BVSatSolverInterface::Notify* d_satSolverNotify;
+ prop::CnfStream* d_cnfStream;
AssertionList* d_assertedAtoms; /**< context dependent list storing the atoms
currently asserted by the DPLL SAT solver. */
using namespace CVC4::prop;
BVQuickCheck::BVQuickCheck(const std::string& name, theory::bv::TheoryBV* bv)
- : d_ctx(new context::Context())
- , d_bitblaster(new TLazyBitblaster(d_ctx, bv, name, true))
+ : d_ctx()
+ , d_bitblaster(new TLazyBitblaster(&d_ctx, bv, name, true))
, d_conflict()
- , d_inConflict(d_ctx, false)
+ , d_inConflict(&d_ctx, false)
{}
void BVQuickCheck::push() {
- d_ctx->push();
+ d_ctx.push();
}
void BVQuickCheck::pop() {
- d_ctx->pop();
+ d_ctx.pop();
}
BVQuickCheck::vars_iterator BVQuickCheck::beginVars() {
}
void BVQuickCheck::popToZero() {
- while (d_ctx->getLevel() > 0) {
- d_ctx->pop();
+ while (d_ctx.getLevel() > 0) {
+ d_ctx.pop();
}
}
}
BVQuickCheck::~BVQuickCheck() {
+ clearSolver();
delete d_bitblaster;
- delete d_ctx;
}
QuickXPlain::QuickXPlain(const std::string& name, BVQuickCheck* solver, unsigned long budget)
class TheoryBV;
class BVQuickCheck {
- context::Context* d_ctx;
+ context::Context d_ctx;
TLazyBitblaster* d_bitblaster;
Node d_conflict;
context::CDO<bool> d_inConflict;
d_nullRegistrar,
d_nullContext);
- prop::BVSatSolverInterface::Notify* notify = d_emptyNotify ?
+ d_satSolverNotify = d_emptyNotify ?
(prop::BVSatSolverInterface::Notify*) new MinisatEmptyNotify() :
(prop::BVSatSolverInterface::Notify*) new MinisatNotify(d_cnfStream, bv, this);
- d_satSolver->setNotify(notify);
+ d_satSolver->setNotify(d_satSolverNotify);
}
void TLazyBitblaster::setAbstraction(AbstractionModule* abs) {
delete d_nullRegistrar;
delete d_nullContext;
delete d_satSolver;
+ delete d_satSolverNotify;
+ d_assertedAtoms->deleteSelf();
+ d_explanations->deleteSelf();
}
void TLazyBitblaster::clearSolver() {
Assert (d_ctx->getLevel() == 0);
delete d_satSolver;
+ delete d_satSolverNotify;
delete d_cnfStream;
d_assertedAtoms->deleteSelf();
d_assertedAtoms = new(true) context::CDList<prop::SatLiteral>(d_ctx);
// recreate sat solver
d_satSolver = prop::SatSolverFactory::createMinisat(d_ctx);
d_cnfStream = new prop::TseitinCnfStream(d_satSolver,
- new prop::NullRegistrar(),
- new context::Context());
+ d_nullRegistrar,
+ d_nullContext);
- prop::BVSatSolverInterface::Notify* notify = d_emptyNotify ?
+ d_satSolverNotify = d_emptyNotify ?
(prop::BVSatSolverInterface::Notify*) new MinisatEmptyNotify() :
(prop::BVSatSolverInterface::Notify*) new MinisatNotify(d_cnfStream, d_bv, this);
- d_satSolver->setNotify(notify);
+ d_satSolver->setNotify(d_satSolverNotify);
}
for (unsigned i = 0; i < d_subtheories.size(); ++i) {
delete d_subtheories[i];
}
+ delete d_abstractionModule;
}
void TheoryBV::setMasterEqualityEngine(eq::EqualityEngine* eq) {