11/* ******************************************************************\
22
3- Module:
3+ Module: Pre-defined types
44
55Author: Daniel Kroening, kroening@kroening.com
6+ Maria Svorenova, maria.svorenova@diffblue.com
67
78\*******************************************************************/
89
10+ // / \file
11+ // / Pre-defined types
12+
913#include " std_types.h"
1014
1115#include " string2int.h"
@@ -26,6 +30,7 @@ std::size_t floatbv_typet::get_f() const
2630 return unsafe_string2unsigned (id2string (f));
2731}
2832
33+ // / Return the sequence number of the component with given name.
2934std::size_t struct_union_typet::component_number (
3035 const irep_idt &component_name) const
3136{
@@ -48,6 +53,7 @@ std::size_t struct_union_typet::component_number(
4853 return 0 ;
4954}
5055
56+ // / Get the reference to a component with given name.
5157const struct_union_typet::componentt &struct_union_typet::get_component (
5258 const irep_idt &component_name) const
5359{
@@ -73,6 +79,10 @@ typet struct_union_typet::component_type(
7379 return c.type ();
7480}
7581
82+ // / Returns true if the struct is a prefix of \a other, i.e., if this struct
83+ // / has n components then the component types and names of this struct must
84+ // / match the first n components of \a other struct.
85+ // / \param other Struct type to compare with.
7686bool struct_typet::is_prefix_of (const struct_typet &other) const
7787{
7888 const componentst &ot_components=other.components ();
@@ -102,12 +112,14 @@ bool struct_typet::is_prefix_of(const struct_typet &other) const
102112 return true ; // ok, *this is a prefix of ot
103113}
104114
115+ // / Returns true if the type is a reference.
105116bool is_reference (const typet &type)
106117{
107118 return type.id ()==ID_pointer &&
108119 type.get_bool (ID_C_reference);
109120}
110121
122+ // / Returns if the type is an R value reference.
111123bool is_rvalue_reference (const typet &type)
112124{
113125 return type.id ()==ID_pointer &&
0 commit comments