Skip to content

Commit 06ebe72

Browse files
author
Daniel Kroening
committed
add a constructor for codet with operands
This enables complete construction of a codet object that uses operands.
1 parent 8d27131 commit 06ebe72

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/util/std_code.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ class codet:public exprt
4848
set_statement(statement);
4949
}
5050

51+
/// \param statement: Specifies the type of the `codet` to be constructed,
52+
/// e.g. `ID_block` for a \ref code_blockt or `ID_assign` for a
53+
/// \ref code_assignt.
54+
/// \param _op: any operands to be added
55+
explicit codet(const irep_idt &statement, operandst _op) : codet(statement)
56+
{
57+
operands() = std::move(_op);
58+
}
59+
5160
void set_statement(const irep_idt &statement)
5261
{
5362
set(ID_statement, statement);

0 commit comments

Comments
 (0)