Skip to content

Commit 10d922c

Browse files
Merge pull request #8089 from thomasspriggs/tas/smt_stl
Use the STL versions of `variant` and `optional` in incremental smt2 decision procedure
2 parents c0fe5a8 + 062d6c6 commit 10d922c

15 files changed

+46
-57
lines changed

src/solvers/smt2_incremental/ast/smt_commands.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class smt_commandt : protected irept
1515
{
1616
public:
1717
// smt_commandt does not support the notion of an empty / null state. Use
18-
// optionalt<smt_commandt> instead if an empty command is required.
18+
// std::optional<smt_commandt> instead if an empty command is required.
1919
smt_commandt() = delete;
2020

2121
using irept::pretty;

src/solvers/smt2_incremental/ast/smt_index.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class smt_indext : protected irept
1414
{
1515
public:
1616
// smt_indext does not support the notion of an empty / null state. Use
17-
// optionalt<smt_indext> instead if an empty index is required.
17+
// std::optional<smt_indext> instead if an empty index is required.
1818
smt_indext() = delete;
1919

2020
using irept::pretty;

src/solvers/smt2_incremental/ast/smt_logics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class smt_logict : protected irept
1111
{
1212
public:
1313
// smt_logict does not support the notion of an empty / null state. Use
14-
// optionalt<smt_logict> instead if an empty logic is required.
14+
// std::optional<smt_logict> instead if an empty logic is required.
1515
smt_logict() = delete;
1616

1717
using irept::pretty;

src/solvers/smt2_incremental/ast/smt_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class smt_optiont : protected irept
1111
{
1212
public:
1313
// smt_optiont does not support the notion of an empty / null state. Use
14-
// optionalt<smt_optiont> instead if an empty option is required.
14+
// std::optional<smt_optiont> instead if an empty option is required.
1515
smt_optiont() = delete;
1616

1717
using irept::pretty;

src/solvers/smt2_incremental/ast/smt_responses.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class smt_responset : protected irept
1111
{
1212
public:
1313
// smt_responset does not support the notion of an empty / null state. Use
14-
// optionalt<smt_responset> instead if an empty response is required.
14+
// std::optional<smt_responset> instead if an empty response is required.
1515
smt_responset() = delete;
1616

1717
using irept::pretty;
@@ -36,7 +36,7 @@ class smt_check_sat_response_kindt : protected irept
3636
{
3737
public:
3838
// smt_responset does not support the notion of an empty / null state. Use
39-
// optionalt<smt_responset> instead if an empty response is required.
39+
// std::optional<smt_responset> instead if an empty response is required.
4040
smt_check_sat_response_kindt() = delete;
4141

4242
using irept::pretty;

src/solvers/smt2_incremental/ast/smt_sorts.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
#define SORT_ID(the_id) \
2626
template <> \
27-
optionalt<smt_##the_id##_sortt> smt_sortt::cast<smt_##the_id##_sortt>() && \
27+
std::optional<smt_##the_id##_sortt> smt_sortt::cast<smt_##the_id##_sortt>() \
28+
&& \
2829
{ \
2930
if(id() == ID_smt_##the_id##_sort) \
3031
return {std::move(*static_cast<const smt_##the_id##_sortt *>(this))}; \

src/solvers/smt2_incremental/ast/smt_sorts.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#define CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_SORTS_H
99

1010
#include <util/irep.h>
11-
#include <util/optional.h>
1211

12+
#include <optional>
1313
#include <type_traits>
1414

1515
class smt_sort_const_downcast_visitort;
@@ -18,7 +18,7 @@ class smt_sortt : protected irept
1818
{
1919
public:
2020
// smt_sortt does not support the notion of an empty / null state. Use
21-
// optionalt<smt_sortt> instead if an empty sort is required.
21+
// std::optional<smt_sortt> instead if an empty sort is required.
2222
smt_sortt() = delete;
2323

2424
using irept::pretty;
@@ -47,7 +47,7 @@ class smt_sortt : protected irept
4747
const sub_classt *cast() const &;
4848

4949
template <typename sub_classt>
50-
optionalt<sub_classt> cast() &&;
50+
std::optional<sub_classt> cast() &&;
5151

5252
protected:
5353
using irept::irept;

src/solvers/smt2_incremental/ast/smt_terms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class smt_termt : protected irept, private smt_sortt::storert<smt_termt>
2121
{
2222
public:
2323
// smt_termt does not support the notion of an empty / null state. Use
24-
// optionalt<smt_termt> instead if an empty term is required.
24+
// std::optional<smt_termt> instead if an empty term is required.
2525
smt_termt() = delete;
2626

2727
using irept::pretty;

src/solvers/smt2_incremental/construct_value_expr_from_smt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class value_expr_from_smt_factoryt : public smt_term_const_downcast_visitort
1616
private:
1717
const typet &type_to_construct;
1818
const namespacet &ns;
19-
optionalt<exprt> result;
19+
std::optional<exprt> result;
2020

2121
explicit value_expr_from_smt_factoryt(
2222
const typet &type_to_construct,

src/solvers/smt2_incremental/convert_expr_to_smt.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ struct sort_based_cast_to_bit_vector_convertert final
206206
const smt_termt &from_term;
207207
const typet &from_type;
208208
const bitvector_typet &to_type;
209-
optionalt<smt_termt> result;
209+
std::optional<smt_termt> result;
210210

211211
sort_based_cast_to_bit_vector_convertert(
212212
const smt_termt &from_term,
@@ -299,7 +299,7 @@ static smt_termt convert_expr_to_smt(
299299
struct sort_based_literal_convertert : public smt_sort_const_downcast_visitort
300300
{
301301
const constant_exprt &member_input;
302-
optionalt<smt_termt> result;
302+
std::optional<smt_termt> result;
303303

304304
explicit sort_based_literal_convertert(const constant_exprt &input)
305305
: member_input{input}
@@ -591,7 +591,7 @@ static smt_termt convert_relational_to_smt(
591591
binary_relation.pretty());
592592
}
593593

594-
static optionalt<smt_termt> try_relational_conversion(
594+
static std::optional<smt_termt> try_relational_conversion(
595595
const exprt &expr,
596596
const sub_expression_mapt &converted)
597597
{

0 commit comments

Comments
 (0)