Skip to content

Commit f28f2d9

Browse files
committed
c++, contracts: Simplify result decls [NFC intended].
1 parent 652e7b7 commit f28f2d9

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

gcc/cp/contracts.cc

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,14 +1538,9 @@ build_contract_condition_function (tree fndecl, bool pre)
15381538
*last = void_list_node;
15391539

15401540
/* The handlers are void fns. */
1541-
tree resdecl = build_decl (DECL_SOURCE_LOCATION (fndecl), RESULT_DECL,
1542-
0, void_type_node);
1543-
DECL_CONTEXT (resdecl) = fn;
1544-
DECL_ARTIFICIAL (resdecl) = true;
1545-
DECL_IGNORED_P (resdecl) = true;
1546-
DECL_RESULT (fn) = resdecl;
1547-
15481541
TREE_TYPE (fn) = build_function_type (void_type_node, arg_types);
1542+
DECL_RESULT (fn) = NULL_TREE; /* Let the start function code fill it in. */
1543+
15491544
if (DECL_IOBJ_MEMBER_FUNCTION_P (fndecl))
15501545
TREE_TYPE (fn) = build_method_type (class_type, TREE_TYPE (fn));
15511546

@@ -1915,12 +1910,8 @@ build_contract_wrapper_function (tree fndecl, bool is_cvh,
19151910
/* This declaration is a contract wrapper function. */
19161911
DECL_CONTRACT_WRAPPER (wrapdecl) = true;
19171912

1918-
/* Build our result decl. */
1919-
tree resdecl = build_decl (loc, RESULT_DECL, 0, wrapper_return_type);
1920-
DECL_CONTEXT (resdecl) = wrapdecl;
1921-
DECL_ARTIFICIAL (resdecl) = true;
1922-
DECL_IGNORED_P (resdecl) = true;
1923-
DECL_RESULT (wrapdecl) = resdecl;
1913+
/* Let the start function code fill in the result decl. */
1914+
DECL_RESULT (wrapdecl) = NULL_TREE;
19241915

19251916
/* Copy the function parameters, if present. Suppress (e.g. unused)
19261917
warnings on them. */

0 commit comments

Comments
 (0)