@@ -62,6 +62,25 @@ class allocate_objectst
62
62
const typet &allocate_type,
63
63
const irep_idt &basename_prefix = " tmp" );
64
64
65
+ // / Generates code for allocating a dynamic object. A new variable with
66
+ // / basename prefix `alloc_site` is introduced to which the allocated memory
67
+ // / is assigned.
68
+ // / Then, the variable is assigned to `target_expr`. For example, with
69
+ // / `target_expr` being `*p` the following code is generated:
70
+ // /
71
+ // / `alloc_site$1 = ALLOCATE(object_size, FALSE);`
72
+ // / `*p = alloc_site$1;`
73
+ // /
74
+ // / The function returns a dereference expressiont that dereferences the
75
+ // / allocation site variable (e.g., `*alloc_site$1`) and which can be used to
76
+ // / initialize the allocated memory.
77
+ // /
78
+ // / \param output_code: Code block to which the necessary code is added
79
+ // / \param target_expr: A pointer to the allocated memory will be assigned to
80
+ // / this (lvalue) expression
81
+ // / \param allocate_type: Type of the object allocated
82
+ // / \return A dereference_exprt that dereferences the pointer to the allocated
83
+ // / memory, or an empty expression when `allocate_type` is void
65
84
exprt allocate_dynamic_object (
66
85
code_blockt &output_code,
67
86
const exprt &target_expr,
0 commit comments