Skip to content

Commit 9f34d25

Browse files
committed
c++, contracts: Simplify outlined function output.
Ensure that the finished function is registered in the tree that we look up. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
1 parent 0cb63e7 commit 9f34d25

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

gcc/cp/contracts.cc

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3134,7 +3134,7 @@ finish_function_contracts (tree fndecl)
31343134
/* If this is not a client side check and definition side checks are
31353135
disabled, do nothing. */
31363136
if (!flag_contracts_nonattr_definition_check
3137-
&& !DECL_CONTRACT_WRAPPER(fndecl))
3137+
&& !DECL_CONTRACT_WRAPPER (fndecl))
31383138
return;
31393139

31403140
for (tree ca = DECL_CONTRACTS (fndecl); ca; ca = CONTRACT_CHAIN (ca))
@@ -3156,28 +3156,25 @@ finish_function_contracts (tree fndecl)
31563156
if (pre == error_mark_node || post == error_mark_node)
31573157
return;
31583158

3159-
if (pre && (!DECL_INITIAL (pre) || DECL_INITIAL (pre)== error_mark_node))
3159+
if (pre && !DECL_INITIAL (pre))
31603160
{
31613161
DECL_PENDING_INLINE_P (pre) = false;
31623162
start_preparsed_function (pre, DECL_ATTRIBUTES (pre), flags);
31633163
remap_and_emit_conditions (fndecl, pre, PRECONDITION_STMT);
31643164
finish_return_stmt (NULL_TREE);
3165-
tree finished_pre = finish_function (false);
3166-
expand_or_defer_fn (finished_pre);
3165+
pre = finish_function (false);
3166+
expand_or_defer_fn (pre);
31673167
}
31683168

3169-
if (post && (!DECL_INITIAL (post) || DECL_INITIAL (post) == error_mark_node))
3169+
if (post && !DECL_INITIAL (post))
31703170
{
31713171
DECL_PENDING_INLINE_P (post) = false;
3172-
start_preparsed_function (post,
3173-
DECL_ATTRIBUTES (post),
3174-
flags);
3172+
start_preparsed_function (post, DECL_ATTRIBUTES (post), flags);
31753173
remap_and_emit_conditions (fndecl, post, POSTCONDITION_STMT);
31763174
gcc_checking_assert (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (post))));
31773175
finish_return_stmt (NULL_TREE);
3178-
3179-
tree finished_post = finish_function (false);
3180-
expand_or_defer_fn (finished_post);
3176+
post = finish_function (false);
3177+
expand_or_defer_fn (post);
31813178
}
31823179

31833180
/* Check if we need to update wrapper function contracts. */

0 commit comments

Comments
 (0)