From: Tim King Date: Sat, 12 Nov 2016 00:04:51 +0000 (-0800) Subject: Deleting the remaining commands in the Parser's queue within ~Parser(). X-Git-Tag: cvc5-1.0.0~5985 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e84a5e76ba83b5f73760589efb051970d58172f;p=cvc5.git Deleting the remaining commands in the Parser's queue within ~Parser(). --- diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index ac93c93d2..2377b8a44 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -61,6 +61,16 @@ Parser::Parser(ExprManager* exprManager, Input* input, bool strictMode, d_input->setParser(*this); } +Parser::~Parser() { + for (std::list::iterator iter = d_commandQueue.begin(); + iter != d_commandQueue.end(); ++iter) { + Command* command = *iter; + delete command; + } + d_commandQueue.clear(); + delete d_input; +} + Expr Parser::getSymbol(const std::string& name, SymbolType type) { checkDeclaration(name, CHECK_DECLARED, type); assert(isDeclared(name, type)); diff --git a/src/parser/parser.h b/src/parser/parser.h index 351aa858a..b310456bd 100644 --- a/src/parser/parser.h +++ b/src/parser/parser.h @@ -230,6 +230,8 @@ class CVC4_PUBLIC Parser { * "Preemption commands": extra commands implied by subterms that * should be issued before the currently-being-parsed command is * issued. Used to support SMT-LIBv2 ":named" attribute on terms. + * + * Owns the memory of the Commands in the queue. */ std::list d_commandQueue; @@ -254,9 +256,7 @@ protected: public: - virtual ~Parser() { - delete d_input; - } + virtual ~Parser(); /** Get the associated ExprManager. */ inline ExprManager* getExprManager() const {