Skip to content

Commit 0c545ca

Browse files
committed
c++, contracts: Minor cleanups.
Just simplify the late parsing loops by using the tree accessors provided for contract attributes. Signed-off-by: Iain Sandoe <[email protected]>
1 parent 84b8076 commit 0c545ca

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

gcc/cp/parser.cc

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12498,11 +12498,8 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr)
1249812498

1249912499
/* We need to parse deferred contract conditions before we try to call
1250012500
finish_function (which will try to emit the contracts). */
12501-
for (tree a = DECL_ATTRIBUTES (fco); a; a = TREE_CHAIN (a))
12502-
{
12503-
if (cxx_contract_attribute_p (a))
12504-
cp_parser_late_contract_condition (parser, fco, a);
12505-
}
12501+
for (tree a = DECL_CONTRACTS (fco); a; a = CONTRACT_CHAIN (a))
12502+
cp_parser_late_contract_condition (parser, fco, a);
1250612503

1250712504
finish_lambda_function (body);
1250812505
}
@@ -27860,11 +27857,8 @@ cp_parser_class_specifier (cp_parser* parser)
2786027857
parser->local_variables_forbidden_p |= THIS_FORBIDDEN;
2786127858

2786227859
/* Now we can parse contract conditions. */
27863-
for (tree a = DECL_ATTRIBUTES (decl); a; a = TREE_CHAIN (a))
27864-
{
27865-
if (cxx_contract_attribute_p (a))
27866-
cp_parser_late_contract_condition (parser, decl, a);
27867-
}
27860+
for (tree a = DECL_CONTRACTS (decl); a; a = CONTRACT_CHAIN (a))
27861+
cp_parser_late_contract_condition (parser, decl, a);
2786827862

2786927863
/* Restore the state of local_variables_forbidden_p. */
2787027864
parser->local_variables_forbidden_p = local_variables_forbidden_p;

0 commit comments

Comments
 (0)