Skip to content

Commit d3a190f

Browse files
committed
Remove macro-definition of unsigned_less_than_or_equalt from X-macro.
And substitute it with a concrete class implementation.
1 parent 817d995 commit d3a190f

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

src/solvers/smt2_incremental/smt_bit_vector_theory.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ static void validate_bit_vector_predicate_arguments(
4343
#include "smt_bit_vector_theory.def"
4444
#undef SMT_BITVECTOR_THEORY_PREDICATE
4545

46+
// Relational operator definitions
47+
4648
const char *smt_bit_vector_theoryt::unsigned_less_thant::identifier()
4749
{
4850
return "bvult";
@@ -65,3 +67,26 @@ void smt_bit_vector_theoryt::unsigned_less_thant::validate(
6567
const smt_function_application_termt::factoryt<
6668
smt_bit_vector_theoryt::unsigned_less_thant>
6769
smt_bit_vector_theoryt::unsigned_less_than{};
70+
71+
const char *smt_bit_vector_theoryt::unsigned_less_than_or_equalt::identifier()
72+
{
73+
return "bvule";
74+
}
75+
76+
smt_sortt smt_bit_vector_theoryt::unsigned_less_than_or_equalt::return_sort(
77+
const smt_termt &lhs,
78+
const smt_termt &rhs)
79+
{
80+
return smt_bool_sortt{};
81+
}
82+
83+
void smt_bit_vector_theoryt::unsigned_less_than_or_equalt::validate(
84+
const smt_termt &lhs,
85+
const smt_termt &rhs)
86+
{
87+
validate_bit_vector_predicate_arguments(lhs, rhs);
88+
}
89+
90+
const smt_function_application_termt::factoryt<
91+
smt_bit_vector_theoryt::unsigned_less_than_or_equalt>
92+
smt_bit_vector_theoryt::unsigned_less_than_or_equal{};

src/solvers/smt2_incremental/smt_bit_vector_theory.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/// [X-macro](https://en.wikipedia.org/wiki/X_Macro) pattern. These define the
44
/// set of bitvector theory functions which are implemented and it is used to
55
/// automate repetitive parts of the implementation.
6-
SMT_BITVECTOR_THEORY_PREDICATE(bvule, unsigned_less_than_or_equal)
76
SMT_BITVECTOR_THEORY_PREDICATE(bvugt, unsigned_greater_than)
87
SMT_BITVECTOR_THEORY_PREDICATE(bvuge, unsigned_greater_than_or_equal)
98
SMT_BITVECTOR_THEORY_PREDICATE(bvslt, signed_less_than)

src/solvers/smt2_incremental/smt_bit_vector_theory.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class smt_bit_vector_theoryt
2121
#include "smt_bit_vector_theory.def"
2222
#undef SMT_BITVECTOR_THEORY_PREDICATE
2323

24+
// Relational operator class declarations
2425
struct unsigned_less_thant final
2526
{
2627
static const char *identifier();
@@ -29,6 +30,16 @@ class smt_bit_vector_theoryt
2930
};
3031
static const smt_function_application_termt::factoryt<unsigned_less_thant>
3132
unsigned_less_than;
33+
34+
struct unsigned_less_than_or_equalt final
35+
{
36+
static const char *identifier();
37+
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs);
38+
static void validate(const smt_termt &lhs, const smt_termt &rhs);
39+
};
40+
static const smt_function_application_termt::factoryt<
41+
unsigned_less_than_or_equalt>
42+
unsigned_less_than_or_equal;
3243
};
3344

3445
#endif // CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_BIT_VECTOR_THEORY_H

0 commit comments

Comments
 (0)