Skip to content

Commit 64124d7

Browse files
committed
Add documentation
Add documentation for doxygen and also improve type clarity
1 parent 8412bdf commit 64124d7

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ void goto_convertt::do_enum_is_in_range(
624624
const c_enum_typet &c_enum_type = ns.follow_tag(*enum_type);
625625
const c_enum_typet::memberst enum_values = c_enum_type.members();
626626

627-
std::vector<exprt> disjuncts;
627+
exprt::operandst disjuncts;
628628
for(const auto &enum_value : enum_values)
629629
{
630630
constant_exprt val{enum_value.get_value(), *enum_type};

src/goto-programs/goto_convert_class.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,27 @@ class goto_convertt:public messaget
588588
bool get_string_constant(const exprt &expr, irep_idt &);
589589
exprt get_constant(const exprt &expr);
590590

591-
// some built-in functions
591+
/// \brief Converts calls to the built in `enum_is_in_range` function to a
592+
/// test that the given enum value is in the valid range of values for that
593+
/// enum type.
594+
///
595+
/// Note that the check for the range of values is done by creating a
596+
/// disjunction comparing the expression with each possible valid value.
597+
/// \param lhs The destination for the generated assignment.
598+
/// \param function The `enum_is_in_range` symbol of the source function call.
599+
/// \param arguments A collection of arguments, which is expected to contain a
600+
/// single argument which is an expression that resolves to a value of
601+
/// enum type. The arguments are expected to have been prevalidated by the
602+
/// typechecking process.
603+
/// \param dest The goto program into which the generated assignment is
604+
/// copied.
592605
void do_enum_is_in_range(
593606
const exprt &lhs,
594607
const symbol_exprt &function,
595608
const exprt::operandst &arguments,
596609
goto_programt &dest);
610+
611+
// some built-in functions
597612
void do_atomic_begin(
598613
const exprt &lhs,
599614
const symbol_exprt &function,

0 commit comments

Comments
 (0)