Skip to content

Commit d44cdcd

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

File tree

58 files changed

+186
-253
lines changed

Some content is hidden

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

58 files changed

+186
-253
lines changed

jbmc/src/janalyzer/janalyzer_parse_options.cpp

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

398398
class_hierarchy =
399-
util_make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
399+
std::make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
400400

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

jbmc/src/java_bytecode/java_bytecode_language.cpp

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

15181518
std::unique_ptr<languaget> new_java_bytecode_language()
15191519
{
1520-
return util_make_unique<java_bytecode_languaget>();
1520+
return std::make_unique<java_bytecode_languaget>();
15211521
}
15221522

15231523
bool java_bytecode_languaget::from_expr(

jbmc/src/java_bytecode/java_bytecode_language.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Author: Daniel Kroening, [email protected]
1111
#define CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_LANGUAGE_H
1212

1313
#include <util/json.h>
14-
#include <util/make_unique.h>
1514
#include <util/prefix_filter.h>
1615
#include <util/symbol.h> // IWYU pragma: keep
1716

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

321320
std::unique_ptr<languaget> new_language() override
322-
{ return util_make_unique<java_bytecode_languaget>(); }
321+
{
322+
return std::make_unique<java_bytecode_languaget>();
323+
}
323324

324325
std::string id() const override { return "java"; }
325326
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
@@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
1515
#include <util/exit_codes.h>
1616
#include <util/help_formatter.h>
1717
#include <util/invariant.h>
18-
#include <util/make_unique.h>
1918
#include <util/version.h>
2019
#include <util/xml.h>
2120

@@ -535,7 +534,7 @@ int jbmc_parse_optionst::doit()
535534
options.get_bool_option("stop-on-fail") && options.get_bool_option("paths"))
536535
{
537536
verifier =
538-
util_make_unique<stop_on_fail_verifiert<java_single_path_symex_checkert>>(
537+
std::make_unique<stop_on_fail_verifiert<java_single_path_symex_checkert>>(
539538
options, ui_message_handler, *goto_model_ptr);
540539
}
541540
else if(
@@ -545,13 +544,13 @@ int jbmc_parse_optionst::doit()
545544
if(options.get_bool_option("localize-faults"))
546545
{
547546
verifier =
548-
util_make_unique<stop_on_fail_verifier_with_fault_localizationt<
547+
std::make_unique<stop_on_fail_verifier_with_fault_localizationt<
549548
java_multi_path_symex_checkert>>(
550549
options, ui_message_handler, *goto_model_ptr);
551550
}
552551
else
553552
{
554-
verifier = util_make_unique<
553+
verifier = std::make_unique<
555554
stop_on_fail_verifiert<java_multi_path_symex_checkert>>(
556555
options, ui_message_handler, *goto_model_ptr);
557556
}
@@ -560,7 +559,7 @@ int jbmc_parse_optionst::doit()
560559
!options.get_bool_option("stop-on-fail") &&
561560
options.get_bool_option("paths"))
562561
{
563-
verifier = util_make_unique<all_properties_verifier_with_trace_storaget<
562+
verifier = std::make_unique<all_properties_verifier_with_trace_storaget<
564563
java_single_path_symex_checkert>>(
565564
options, ui_message_handler, *goto_model_ptr);
566565
}
@@ -571,13 +570,13 @@ int jbmc_parse_optionst::doit()
571570
if(options.get_bool_option("localize-faults"))
572571
{
573572
verifier =
574-
util_make_unique<all_properties_verifier_with_fault_localizationt<
573+
std::make_unique<all_properties_verifier_with_fault_localizationt<
575574
java_multi_path_symex_checkert>>(
576575
options, ui_message_handler, *goto_model_ptr);
577576
}
578577
else
579578
{
580-
verifier = util_make_unique<all_properties_verifier_with_trace_storaget<
579+
verifier = std::make_unique<all_properties_verifier_with_trace_storaget<
581580
java_multi_path_symex_checkert>>(
582581
options, ui_message_handler, *goto_model_ptr);
583582
}
@@ -603,7 +602,7 @@ int jbmc_parse_optionst::get_goto_program(
603602
lazy_goto_model.initialize(cmdline.args, options);
604603

605604
class_hierarchy =
606-
util_make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
605+
std::make_unique<class_hierarchyt>(lazy_goto_model.symbol_table);
607606

608607
// Show the class hierarchy
609608
if(cmdline.isset("show-class-hierarchy"))
@@ -662,7 +661,7 @@ int jbmc_parse_optionst::get_goto_program(
662661
}
663662

664663
goto_model_ptr =
665-
util_make_unique<lazy_goto_modelt>(std::move(lazy_goto_model));
664+
std::make_unique<lazy_goto_modelt>(std::move(lazy_goto_model));
666665
}
667666

668667
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

@@ -565,20 +564,20 @@ class ait : public ai_recursive_interproceduralt
565564
// constructor
566565
ait()
567566
: ai_recursive_interproceduralt(
568-
util_make_unique<
567+
std::make_unique<
569568
ai_history_factory_default_constructort<ahistoricalt>>(),
570-
util_make_unique<ai_domain_factory_default_constructort<domainT>>(),
571-
util_make_unique<location_sensitive_storaget>(),
569+
std::make_unique<ai_domain_factory_default_constructort<domainT>>(),
570+
std::make_unique<location_sensitive_storaget>(),
572571
no_logging)
573572
{
574573
}
575574

576575
explicit ait(std::unique_ptr<ai_domain_factory_baset> &&df)
577576
: ai_recursive_interproceduralt(
578-
util_make_unique<
577+
std::make_unique<
579578
ai_history_factory_default_constructort<ahistoricalt>>(),
580579
std::move(df),
581-
util_make_unique<location_sensitive_storaget>(),
580+
std::make_unique<location_sensitive_storaget>(),
582581
no_logging)
583582
{
584583
}

src/analyses/ai_domain.h

+3-4
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"
@@ -206,7 +205,7 @@ class ai_domain_factoryt : public ai_domain_factory_baset
206205

207206
std::unique_ptr<statet> copy(const statet &s) const override
208207
{
209-
return util_make_unique<domainT>(static_cast<const domainT &>(s));
208+
return std::make_unique<domainT>(static_cast<const domainT &>(s));
210209
}
211210

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

230229
std::unique_ptr<statet> make(locationt l) const override
231230
{
232-
auto d = util_make_unique<domainT>();
231+
auto d = std::make_unique<domainT>();
233232
CHECK_RETURN(d->is_bottom());
234233
return std::unique_ptr<statet>(d.release());
235234
}
@@ -246,7 +245,7 @@ class ai_domain_factory_location_constructort
246245

247246
std::unique_ptr<statet> make(locationt l) const override
248247
{
249-
auto d = util_make_unique<domainT>(l);
248+
auto d = std::make_unique<domainT>(l);
250249
CHECK_RETURN(d->is_bottom());
251250
return std::unique_ptr<statet>(d.release());
252251
}

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
@@ -15,7 +15,6 @@ Date: April 2010
1515
#include <util/byte_operators.h>
1616
#include <util/endianness_map.h>
1717
#include <util/expr_util.h>
18-
#include <util/make_unique.h>
1918
#include <util/namespace.h>
2019
#include <util/pointer_expr.h>
2120
#include <util/pointer_offset_size.h>
@@ -528,7 +527,7 @@ void rw_range_sett::add(
528527
.first;
529528

530529
if(entry->second==nullptr)
531-
entry->second=util_make_unique<range_domaint>();
530+
entry->second = std::make_unique<range_domaint>();
532531

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

768767
if(entry->second==nullptr)
769-
entry->second=util_make_unique<guarded_range_domaint>();
768+
entry->second = std::make_unique<guarded_range_domaint>();
770769

771770
static_cast<guarded_range_domaint&>(*entry->second).insert(
772771
{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
@@ -16,7 +16,6 @@ Date: February 2013
1616
#include "reaching_definitions.h"
1717

1818
#include <util/base_exceptions.h> // IWYU pragma: keep
19-
#include <util/make_unique.h>
2019
#include <util/pointer_offset_size.h>
2120

2221
#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/variable-sensitivity/abstract_value_object.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <util/arith_tools.h>
1010
#include <util/bitvector_types.h>
1111
#include <util/ieee_float.h>
12-
#include <util/make_unique.h>
1312
#include <util/simplify_expr.h>
1413

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

7776
index_range_implementation_ptrt make_empty_index_range()
7877
{
79-
return util_make_unique<empty_index_ranget>();
78+
return std::make_unique<empty_index_ranget>();
8079
}
8180

8281
index_range_implementation_ptrt make_indeterminate_index_range()
8382
{
84-
return util_make_unique<indeterminate_index_ranget>();
83+
return std::make_unique<indeterminate_index_ranget>();
8584
}
8685

8786
class single_value_value_ranget : public value_range_implementationt
@@ -115,7 +114,7 @@ class single_value_value_ranget : public value_range_implementationt
115114
value_range_implementation_ptrt
116115
make_single_value_range(const abstract_object_pointert &value)
117116
{
118-
return util_make_unique<single_value_value_ranget>(value);
117+
return std::make_unique<single_value_value_ranget>(value);
119118
}
120119

121120
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 exprt &e)

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)