feat(*): use std::make_shared to create shared_ptr
This commit is contained in:
parent
f27105d17f
commit
de018220e1
7 changed files with 12 additions and 12 deletions
|
@ -507,7 +507,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
frontend_elaborator::frontend_elaborator(environment const & env):m_ptr(new imp(env)) {}
|
||||
frontend_elaborator::frontend_elaborator(environment const & env):m_ptr(std::make_shared<imp>(env)) {}
|
||||
frontend_elaborator::~frontend_elaborator() {}
|
||||
std::pair<expr, metavar_env> frontend_elaborator::operator()(expr const & e) { return m_ptr->elaborate(e); }
|
||||
std::tuple<expr, expr, metavar_env> frontend_elaborator::operator()(name const & n, expr const & t, expr const & e) {
|
||||
|
|
|
@ -461,14 +461,14 @@ environment_cell::~environment_cell() {
|
|||
}
|
||||
|
||||
environment::environment():
|
||||
m_ptr(new environment_cell()) {
|
||||
m_ptr(std::make_shared<environment_cell>()) {
|
||||
m_ptr->m_this = m_ptr;
|
||||
m_ptr->m_type_checker.reset(new type_checker(*this));
|
||||
}
|
||||
|
||||
// used when creating a new child environment
|
||||
environment::environment(std::shared_ptr<environment_cell> const & parent, bool):
|
||||
m_ptr(new environment_cell(parent)) {
|
||||
m_ptr(std::make_shared<environment_cell>(parent)) {
|
||||
m_ptr->m_this = m_ptr;
|
||||
m_ptr->m_type_checker.reset(new type_checker(*this));
|
||||
}
|
||||
|
|
|
@ -78,10 +78,10 @@ class environment_cell {
|
|||
bool already_imported(name const & n) const;
|
||||
bool mark_imported_core(name n);
|
||||
|
||||
environment_cell(std::shared_ptr<environment_cell> const & parent);
|
||||
|
||||
public:
|
||||
environment_cell();
|
||||
environment_cell(std::shared_ptr<environment_cell> const & parent);
|
||||
~environment_cell();
|
||||
|
||||
/** \brief Return true iff this environment has children environments. */
|
||||
|
|
|
@ -11,15 +11,15 @@ Author: Leonardo de Moura
|
|||
namespace lean {
|
||||
io_state::io_state():
|
||||
m_formatter(mk_simple_formatter()),
|
||||
m_regular_channel(new stdout_channel()),
|
||||
m_diagnostic_channel(new stderr_channel()) {
|
||||
m_regular_channel(std::make_shared<stdout_channel>()),
|
||||
m_diagnostic_channel(std::make_shared<stderr_channel>()) {
|
||||
}
|
||||
|
||||
io_state::io_state(options const & opts, formatter const & fmt):
|
||||
m_options(opts),
|
||||
m_formatter(fmt),
|
||||
m_regular_channel(new stdout_channel()),
|
||||
m_diagnostic_channel(new stderr_channel()) {
|
||||
m_regular_channel(std::make_shared<stdout_channel>()),
|
||||
m_diagnostic_channel(std::make_shared<stderr_channel>()) {
|
||||
}
|
||||
|
||||
io_state::~io_state() {}
|
||||
|
|
|
@ -176,7 +176,7 @@ tactic trace_state_tactic() {
|
|||
tactic suppress_trace(tactic const & t) {
|
||||
return mk_tactic([=](ro_environment const & env, io_state const & io, proof_state const & s) -> proof_state_seq {
|
||||
io_state new_io(io);
|
||||
std::shared_ptr<output_channel> out(new string_output_channel());
|
||||
std::shared_ptr<output_channel> out(std::make_shared<string_output_channel>());
|
||||
new_io.set_diagnostic_channel(out);
|
||||
return t(env, new_io, s);
|
||||
});
|
||||
|
|
|
@ -72,7 +72,7 @@ static void tst4() {
|
|||
|
||||
static void tst5() {
|
||||
environment env; io_state ios; init_frontend(env, ios);
|
||||
std::shared_ptr<string_output_channel> out(new string_output_channel());
|
||||
std::shared_ptr<string_output_channel> out(std::make_shared<string_output_channel>());
|
||||
ios.set_regular_channel(out);
|
||||
ios.set_option(name{"pp", "unicode"}, true);
|
||||
ios.set_option(name{"lean", "pp", "notation"}, true);
|
||||
|
@ -92,7 +92,7 @@ static expr mk_deep(unsigned depth) {
|
|||
|
||||
static void tst6() {
|
||||
environment env; io_state ios; init_frontend(env, ios);
|
||||
std::shared_ptr<string_output_channel> out(new string_output_channel());
|
||||
std::shared_ptr<string_output_channel> out(std::make_shared<string_output_channel>());
|
||||
ios.set_regular_channel(out);
|
||||
expr t = mk_deep(10);
|
||||
ios.set_option(name{"lean", "pp", "max_depth"}, 5);
|
||||
|
|
|
@ -133,7 +133,7 @@ script_state to_script_state(lua_State * L) {
|
|||
}
|
||||
|
||||
script_state::script_state():
|
||||
m_ptr(new imp()) {
|
||||
m_ptr(std::make_shared<imp>()) {
|
||||
m_ptr->save_weak_ptr(m_ptr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue