CBMC
smt_logics.cpp
Go to the documentation of this file.
1 // Author: Diffblue Ltd.
2 
4 
5 // Define the irep_idts for logics.
6 #define LOGIC_ID(the_id, the_name) \
7  const irep_idt ID_smt_logic_##the_id{"smt_logic_" #the_id};
8 #include <solvers/smt2_incremental/smt_logics.def>
9 #undef LOGIC_ID
10 
11 bool smt_logict::operator==(const smt_logict &other) const
12 {
13  return irept::operator==(other);
14 }
15 
16 bool smt_logict::operator!=(const smt_logict &other) const
17 {
18  return !(*this == other);
19 }
20 
21 template <typename visitort>
22 void accept(const smt_logict &logic, const irep_idt &id, visitort &&visitor)
23 {
24 #define LOGIC_ID(the_id, the_name) \
25  if(id == ID_smt_logic_##the_id) \
26  return visitor.visit(static_cast<const smt_logic_##the_id##t &>(logic));
27 // The include below is marked as nolint because including the same file
28 // multiple times is required as part of the x macro pattern.
29 #include <solvers/smt2_incremental/smt_logics.def> // NOLINT(build/include)
30 #undef LOGIC_ID
32 }
33 
35 {
36  ::accept(*this, id(), visitor);
37 }
38 
40 {
41  ::accept(*this, id(), std::move(visitor));
42 }
43 
44 #define LOGIC_ID(the_id, the_name) \
45  smt_logic_##the_id##t::smt_logic_##the_id##t() \
46  : smt_logict{ID_smt_logic_##the_id} \
47  { \
48  }
49 #include "smt_logics.def"
50 #undef LOGIC_ID
UNREACHABLE
#define UNREACHABLE
This should be used to mark dead code.
Definition: invariant.h:503
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
smt_logic_const_downcast_visitort
Definition: smt_logics.h:74
smt_logict::accept
void accept(smt_logic_const_downcast_visitort &) const
Definition: smt_logics.cpp:34
smt_logict::operator==
bool operator==(const smt_logict &) const
Definition: smt_logics.cpp:11
accept
void accept(const smt_logict &logic, const irep_idt &id, visitort &&visitor)
Definition: smt_logics.cpp:22
irept::operator==
bool operator==(const irept &other) const
Definition: irep.cpp:146
smt_logics.h
smt_logict
Definition: smt_logics.h:10
smt_logict::operator!=
bool operator!=(const smt_logict &) const
Definition: smt_logics.cpp:16