Skip to content

Commit 3e3d032

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 0e46d17 commit 3e3d032

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
@@ -12295,11 +12295,8 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr)
1229512295

1229612296
/* We need to parse deferred contract conditions before we try to call
1229712297
finish_function (which will try to emit the contracts). */
12298-
for (tree a = DECL_ATTRIBUTES (fco); a; a = TREE_CHAIN (a))
12299-
{
12300-
if (cxx_contract_attribute_p (a))
12301-
cp_parser_late_contract_condition (parser, fco, a);
12302-
}
12298+
for (tree a = DECL_CONTRACTS (fco); a; a = CONTRACT_CHAIN (a))
12299+
cp_parser_late_contract_condition (parser, fco, a);
1230312300

1230412301
finish_lambda_function (body);
1230512302
}
@@ -27606,11 +27603,8 @@ cp_parser_class_specifier (cp_parser* parser)
2760627603
parser->local_variables_forbidden_p |= THIS_FORBIDDEN;
2760727604

2760827605
/* Now we can parse contract conditions. */
27609-
for (tree a = DECL_ATTRIBUTES (decl); a; a = TREE_CHAIN (a))
27610-
{
27611-
if (cxx_contract_attribute_p (a))
27612-
cp_parser_late_contract_condition (parser, decl, a);
27613-
}
27606+
for (tree a = DECL_CONTRACTS (decl); a; a = CONTRACT_CHAIN (a))
27607+
cp_parser_late_contract_condition (parser, decl, a);
2761427608

2761527609
/* Restore the state of local_variables_forbidden_p. */
2761627610
parser->local_variables_forbidden_p = local_variables_forbidden_p;

0 commit comments

Comments
 (0)