Skip to content

Commit 5af3b3a

Browse files
committed
Separate getting the type of alloca function
For ease of reference in existing code and in preparation for additional checks.
1 parent 42a876f commit 5af3b3a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -704,19 +704,18 @@ void goto_convertt::do_alloca(
704704
const irep_idt &mode)
705705
{
706706
const source_locationt &source_location = function.source_location();
707+
const auto alloca_type = to_code_type(function.type());
708+
707709
exprt new_lhs = lhs;
708710

709711
// make sure we have a left-hand side to track the allocation even when the
710712
// original program did not
711713
if(lhs.is_nil())
712714
{
713-
new_lhs = new_tmp_symbol(
714-
to_code_type(function.type()).return_type(),
715-
"alloca",
716-
dest,
717-
source_location,
718-
mode)
719-
.symbol_expr();
715+
new_lhs =
716+
new_tmp_symbol(
717+
alloca_type.return_type(), "alloca", dest, source_location, mode)
718+
.symbol_expr();
720719
}
721720

722721
// do the actual function call
@@ -740,7 +739,7 @@ void goto_convertt::do_alloca(
740739
// NULL
741740
symbol_exprt this_alloca_ptr =
742741
get_fresh_aux_symbol(
743-
to_code_type(function.type()).return_type(),
742+
alloca_type.return_type(),
744743
id2string(function.source_location().get_function()),
745744
"tmp_alloca",
746745
source_location,

0 commit comments

Comments
 (0)