From efac53e969ccefc01bace1a5f095dfd3570c3767 Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Mon, 17 Jul 2017 01:18:10 -0400 Subject: Remove PtrCloser (#198) With C++11, we don't need PtrCloser anymore because we can just use std::unique_ptr. --- src/parser/smt2/Smt2.g | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/parser/smt2/Smt2.g') diff --git a/src/parser/smt2/Smt2.g b/src/parser/smt2/Smt2.g index 5d24ec024..88709c29a 100644 --- a/src/parser/smt2/Smt2.g +++ b/src/parser/smt2/Smt2.g @@ -85,7 +85,8 @@ using namespace CVC4::parser; // files. See the documentation in "parser/antlr_undefines.h" for more details. #include "parser/antlr_undefines.h" -#include "base/ptr_closer.h" +#include + #include "parser/parser.h" #include "parser/antlr_tracing.h" #include "smt/command.h" @@ -205,7 +206,7 @@ parseExpr returns [CVC4::parser::smt2::myExpr expr] */ parseCommand returns [CVC4::Command* cmd_return = NULL] @declarations { - CVC4::PtrCloser cmd; + std::unique_ptr cmd; std::string name; } @after { @@ -241,7 +242,7 @@ parseCommand returns [CVC4::Command* cmd_return = NULL] */ parseSygus returns [CVC4::Command* cmd_return = NULL] @declarations { - CVC4::PtrCloser cmd; + std::unique_ptr cmd; std::string name; } @after { @@ -255,7 +256,7 @@ parseSygus returns [CVC4::Command* cmd_return = NULL] * Parse the internal portion of the command, ignoring the surrounding * parentheses. */ -command [CVC4::PtrCloser* cmd] +command [std::unique_ptr* cmd] @declarations { std::string name; std::vector names; @@ -455,7 +456,7 @@ command [CVC4::PtrCloser* cmd] PARSER_STATE->pushUnsatCoreNameScope(); cmd->reset(new PushCommand()); } else { - CVC4::PtrCloser seq(new CommandSequence()); + std::unique_ptr seq(new CommandSequence()); do { PARSER_STATE->pushScope(); PARSER_STATE->pushUnsatCoreNameScope(); @@ -495,7 +496,7 @@ command [CVC4::PtrCloser* cmd] PARSER_STATE->popScope(); cmd->reset(new PopCommand()); } else { - CVC4::PtrCloser seq(new CommandSequence()); + std::unique_ptr seq(new CommandSequence()); do { PARSER_STATE->popUnsatCoreNameScope(); PARSER_STATE->popScope(); @@ -554,7 +555,7 @@ command [CVC4::PtrCloser* cmd] } ; -sygusCommand [CVC4::PtrCloser* cmd] +sygusCommand [std::unique_ptr* cmd] @declarations { std::string name, fun; std::vector names; @@ -565,7 +566,7 @@ sygusCommand [CVC4::PtrCloser* cmd] std::vector sygus_vars; std::vector > sortedVarNames; SExpr sexpr; - CVC4::PtrCloser seq; + std::unique_ptr seq; std::vector< std::vector< CVC4::SygusGTerm > > sgts; std::vector< CVC4::Datatype > datatypes; std::vector< std::vector > ops; @@ -1075,7 +1076,7 @@ sygusGTerm[CVC4::SygusGTerm& sgt, std::string& fun] ; // Separate this into its own rule (can be invoked by set-info or meta-info) -metaInfoInternal[CVC4::PtrCloser* cmd] +metaInfoInternal[std::unique_ptr* cmd] @declarations { std::string name; SExpr sexpr; @@ -1105,7 +1106,7 @@ metaInfoInternal[CVC4::PtrCloser* cmd] } ; -setOptionInternal[CVC4::PtrCloser* cmd] +setOptionInternal[std::unique_ptr* cmd] @init { std::string name; SExpr sexpr; @@ -1122,7 +1123,7 @@ setOptionInternal[CVC4::PtrCloser* cmd] } ; -smt25Command[CVC4::PtrCloser* cmd] +smt25Command[std::unique_ptr* cmd] @declarations { std::string name; std::string fname; @@ -1136,7 +1137,7 @@ smt25Command[CVC4::PtrCloser* cmd] std::vector funcs; std::vector func_defs; Expr aexpr; - CVC4::PtrCloser seq; + std::unique_ptr seq; } /* meta-info */ : META_INFO_TOK metaInfoInternal[cmd] @@ -1330,7 +1331,7 @@ smt25Command[CVC4::PtrCloser* cmd] // GET_UNSAT_ASSUMPTIONS ; -extendedCommand[CVC4::PtrCloser* cmd] +extendedCommand[std::unique_ptr* cmd] @declarations { std::vector dts; Expr e, e2; @@ -1340,7 +1341,7 @@ extendedCommand[CVC4::PtrCloser* cmd] std::vector terms; std::vector sorts; std::vector > sortedVarNames; - CVC4::PtrCloser seq; + std::unique_ptr seq; } /* Extended SMT-LIB set of commands syntax, not permitted in * --smtlib2 compliance mode. */ @@ -1495,7 +1496,7 @@ extendedCommand[CVC4::PtrCloser* cmd] ; -datatypes_2_5_DefCommand[bool isCo, CVC4::PtrCloser* cmd] +datatypes_2_5_DefCommand[bool isCo, std::unique_ptr* cmd] @declarations { std::vector dts; std::string name; @@ -1515,7 +1516,7 @@ datatypes_2_5_DefCommand[bool isCo, CVC4::PtrCloser* cmd] } ; -datatypeDefCommand[bool isCo, CVC4::PtrCloser* cmd] +datatypeDefCommand[bool isCo, std::unique_ptr* cmd] @declarations { std::vector dts; std::string name; @@ -1530,7 +1531,7 @@ datatypeDefCommand[bool isCo, CVC4::PtrCloser* cmd] { cmd->reset(new DatatypeDeclarationCommand(PARSER_STATE->mkMutualDatatypeTypes(dts))); } ; -datatypesDefCommand[bool isCo, CVC4::PtrCloser* cmd] +datatypesDefCommand[bool isCo, std::unique_ptr* cmd] @declarations { std::vector dts; std::string name; @@ -1593,7 +1594,7 @@ datatypesDefCommand[bool isCo, CVC4::PtrCloser* cmd] } ; -rewriterulesCommand[CVC4::PtrCloser* cmd] +rewriterulesCommand[std::unique_ptr* cmd] @declarations { std::vector > sortedVarNames; std::vector args, guards, heads, triggers; -- cgit v1.2.3