-
Notifications
You must be signed in to change notification settings - Fork 276
Complete typet documentation [DOC-12] #2771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
/*******************************************************************\ | ||
|
||
Module: | ||
Module: Pre-defined types | ||
|
||
Author: Daniel Kroening, [email protected] | ||
Maria Svorenova, [email protected] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know, but should the additional Author be Diffblue @peterschrammel? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I followed @peterschrammel recommendation from Slack but happy to change it to whatever makes more sense. |
||
|
||
\*******************************************************************/ | ||
|
||
/// \file | ||
/// Pre-defined types | ||
|
||
#include "std_types.h" | ||
|
||
#include "string2int.h" | ||
|
@@ -26,6 +30,7 @@ std::size_t floatbv_typet::get_f() const | |
return unsafe_string2unsigned(id2string(f)); | ||
} | ||
|
||
/// Return the sequence number of the component with given name. | ||
std::size_t struct_union_typet::component_number( | ||
const irep_idt &component_name) const | ||
{ | ||
|
@@ -48,6 +53,7 @@ std::size_t struct_union_typet::component_number( | |
return 0; | ||
} | ||
|
||
/// Get the reference to a component with given name. | ||
const struct_union_typet::componentt &struct_union_typet::get_component( | ||
const irep_idt &component_name) const | ||
{ | ||
|
@@ -73,6 +79,10 @@ typet struct_union_typet::component_type( | |
return c.type(); | ||
} | ||
|
||
/// Returns true if the struct is a prefix of \a other, i.e., if this struct | ||
/// has n components then the component types and names of this struct must | ||
/// match the first n components of \a other struct. | ||
/// \param other Struct type to compare with. | ||
bool struct_typet::is_prefix_of(const struct_typet &other) const | ||
{ | ||
const componentst &ot_components=other.components(); | ||
|
@@ -102,12 +112,14 @@ bool struct_typet::is_prefix_of(const struct_typet &other) const | |
return true; // ok, *this is a prefix of ot | ||
} | ||
|
||
/// Returns true if the type is a reference. | ||
bool is_reference(const typet &type) | ||
{ | ||
return type.id()==ID_pointer && | ||
type.get_bool(ID_C_reference); | ||
} | ||
|
||
/// Returns if the type is an R value reference. | ||
bool is_rvalue_reference(const typet &type) | ||
{ | ||
return type.id()==ID_pointer && | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I don't understand the meaning of this - perhaps a short example as you've given for the
typet
overload