@@ -1404,8 +1404,8 @@ static GTY(()) tree contracts_source_location_type;
1404
1404
tree
1405
1405
get_precondition_function (tree fndecl)
1406
1406
{
1407
- hash_map_maybe_create<hm_ggc> (decl_pre_fn );
1408
- tree *result = decl_pre_fn-> get ( fndecl);
1407
+ gcc_checking_assert (fndecl );
1408
+ tree *result = hash_map_safe_get (decl_pre_fn, fndecl);
1409
1409
return result ? *result : NULL_TREE;
1410
1410
}
1411
1411
@@ -1414,8 +1414,8 @@ get_precondition_function (tree fndecl)
1414
1414
tree
1415
1415
get_postcondition_function (tree fndecl)
1416
1416
{
1417
- hash_map_maybe_create<hm_ggc> (decl_post_fn );
1418
- tree *result = decl_post_fn-> get ( fndecl);
1417
+ gcc_checking_assert (fndecl );
1418
+ tree *result = hash_map_safe_get (decl_post_fn, fndecl);
1419
1419
return result ? *result : NULL_TREE;
1420
1420
}
1421
1421
@@ -1442,13 +1442,15 @@ set_postcondition_function (tree fndecl, tree post)
1442
1442
}
1443
1443
1444
1444
/* Set the PRE and POST functions for FNDECL. Note that PRE and POST can
1445
- be null in this case. If so the functions are not recorded. */
1445
+ be null in this case. If so the functions are not recorded. Used by the
1446
+ modules code. */
1446
1447
1447
1448
void
1448
1449
set_contract_functions (tree fndecl, tree pre, tree post)
1449
1450
{
1450
1451
if (pre)
1451
1452
set_precondition_function (fndecl, pre);
1453
+
1452
1454
if (post)
1453
1455
set_postcondition_function (fndecl, post);
1454
1456
}
@@ -1550,6 +1552,7 @@ build_contract_condition_function (tree fndecl, bool pre)
1550
1552
DECL_NAME (fn) = copy_node (DECL_NAME (fn));
1551
1553
DECL_INITIAL (fn) = NULL_TREE;
1552
1554
CONTRACT_HELPER (fn) = pre ? ldf_contract_pre : ldf_contract_post;
1555
+ DECL_CONTRACT_WRAPPER (fn) = false ;
1553
1556
1554
1557
IDENTIFIER_VIRTUAL_P (DECL_NAME (fn)) = false ;
1555
1558
DECL_VIRTUAL_P (fn) = false ;
@@ -1709,10 +1712,20 @@ build_contract_function_decls (tree fndecl)
1709
1712
if (!outline_contracts_p (fndecl))
1710
1713
return ;
1711
1714
1712
- /* Build the pre/post functions (or not). */
1713
- tree pre = build_precondition_function (fndecl);
1714
- tree post = build_postcondition_function (fndecl);
1715
- set_contract_functions (fndecl, pre, post);
1715
+ if (!get_precondition_function (fndecl))
1716
+ {
1717
+ /* Build the pre/post functions (or not). */
1718
+ tree pre = build_precondition_function (fndecl);
1719
+ if (pre)
1720
+ set_precondition_function (fndecl, pre);
1721
+ }
1722
+
1723
+ if (!get_postcondition_function (fndecl))
1724
+ {
1725
+ tree post = build_postcondition_function (fndecl);
1726
+ if (post)
1727
+ set_postcondition_function (fndecl, post);
1728
+ }
1716
1729
}
1717
1730
1718
1731
/* Build a layout-compatible internal version of source location __impl
0 commit comments