CBMC
smt_object_size.cpp
Go to the documentation of this file.
1 // Author: Diffblue Ltd.
2 
3 #include "smt_object_size.h"
4 
5 #include <util/c_types.h>
6 #include <util/config.h>
7 
11 
13 {
16  "size_of_object", convert_type_to_smt_sort(size_type())},
18 }
19 
22  make_application{smt_command_functiont{declaration}}
23 {
24 }
25 
27  const std::size_t unique_id,
28  smt_termt size) const
29 {
30  const auto id_sort =
31  declaration.parameter_sorts().at(0).get().cast<smt_bit_vector_sortt>();
32  INVARIANT(id_sort, "Object identifiers are expected to have bit vector sort");
33  const auto bit_vector_of_id =
34  smt_bit_vector_constant_termt{unique_id, *id_sort};
36  make_application(std::vector<smt_termt>{bit_vector_of_id}),
37  std::move(size))};
38 }
configt config
Definition: config.cpp:25
struct configt::bv_encodingt bv_encoding
A function generated from a command.
Definition: smt_commands.h:147
static const smt_function_application_termt::factoryt< equalt > equal
std::vector< std::reference_wrapper< const smt_sortt > > parameter_sorts() const
Stores identifiers in unescaped and unquoted form.
Definition: smt_terms.h:93
static smt_sortt convert_type_to_smt_sort(const bool_typet &type)
static smt_declare_function_commandt make_object_size_function_declaration()
Data structure for smt sorts.
std::size_t object_bits
Definition: config.h:355
make_applicationt make_application
smt_commandt make_definition(std::size_t unique_id, smt_termt size) const
Makes the command to define the resulting size of calling the object size function with unique_id.
smt_declare_function_commandt declaration
The command for declaring the object size function.
#define size_type
Definition: unistd.c:347