New C++ API: Fixed ownership of options object. (#2243)
authorAina Niemetz <aina.niemetz@gmail.com>
Wed, 1 Aug 2018 18:36:30 +0000 (11:36 -0700)
committerGitHub <noreply@github.com>
Wed, 1 Aug 2018 18:36:30 +0000 (11:36 -0700)
src/api/cvc4cpp.cpp
src/api/cvc4cpp.h

index 10c0c8e2699b04c1a815df65e164cc5ef19d84ee..19d7840a8911180adbea0c5c84d92bf122a2eb96 100644 (file)
@@ -1429,12 +1429,12 @@ size_t RoundingModeHashFunction::operator()(const RoundingMode& rm) const
 /* Solver                                                                     */
 /* -------------------------------------------------------------------------- */
 
-Solver::Solver(Options* opts) : d_opts(new Options())
+Solver::Solver(Options* opts)
 {
-  if (opts) d_opts->copyValues(*opts);
-  d_exprMgr = std::unique_ptr<ExprManager>(new ExprManager(*d_opts));
+  d_exprMgr = std::unique_ptr<ExprManager>(
+      opts == nullptr ? new ExprManager(Options()) : new ExprManager(*opts));
   d_smtEngine = std::unique_ptr<SmtEngine>(new SmtEngine(d_exprMgr.get()));
-  d_rng = std::unique_ptr<Random>(new Random((*d_opts)[options::seed]));
+  d_rng = std::unique_ptr<Random>(new Random((*opts)[options::seed]));
 }
 
 Solver::~Solver() {}
index b76fbb08f6f6cad6d87a87cd175fa1878c4db395..c3c4290099ef84b5376d5ae987c2d8eb14f6af9c 100644 (file)
@@ -2355,8 +2355,6 @@ class CVC4_PUBLIC Solver
   /* Helper to convert a vector of sorts to internal types. */
   std::vector<Expr> termVectorToExprs(const std::vector<Term>& vector) const;
 
-  /* The options of this solver. */
-  std::unique_ptr<Options> d_opts;
   /* The expression manager of this solver. */
   std::unique_ptr<ExprManager> d_exprMgr;
   /* The SMT engine of this solver. */