From 08d152c052c49ce5759ab9e682ff131172c7879f Mon Sep 17 00:00:00 2001 From: Tim King Date: Mon, 6 Nov 2017 20:36:45 -0800 Subject: Using unique_ptr's for members of CegConjecture. (#1324) --- src/theory/quantifiers/ce_guided_conjecture.cpp | 23 +++++++++-------------- src/theory/quantifiers/ce_guided_conjecture.h | 12 +++++++----- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/theory/quantifiers/ce_guided_conjecture.cpp b/src/theory/quantifiers/ce_guided_conjecture.cpp index 5af8eafc8..7110f1037 100644 --- a/src/theory/quantifiers/ce_guided_conjecture.cpp +++ b/src/theory/quantifiers/ce_guided_conjecture.cpp @@ -45,20 +45,15 @@ void collectDisjuncts( Node n, std::vector< Node >& d ) { } CegConjecture::CegConjecture(QuantifiersEngine* qe) - : d_qe(qe), d_syntax_guided(false) { - d_refine_count = 0; - d_ceg_si = new CegConjectureSingleInv(qe, this); - d_ceg_pbe = new CegConjecturePbe(qe, this); - d_ceg_proc = new CegConjectureProcess(qe); - d_ceg_gc = new CegGrammarConstructor(qe, this); -} - -CegConjecture::~CegConjecture() { - delete d_ceg_si; - delete d_ceg_pbe; - delete d_ceg_proc; - delete d_ceg_gc; -} + : d_qe(qe), + d_ceg_si(new CegConjectureSingleInv(qe, this)), + d_ceg_pbe(new CegConjecturePbe(qe, this)), + d_ceg_proc(new CegConjectureProcess(qe)), + d_ceg_gc(new CegGrammarConstructor(qe, this)), + d_refine_count(0), + d_syntax_guided(false) {} + +CegConjecture::~CegConjecture() {} void CegConjecture::assign( Node q ) { Assert( d_embed_quant.isNull() ); diff --git a/src/theory/quantifiers/ce_guided_conjecture.h b/src/theory/quantifiers/ce_guided_conjecture.h index b725449b4..90627699f 100644 --- a/src/theory/quantifiers/ce_guided_conjecture.h +++ b/src/theory/quantifiers/ce_guided_conjecture.h @@ -18,6 +18,8 @@ #ifndef __CVC4__THEORY__QUANTIFIERS__CE_GUIDED_CONJECTURE_H #define __CVC4__THEORY__QUANTIFIERS__CE_GUIDED_CONJECTURE_H +#include + #include "theory/quantifiers/ce_guided_pbe.h" #include "theory/quantifiers/ce_guided_single_inv.h" #include "theory/quantifiers/sygus_grammar_cons.h" @@ -111,7 +113,7 @@ public: //-----------------------------------end refinement lemmas /** get program by examples utility */ - CegConjecturePbe* getPbe() { return d_ceg_pbe; } + CegConjecturePbe* getPbe() { return d_ceg_pbe.get(); } /** get the symmetry breaking predicate for type */ Node getSymmetryBreakingPredicate( Node x, Node e, TypeNode tn, unsigned tindex, unsigned depth); @@ -121,13 +123,13 @@ private: /** reference to quantifier engine */ QuantifiersEngine * d_qe; /** single invocation utility */ - CegConjectureSingleInv * d_ceg_si; + std::unique_ptr d_ceg_si; /** program by examples utility */ - CegConjecturePbe * d_ceg_pbe; + std::unique_ptr d_ceg_pbe; /** utility for static preprocessing and analysis of conjectures */ - CegConjectureProcess* d_ceg_proc; + std::unique_ptr d_ceg_proc; /** grammar utility */ - CegGrammarConstructor * d_ceg_gc; + std::unique_ptr d_ceg_gc; /** list of constants for quantified formula * The Skolems for the negation of d_embed_quant. */ -- cgit v1.2.3