1
1
/* ******************************************************************\
2
2
3
- Module:
3
+ Module: Pre-defined types
4
4
5
5
Author: Daniel Kroening, [email protected]
6
+ Maria Svorenova, [email protected]
6
7
7
8
\*******************************************************************/
8
9
10
+ // / \file
11
+ // / Pre-defined types
12
+
9
13
#include " std_types.h"
10
14
11
15
#include " string2int.h"
@@ -26,6 +30,7 @@ std::size_t floatbv_typet::get_f() const
26
30
return unsafe_string2unsigned (id2string (f));
27
31
}
28
32
33
+ // / Return the sequence number of the component with given name.
29
34
std::size_t struct_union_typet::component_number (
30
35
const irep_idt &component_name) const
31
36
{
@@ -48,6 +53,7 @@ std::size_t struct_union_typet::component_number(
48
53
return 0 ;
49
54
}
50
55
56
+ // / Get the reference to a component with given name.
51
57
const struct_union_typet::componentt &struct_union_typet::get_component (
52
58
const irep_idt &component_name) const
53
59
{
@@ -73,6 +79,10 @@ typet struct_union_typet::component_type(
73
79
return c.type ();
74
80
}
75
81
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.
76
86
bool struct_typet::is_prefix_of (const struct_typet &other) const
77
87
{
78
88
const componentst &ot_components=other.components ();
@@ -102,12 +112,14 @@ bool struct_typet::is_prefix_of(const struct_typet &other) const
102
112
return true ; // ok, *this is a prefix of ot
103
113
}
104
114
115
+ // / Returns true if the type is a reference.
105
116
bool is_reference (const typet &type)
106
117
{
107
118
return type.id ()==ID_pointer &&
108
119
type.get_bool (ID_C_reference);
109
120
}
110
121
122
+ // / Returns if the type is an R value reference.
111
123
bool is_rvalue_reference (const typet &type)
112
124
{
113
125
return type.id ()==ID_pointer &&
0 commit comments