Skip to content

Commit a7bb445

Browse files
committed
Remove util_make_unique
With the move to C++ 17 we can use std::make_unique instead.
1 parent efecc11 commit a7bb445

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+160
-228
lines changed

jbmc/src/janalyzer/janalyzer_parse_options.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ int janalyzer_parse_optionst::doit()
395395
lazy_goto_model.initialize(cmdline.args, options);
396396

397397
class_hierarchy =
398-
util_make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
398+
std::make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
399399

400400
log.status() << "Generating GOTO Program" << messaget::eom;
401401
lazy_goto_model.load_all_functions();

jbmc/src/java_bytecode/java_bytecode_language.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,7 @@ void java_bytecode_languaget::show_parse(std::ostream &out)
15211521

15221522
std::unique_ptr<languaget> new_java_bytecode_language()
15231523
{
1524-
return util_make_unique<java_bytecode_languaget>();
1524+
return std::make_unique<java_bytecode_languaget>();
15251525
}
15261526

15271527
bool java_bytecode_languaget::from_expr(

jbmc/src/java_bytecode/java_bytecode_language.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Author: Daniel Kroening, [email protected]
2222
#include <memory>
2323

2424
#include <util/json.h>
25-
#include <util/make_unique.h>
2625
#include <util/prefix_filter.h>
2726

2827
#include <langapi/language.h>
@@ -333,7 +332,7 @@ class java_bytecode_languaget:public languaget
333332
const namespacet &ns) override;
334333

335334
std::unique_ptr<languaget> new_language() override
336-
{ return util_make_unique<java_bytecode_languaget>(); }
335+
{ return std::make_unique<java_bytecode_languaget>(); }
337336

338337
std::string id() const override { return "java"; }
339338
std::string description() const override { return "Java Bytecode"; }

jbmc/src/java_bytecode/java_qualifiers.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#include <sstream>
99
#include <iterator>
1010

11-
#include <util/make_unique.h>
12-
1311
#include "expr2java.h"
1412

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

2523
std::unique_ptr<qualifierst> java_qualifierst::clone() const
2624
{
27-
auto other = util_make_unique<java_qualifierst>(ns);
25+
auto other = std::make_unique<java_qualifierst>(ns);
2826
*other = *this;
2927
return std::move(other);
3028
}

jbmc/src/jbmc/jbmc_parse_options.cpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Author: Daniel Kroening, [email protected]
1414
#include <util/config.h>
1515
#include <util/exit_codes.h>
1616
#include <util/invariant.h>
17-
#include <util/make_unique.h>
1817
#include <util/version.h>
1918
#include <util/xml.h>
2019

@@ -523,7 +522,7 @@ int jbmc_parse_optionst::doit()
523522
options.get_bool_option("stop-on-fail") && options.get_bool_option("paths"))
524523
{
525524
verifier =
526-
util_make_unique<stop_on_fail_verifiert<java_single_path_symex_checkert>>(
525+
std::make_unique<stop_on_fail_verifiert<java_single_path_symex_checkert>>(
527526
options, ui_message_handler, *goto_model_ptr);
528527
}
529528
else if(
@@ -533,13 +532,13 @@ int jbmc_parse_optionst::doit()
533532
if(options.get_bool_option("localize-faults"))
534533
{
535534
verifier =
536-
util_make_unique<stop_on_fail_verifier_with_fault_localizationt<
535+
std::make_unique<stop_on_fail_verifier_with_fault_localizationt<
537536
java_multi_path_symex_checkert>>(
538537
options, ui_message_handler, *goto_model_ptr);
539538
}
540539
else
541540
{
542-
verifier = util_make_unique<
541+
verifier = std::make_unique<
543542
stop_on_fail_verifiert<java_multi_path_symex_checkert>>(
544543
options, ui_message_handler, *goto_model_ptr);
545544
}
@@ -548,7 +547,7 @@ int jbmc_parse_optionst::doit()
548547
!options.get_bool_option("stop-on-fail") &&
549548
options.get_bool_option("paths"))
550549
{
551-
verifier = util_make_unique<all_properties_verifier_with_trace_storaget<
550+
verifier = std::make_unique<all_properties_verifier_with_trace_storaget<
552551
java_single_path_symex_checkert>>(
553552
options, ui_message_handler, *goto_model_ptr);
554553
}
@@ -559,13 +558,13 @@ int jbmc_parse_optionst::doit()
559558
if(options.get_bool_option("localize-faults"))
560559
{
561560
verifier =
562-
util_make_unique<all_properties_verifier_with_fault_localizationt<
561+
std::make_unique<all_properties_verifier_with_fault_localizationt<
563562
java_multi_path_symex_checkert>>(
564563
options, ui_message_handler, *goto_model_ptr);
565564
}
566565
else
567566
{
568-
verifier = util_make_unique<all_properties_verifier_with_trace_storaget<
567+
verifier = std::make_unique<all_properties_verifier_with_trace_storaget<
569568
java_multi_path_symex_checkert>>(
570569
options, ui_message_handler, *goto_model_ptr);
571570
}
@@ -591,7 +590,7 @@ int jbmc_parse_optionst::get_goto_program(
591590
lazy_goto_model.initialize(cmdline.args, options);
592591

593592
class_hierarchy =
594-
util_make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
593+
std::make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
595594

596595
// Show the class hierarchy
597596
if(cmdline.isset("show-class-hierarchy"))
@@ -650,7 +649,7 @@ int jbmc_parse_optionst::get_goto_program(
650649
}
651650

652651
goto_model_ptr =
653-
util_make_unique<lazy_goto_modelt>(std::move(lazy_goto_model));
652+
std::make_unique<lazy_goto_modelt>(std::move(lazy_goto_model));
654653
}
655654

656655
log.status() << config.object_bits_info() << messaget::eom;

src/analyses/ai.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ Author: Daniel Kroening, [email protected]
5050

5151
#include <util/deprecate.h>
5252
#include <util/json.h>
53-
#include <util/make_unique.h>
5453
#include <util/message.h>
5554
#include <util/xml.h>
5655

@@ -566,20 +565,20 @@ class ait : public ai_recursive_interproceduralt
566565
// constructor
567566
ait()
568567
: ai_recursive_interproceduralt(
569-
util_make_unique<
568+
std::make_unique<
570569
ai_history_factory_default_constructort<ahistoricalt>>(),
571-
util_make_unique<ai_domain_factory_default_constructort<domainT>>(),
572-
util_make_unique<location_sensitive_storaget>(),
570+
std::make_unique<ai_domain_factory_default_constructort<domainT>>(),
571+
std::make_unique<location_sensitive_storaget>(),
573572
no_logging)
574573
{
575574
}
576575

577576
explicit ait(std::unique_ptr<ai_domain_factory_baset> &&df)
578577
: ai_recursive_interproceduralt(
579-
util_make_unique<
578+
std::make_unique<
580579
ai_history_factory_default_constructort<ahistoricalt>>(),
581580
std::move(df),
582-
util_make_unique<location_sensitive_storaget>(),
581+
std::make_unique<location_sensitive_storaget>(),
583582
no_logging)
584583
{
585584
}

src/analyses/ai_domain.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Author: Daniel Kroening, [email protected]
4141
#define CPROVER_ANALYSES_AI_DOMAIN_H
4242

4343
#include <util/json.h>
44-
#include <util/make_unique.h>
4544
#include <util/xml.h>
4645

4746
#include "ai_history.h"
@@ -202,7 +201,7 @@ class ai_domain_factoryt : public ai_domain_factory_baset
202201

203202
std::unique_ptr<statet> copy(const statet &s) const override
204203
{
205-
return util_make_unique<domainT>(static_cast<const domainT &>(s));
204+
return std::make_unique<domainT>(static_cast<const domainT &>(s));
206205
}
207206

208207
bool merge(statet &dest, const statet &src, trace_ptrt from, trace_ptrt to)
@@ -225,7 +224,7 @@ class ai_domain_factory_default_constructort
225224

226225
std::unique_ptr<statet> make(locationt l) const override
227226
{
228-
auto d = util_make_unique<domainT>();
227+
auto d = std::make_unique<domainT>();
229228
CHECK_RETURN(d->is_bottom());
230229
return std::unique_ptr<statet>(d.release());
231230
}

src/analyses/dependence_graph.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ class dep_graph_domain_factoryt : public ai_domain_factoryt<dep_graph_domaint>
349349
{
350350
auto node_id = dg.add_node();
351351
dg.nodes[node_id].PC = l;
352-
auto p = util_make_unique<dep_graph_domaint>(node_id);
352+
auto p = std::make_unique<dep_graph_domaint>(node_id);
353353
CHECK_RETURN(p->is_bottom());
354354

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

362362
dependence_grapht::dependence_grapht(const namespacet &_ns)
363-
: ait<dep_graph_domaint>(util_make_unique<dep_graph_domain_factoryt>(*this)),
363+
: ait<dep_graph_domaint>(std::make_unique<dep_graph_domain_factoryt>(*this)),
364364
ns(_ns),
365365
rd(ns)
366366
{

src/analyses/goto_rw.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Date: April 2010
1717
#include <util/byte_operators.h>
1818
#include <util/endianness_map.h>
1919
#include <util/expr_util.h>
20-
#include <util/make_unique.h>
2120
#include <util/pointer_expr.h>
2221
#include <util/pointer_offset_size.h>
2322
#include <util/simplify_expr.h>
@@ -529,7 +528,7 @@ void rw_range_sett::add(
529528
.first;
530529

531530
if(entry->second==nullptr)
532-
entry->second=util_make_unique<range_domaint>();
531+
entry->second=std::make_unique<range_domaint>();
533532

534533
static_cast<range_domaint&>(*entry->second).push_back(
535534
{range_start, range_end});
@@ -767,7 +766,7 @@ void rw_guarded_range_set_value_sett::add(
767766
.first;
768767

769768
if(entry->second==nullptr)
770-
entry->second=util_make_unique<guarded_range_domaint>();
769+
entry->second=std::make_unique<guarded_range_domaint>();
771770

772771
static_cast<guarded_range_domaint&>(*entry->second).insert(
773772
{range_start, {range_end, guard.as_expr()}});

src/analyses/invariant_propagation.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class invariant_set_domain_factoryt
2525

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

@@ -40,7 +40,7 @@ invariant_propagationt::invariant_propagationt(
4040
const namespacet &_ns,
4141
value_setst &_value_sets)
4242
: ait<invariant_set_domaint>(
43-
util_make_unique<invariant_set_domain_factoryt>(*this)),
43+
std::make_unique<invariant_set_domain_factoryt>(*this)),
4444
ns(_ns),
4545
value_sets(_value_sets),
4646
object_store(_ns)

src/analyses/local_may_alias.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Author: Daniel Kroening, [email protected]
1616
#include <stack>
1717

1818
#include <util/union_find.h>
19-
#include <util/make_unique.h>
2019

2120
#include "locals.h"
2221
#include "dirty.h"
@@ -120,7 +119,7 @@ class local_may_alias_factoryt
120119
goto_functionst::function_mapt::const_iterator f_it2=
121120
goto_functions->function_map.find(fkt);
122121
CHECK_RETURN(f_it2!=goto_functions->function_map.end());
123-
return *(fkt_map[fkt]=util_make_unique<local_may_aliast>(f_it2->second));
122+
return *(fkt_map[fkt]=std::make_unique<local_may_aliast>(f_it2->second));
124123
}
125124

126125
local_may_aliast &operator()(goto_programt::const_targett t)

src/analyses/reaching_definitions.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Date: February 2013
1818
#include <memory>
1919

2020
#include <util/base_exceptions.h>
21-
#include <util/make_unique.h>
2221
#include <util/pointer_offset_size.h>
2322

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

4241
std::unique_ptr<statet> make(locationt) const override
4342
{
44-
auto p = util_make_unique<rd_range_domaint>(bv_container);
43+
auto p = std::make_unique<rd_range_domaint>(bv_container);
4544
CHECK_RETURN(p->is_bottom());
4645
return std::unique_ptr<statet>(p.release());
4746
}
@@ -53,7 +52,7 @@ class rd_range_domain_factoryt : public ai_domain_factoryt<rd_range_domaint>
5352
reaching_definitions_analysist::reaching_definitions_analysist(
5453
const namespacet &_ns)
5554
: concurrency_aware_ait<rd_range_domaint>(
56-
util_make_unique<rd_range_domain_factoryt>(this)),
55+
std::make_unique<rd_range_domain_factoryt>(this)),
5756
ns(_ns)
5857
{
5958
}
@@ -734,13 +733,13 @@ const rd_range_domaint::ranges_at_loct &rd_range_domaint::get(
734733
void reaching_definitions_analysist::initialize(
735734
const goto_functionst &goto_functions)
736735
{
737-
auto value_sets_=util_make_unique<value_set_analysis_fit>(ns);
736+
auto value_sets_=std::make_unique<value_set_analysis_fit>(ns);
738737
(*value_sets_)(goto_functions);
739738
value_sets=std::move(value_sets_);
740739

741-
is_threaded=util_make_unique<is_threadedt>(goto_functions);
740+
is_threaded=std::make_unique<is_threadedt>(goto_functions);
742741

743-
is_dirty=util_make_unique<dirtyt>(goto_functions);
742+
is_dirty=std::make_unique<dirtyt>(goto_functions);
744743

745744
concurrency_aware_ait<rd_range_domaint>::initialize(goto_functions);
746745
}

src/analyses/static_analysis.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ Author: Daniel Kroening, [email protected]
2121
#include <memory>
2222
#include <unordered_set>
2323

24-
#include <util/make_unique.h>
25-
2624
#include <goto-programs/goto_functions.h>
2725

2826
// don't use me -- I am just a base class
@@ -345,7 +343,7 @@ class static_analysist:public static_analysis_baset
345343

346344
virtual std::unique_ptr<statet> make_temporary_state(statet &s)
347345
{
348-
return util_make_unique<T>(static_cast<T &>(s));
346+
return std::make_unique<T>(static_cast<T &>(s));
349347
}
350348

351349
virtual void generate_state(locationt l)

src/analyses/variable-sensitivity/abstract_value_object.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <util/arith_tools.h>
1919
#include <util/bitvector_types.h>
2020
#include <util/ieee_float.h>
21-
#include <util/make_unique.h>
2221
#include <util/simplify_expr.h>
2322

2423
#include <algorithm>
@@ -75,12 +74,12 @@ bool single_value_index_ranget::advance_to_next()
7574

7675
index_range_implementation_ptrt make_empty_index_range()
7776
{
78-
return util_make_unique<empty_index_ranget>();
77+
return std::make_unique<empty_index_ranget>();
7978
}
8079

8180
index_range_implementation_ptrt make_indeterminate_index_range()
8281
{
83-
return util_make_unique<indeterminate_index_ranget>();
82+
return std::make_unique<indeterminate_index_ranget>();
8483
}
8584

8685
class single_value_value_ranget : public value_range_implementationt
@@ -114,7 +113,7 @@ class single_value_value_ranget : public value_range_implementationt
114113
value_range_implementation_ptrt
115114
make_single_value_range(const abstract_object_pointert &value)
116115
{
117-
return util_make_unique<single_value_value_ranget>(value);
116+
return std::make_unique<single_value_value_ranget>(value);
118117
}
119118

120119
static abstract_object_pointert constants_expression_transform(

src/analyses/variable-sensitivity/abstract_value_object.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class empty_value_ranget : public value_range_implementationt
229229
}
230230
value_range_implementation_ptrt reset() const override
231231
{
232-
return util_make_unique<empty_value_ranget>();
232+
return std::make_unique<empty_value_ranget>();
233233
}
234234

235235
private:

src/analyses/variable-sensitivity/constant_abstract_value.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class constant_index_ranget : public single_value_index_ranget
3434
static index_range_implementation_ptrt
3535
make_constant_index_range(const exprt &val)
3636
{
37-
return util_make_unique<constant_index_ranget>(val);
37+
return std::make_unique<constant_index_ranget>(val);
3838
}
3939

4040
constant_abstract_valuet::constant_abstract_valuet(const typet &t)

src/analyses/variable-sensitivity/interval_abstract_value.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <util/bitvector_types.h>
1313
#include <util/expr_util.h>
1414
#include <util/invariant.h>
15-
#include <util/make_unique.h>
1615
#include <util/simplify_expr.h>
1716

1817
#include "abstract_environment.h"
@@ -72,7 +71,7 @@ static index_range_implementation_ptrt make_interval_index_range(
7271
const constant_interval_exprt &interval,
7372
const namespacet &n)
7473
{
75-
return util_make_unique<interval_index_ranget>(interval, n);
74+
return std::make_unique<interval_index_ranget>(interval, n);
7675
}
7776

7877
static inline bool

0 commit comments

Comments
 (0)