Skip to content

Commit a325077

Browse files
committed
c++, contracts: Make sure late-parsed condition locations are handled.
When late-parsing, we should collect the location information from the parser output and pass that down to finish_contract_condition via update_late-contract. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
1 parent c3699ec commit a325077

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

gcc/cp/contracts.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ finish_contract_attribute (tree identifier, tree contract)
847847
if any. */
848848

849849
void
850-
update_late_contract (tree contract, tree result, tree condition)
850+
update_late_contract (tree contract, tree result, cp_expr condition)
851851
{
852852
if (TREE_CODE (contract) == POSTCONDITION_STMT)
853853
POSTCONDITION_IDENTIFIER (contract) = result;

gcc/cp/contracts.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ extern void defer_guarded_contract_match (tree, tree, tree);
334334
extern bool diagnose_misapplied_contracts (tree);
335335
extern tree finish_contract_attribute (tree, tree);
336336
extern tree invalidate_contract (tree);
337-
extern void update_late_contract (tree, tree, tree);
338337
extern tree splice_out_contracts (tree);
339338
extern bool all_attributes_are_contracts_p (tree);
340339
extern void copy_and_remap_contracts (tree, tree, bool, bool);

gcc/cp/cp-tree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8916,6 +8916,7 @@ extern tree make_postcondition_variable (cp_expr);
89168916
extern tree make_postcondition_variable (cp_expr, tree);
89178917
extern tree grok_contract (tree, tree, tree, cp_expr, location_t);
89188918
extern tree finish_contract_condition (cp_expr);
8919+
extern void update_late_contract (tree, tree, cp_expr);
89198920
extern tree constify_contract_access (tree);
89208921
extern bool maybe_reject_param_in_postcondition (tree);
89218922

gcc/cp/parser.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31645,9 +31645,9 @@ void cp_parser_late_contract_condition (cp_parser *parser,
3164531645
result = make_postcondition_variable (identifier, type);
3164631646
++processing_template_decl;
3164731647
}
31648-
condition = cp_parser_conditional_expression (parser);
31648+
cp_expr parsed_condition = cp_parser_conditional_expression (parser);
3164931649
/* Commit to changes. */
31650-
update_late_contract (contract, result, condition);
31650+
update_late_contract (contract, result, parsed_condition);
3165131651
/* Leave our temporary scope for the postcondition result. */
3165231652
if (identifier)
3165331653
--processing_template_decl;

0 commit comments

Comments
 (0)