Skip to content

Commit

Permalink
Remove util_make_unique
Browse files Browse the repository at this point in the history
With the move to C++ 17 we can use std::make_unique instead.
  • Loading branch information
tautschnig committed Nov 14, 2023
1 parent a8de0b7 commit c17285c
Show file tree
Hide file tree
Showing 58 changed files with 188 additions and 253 deletions.
2 changes: 1 addition & 1 deletion jbmc/src/janalyzer/janalyzer_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ int janalyzer_parse_optionst::doit()
lazy_goto_model.initialize(cmdline.args, options);

class_hierarchy =
util_make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
std::make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);

log.status() << "Generating GOTO Program" << messaget::eom;
lazy_goto_model.load_all_functions();
Expand Down
2 changes: 1 addition & 1 deletion jbmc/src/java_bytecode/java_bytecode_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ void java_bytecode_languaget::show_parse(std::ostream &out)

std::unique_ptr<languaget> new_java_bytecode_language()
{
return util_make_unique<java_bytecode_languaget>();
return std::make_unique<java_bytecode_languaget>();
}

bool java_bytecode_languaget::from_expr(
Expand Down
5 changes: 3 additions & 2 deletions jbmc/src/java_bytecode/java_bytecode_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Author: Daniel Kroening, [email protected]
#define CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_LANGUAGE_H

#include <util/json.h>
#include <util/make_unique.h>
#include <util/prefix_filter.h>
#include <util/symbol.h> // IWYU pragma: keep

Expand Down Expand Up @@ -319,7 +318,9 @@ class java_bytecode_languaget:public languaget
const namespacet &ns) override;

std::unique_ptr<languaget> new_language() override
{ return util_make_unique<java_bytecode_languaget>(); }
{
return std::make_unique<java_bytecode_languaget>();
}

std::string id() const override { return "java"; }
std::string description() const override { return "Java Bytecode"; }
Expand Down
4 changes: 1 addition & 3 deletions jbmc/src/java_bytecode/java_qualifiers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <sstream>
#include <iterator>

#include <util/make_unique.h>

#include "expr2java.h"

java_qualifierst &java_qualifierst::operator=(const java_qualifierst &other)
Expand All @@ -24,7 +22,7 @@ java_qualifierst &java_qualifierst::operator=(const java_qualifierst &other)

std::unique_ptr<qualifierst> java_qualifierst::clone() const
{
auto other = util_make_unique<java_qualifierst>(ns);
auto other = std::make_unique<java_qualifierst>(ns);
*other = *this;
return std::move(other);
}
Expand Down
17 changes: 8 additions & 9 deletions jbmc/src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
#include <util/exit_codes.h>
#include <util/help_formatter.h>
#include <util/invariant.h>
#include <util/make_unique.h>
#include <util/version.h>
#include <util/xml.h>

Expand Down Expand Up @@ -535,7 +534,7 @@ int jbmc_parse_optionst::doit()
options.get_bool_option("stop-on-fail") && options.get_bool_option("paths"))
{
verifier =
util_make_unique<stop_on_fail_verifiert<java_single_path_symex_checkert>>(
std::make_unique<stop_on_fail_verifiert<java_single_path_symex_checkert>>(
options, ui_message_handler, *goto_model_ptr);
}
else if(
Expand All @@ -545,13 +544,13 @@ int jbmc_parse_optionst::doit()
if(options.get_bool_option("localize-faults"))
{
verifier =
util_make_unique<stop_on_fail_verifier_with_fault_localizationt<
std::make_unique<stop_on_fail_verifier_with_fault_localizationt<
java_multi_path_symex_checkert>>(
options, ui_message_handler, *goto_model_ptr);
}
else
{
verifier = util_make_unique<
verifier = std::make_unique<
stop_on_fail_verifiert<java_multi_path_symex_checkert>>(
options, ui_message_handler, *goto_model_ptr);
}
Expand All @@ -560,7 +559,7 @@ int jbmc_parse_optionst::doit()
!options.get_bool_option("stop-on-fail") &&
options.get_bool_option("paths"))
{
verifier = util_make_unique<all_properties_verifier_with_trace_storaget<
verifier = std::make_unique<all_properties_verifier_with_trace_storaget<
java_single_path_symex_checkert>>(
options, ui_message_handler, *goto_model_ptr);
}
Expand All @@ -571,13 +570,13 @@ int jbmc_parse_optionst::doit()
if(options.get_bool_option("localize-faults"))
{
verifier =
util_make_unique<all_properties_verifier_with_fault_localizationt<
std::make_unique<all_properties_verifier_with_fault_localizationt<
java_multi_path_symex_checkert>>(
options, ui_message_handler, *goto_model_ptr);
}
else
{
verifier = util_make_unique<all_properties_verifier_with_trace_storaget<
verifier = std::make_unique<all_properties_verifier_with_trace_storaget<
java_multi_path_symex_checkert>>(
options, ui_message_handler, *goto_model_ptr);
}
Expand All @@ -603,7 +602,7 @@ int jbmc_parse_optionst::get_goto_program(
lazy_goto_model.initialize(cmdline.args, options);

class_hierarchy =
util_make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
std::make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);

// Show the class hierarchy
if(cmdline.isset("show-class-hierarchy"))
Expand Down Expand Up @@ -662,7 +661,7 @@ int jbmc_parse_optionst::get_goto_program(
}

goto_model_ptr =
util_make_unique<lazy_goto_modelt>(std::move(lazy_goto_model));
std::make_unique<lazy_goto_modelt>(std::move(lazy_goto_model));
}

log.status() << config.object_bits_info() << messaget::eom;
Expand Down
11 changes: 5 additions & 6 deletions src/analyses/ai.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Author: Daniel Kroening, [email protected]

#include <util/deprecate.h>
#include <util/json.h>
#include <util/make_unique.h>
#include <util/message.h>
#include <util/xml.h>

Expand Down Expand Up @@ -565,20 +564,20 @@ class ait : public ai_recursive_interproceduralt
// constructor
ait()
: ai_recursive_interproceduralt(
util_make_unique<
std::make_unique<
ai_history_factory_default_constructort<ahistoricalt>>(),
util_make_unique<ai_domain_factory_default_constructort<domainT>>(),
util_make_unique<location_sensitive_storaget>(),
std::make_unique<ai_domain_factory_default_constructort<domainT>>(),
std::make_unique<location_sensitive_storaget>(),
no_logging)
{
}

explicit ait(std::unique_ptr<ai_domain_factory_baset> &&df)
: ai_recursive_interproceduralt(
util_make_unique<
std::make_unique<
ai_history_factory_default_constructort<ahistoricalt>>(),
std::move(df),
util_make_unique<location_sensitive_storaget>(),
std::make_unique<location_sensitive_storaget>(),
no_logging)
{
}
Expand Down
7 changes: 3 additions & 4 deletions src/analyses/ai_domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Author: Daniel Kroening, [email protected]
#define CPROVER_ANALYSES_AI_DOMAIN_H

#include <util/json.h>
#include <util/make_unique.h>
#include <util/xml.h>

#include "ai_history.h"
Expand Down Expand Up @@ -206,7 +205,7 @@ class ai_domain_factoryt : public ai_domain_factory_baset

std::unique_ptr<statet> copy(const statet &s) const override
{
return util_make_unique<domainT>(static_cast<const domainT &>(s));
return std::make_unique<domainT>(static_cast<const domainT &>(s));
}

bool merge(statet &dest, const statet &src, trace_ptrt from, trace_ptrt to)
Expand All @@ -229,7 +228,7 @@ class ai_domain_factory_default_constructort

std::unique_ptr<statet> make(locationt l) const override
{
auto d = util_make_unique<domainT>();
auto d = std::make_unique<domainT>();
CHECK_RETURN(d->is_bottom());
return std::unique_ptr<statet>(d.release());
}
Expand All @@ -246,7 +245,7 @@ class ai_domain_factory_location_constructort

std::unique_ptr<statet> make(locationt l) const override
{
auto d = util_make_unique<domainT>(l);
auto d = std::make_unique<domainT>(l);
CHECK_RETURN(d->is_bottom());
return std::unique_ptr<statet>(d.release());
}
Expand Down
4 changes: 2 additions & 2 deletions src/analyses/dependence_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ class dep_graph_domain_factoryt : public ai_domain_factoryt<dep_graph_domaint>
{
auto node_id = dg.add_node();
dg.nodes[node_id].PC = l;
auto p = util_make_unique<dep_graph_domaint>(node_id);
auto p = std::make_unique<dep_graph_domaint>(node_id);
CHECK_RETURN(p->is_bottom());

return std::unique_ptr<statet>(p.release());
Expand All @@ -360,7 +360,7 @@ class dep_graph_domain_factoryt : public ai_domain_factoryt<dep_graph_domaint>
};

dependence_grapht::dependence_grapht(const namespacet &_ns)
: ait<dep_graph_domaint>(util_make_unique<dep_graph_domain_factoryt>(*this)),
: ait<dep_graph_domaint>(std::make_unique<dep_graph_domain_factoryt>(*this)),
ns(_ns),
rd(ns)
{
Expand Down
5 changes: 2 additions & 3 deletions src/analyses/goto_rw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Date: April 2010
#include <util/byte_operators.h>
#include <util/endianness_map.h>
#include <util/expr_util.h>
#include <util/make_unique.h>
#include <util/namespace.h>
#include <util/pointer_expr.h>
#include <util/pointer_offset_size.h>
Expand Down Expand Up @@ -528,7 +527,7 @@ void rw_range_sett::add(
.first;

if(entry->second==nullptr)
entry->second=util_make_unique<range_domaint>();
entry->second = std::make_unique<range_domaint>();

static_cast<range_domaint&>(*entry->second).push_back(
{range_start, range_end});
Expand Down Expand Up @@ -766,7 +765,7 @@ void rw_guarded_range_set_value_sett::add(
.first;

if(entry->second==nullptr)
entry->second=util_make_unique<guarded_range_domaint>();
entry->second = std::make_unique<guarded_range_domaint>();

static_cast<guarded_range_domaint&>(*entry->second).insert(
{range_start, {range_end, guard.as_expr()}});
Expand Down
4 changes: 2 additions & 2 deletions src/analyses/invariant_propagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class invariant_set_domain_factoryt

std::unique_ptr<statet> make(locationt l) const override
{
auto p = util_make_unique<invariant_set_domaint>(
auto p = std::make_unique<invariant_set_domaint>(
ip.value_sets, ip.object_store, ip.ns);
CHECK_RETURN(p->is_bottom());

Expand All @@ -40,7 +40,7 @@ invariant_propagationt::invariant_propagationt(
const namespacet &_ns,
value_setst &_value_sets)
: ait<invariant_set_domaint>(
util_make_unique<invariant_set_domain_factoryt>(*this)),
std::make_unique<invariant_set_domain_factoryt>(*this)),
ns(_ns),
value_sets(_value_sets),
object_store(_ns)
Expand Down
3 changes: 1 addition & 2 deletions src/analyses/local_may_alias.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Author: Daniel Kroening, [email protected]
#include <stack>

#include <util/union_find.h>
#include <util/make_unique.h>

#include "locals.h"
#include "dirty.h"
Expand Down Expand Up @@ -120,7 +119,7 @@ class local_may_alias_factoryt
goto_functionst::function_mapt::const_iterator f_it2=
goto_functions->function_map.find(fkt);
CHECK_RETURN(f_it2 != goto_functions->function_map.end());
return *(fkt_map[fkt]=util_make_unique<local_may_aliast>(f_it2->second));
return *(fkt_map[fkt] = std::make_unique<local_may_aliast>(f_it2->second));
}

local_may_aliast &operator()(goto_programt::const_targett t)
Expand Down
11 changes: 5 additions & 6 deletions src/analyses/reaching_definitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Date: February 2013
#include "reaching_definitions.h"

#include <util/base_exceptions.h> // IWYU pragma: keep
#include <util/make_unique.h>
#include <util/pointer_offset_size.h>

#include <pointer-analysis/value_set_analysis_fi.h>
Expand All @@ -41,7 +40,7 @@ class rd_range_domain_factoryt : public ai_domain_factoryt<rd_range_domaint>

std::unique_ptr<statet> make(locationt) const override
{
auto p = util_make_unique<rd_range_domaint>(bv_container);
auto p = std::make_unique<rd_range_domaint>(bv_container);
CHECK_RETURN(p->is_bottom());
return std::unique_ptr<statet>(p.release());
}
Expand All @@ -53,7 +52,7 @@ class rd_range_domain_factoryt : public ai_domain_factoryt<rd_range_domaint>
reaching_definitions_analysist::reaching_definitions_analysist(
const namespacet &_ns)
: concurrency_aware_ait<rd_range_domaint>(
util_make_unique<rd_range_domain_factoryt>(this)),
std::make_unique<rd_range_domain_factoryt>(this)),
ns(_ns)
{
}
Expand Down Expand Up @@ -734,13 +733,13 @@ const rd_range_domaint::ranges_at_loct &rd_range_domaint::get(
void reaching_definitions_analysist::initialize(
const goto_functionst &goto_functions)
{
auto value_sets_=util_make_unique<value_set_analysis_fit>(ns);
auto value_sets_ = std::make_unique<value_set_analysis_fit>(ns);
(*value_sets_)(goto_functions);
value_sets=std::move(value_sets_);

is_threaded=util_make_unique<is_threadedt>(goto_functions);
is_threaded = std::make_unique<is_threadedt>(goto_functions);

is_dirty=util_make_unique<dirtyt>(goto_functions);
is_dirty = std::make_unique<dirtyt>(goto_functions);

concurrency_aware_ait<rd_range_domaint>::initialize(goto_functions);
}
7 changes: 3 additions & 4 deletions src/analyses/variable-sensitivity/abstract_value_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <util/arith_tools.h>
#include <util/bitvector_types.h>
#include <util/ieee_float.h>
#include <util/make_unique.h>
#include <util/simplify_expr.h>

#include <goto-programs/adjust_float_expressions.h>
Expand Down Expand Up @@ -76,12 +75,12 @@ bool single_value_index_ranget::advance_to_next()

index_range_implementation_ptrt make_empty_index_range()
{
return util_make_unique<empty_index_ranget>();
return std::make_unique<empty_index_ranget>();
}

index_range_implementation_ptrt make_indeterminate_index_range()
{
return util_make_unique<indeterminate_index_ranget>();
return std::make_unique<indeterminate_index_ranget>();
}

class single_value_value_ranget : public value_range_implementationt
Expand Down Expand Up @@ -115,7 +114,7 @@ class single_value_value_ranget : public value_range_implementationt
value_range_implementation_ptrt
make_single_value_range(const abstract_object_pointert &value)
{
return util_make_unique<single_value_value_ranget>(value);
return std::make_unique<single_value_value_ranget>(value);
}

static abstract_object_pointert constants_expression_transform(
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/variable-sensitivity/abstract_value_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class empty_value_ranget : public value_range_implementationt
}
value_range_implementation_ptrt reset() const override
{
return util_make_unique<empty_value_ranget>();
return std::make_unique<empty_value_ranget>();
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class constant_index_ranget : public single_value_index_ranget
static index_range_implementation_ptrt
make_constant_index_range(const exprt &val)
{
return util_make_unique<constant_index_ranget>(val);
return std::make_unique<constant_index_ranget>(val);
}

constant_abstract_valuet::constant_abstract_valuet(const exprt &e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <util/bitvector_types.h>
#include <util/expr_util.h>
#include <util/invariant.h>
#include <util/make_unique.h>
#include <util/simplify_expr.h>

#include "abstract_environment.h"
Expand Down Expand Up @@ -72,7 +71,7 @@ static index_range_implementation_ptrt make_interval_index_range(
const constant_interval_exprt &interval,
const namespacet &n)
{
return util_make_unique<interval_index_ranget>(interval, n);
return std::make_unique<interval_index_ranget>(interval, n);
}

static inline bool
Expand Down
Loading

0 comments on commit c17285c

Please sign in to comment.