diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-10-06 10:39:41 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-10-06 10:39:41 +0200 |
commit | 847f5addc4d07a2f3b95f5daa50ab4a64dfd957d (patch) | |
tree | 0ce51845a3d521b129664927810852f72e264775 /gcc/cp/parser.cc | |
parent | 08b51baddc53d64aa4c5e7a81ef3c4bf320293be (diff) | |
download | gcc-847f5addc4d07a2f3b95f5daa50ab4a64dfd957d.zip gcc-847f5addc4d07a2f3b95f5daa50ab4a64dfd957d.tar.gz gcc-847f5addc4d07a2f3b95f5daa50ab4a64dfd957d.tar.bz2 |
openmp: Map holds clause to IFN_ASSUME for C/C++
Now that [[assume (cond)]] support is in, this simple patch makes
#pragma omp assume holds(cond)
use it.
2022-10-06 Jakub Jelinek <jakub@redhat.com>
* c-parser.cc (c_parser_omp_assumption_clauses): Emit IFN_ASSUME
call for holds clause on assume construct.
* parser.cc (cp_parser_omp_assumption_clauses): Emit IFN_ASSUME
call for holds clause on assume construct.
* c-c++-common/gomp/assume-4.c: New test.
Diffstat (limited to 'gcc/cp/parser.cc')
-rw-r--r-- | gcc/cp/parser.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index baa808a..90e06f9 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -46023,13 +46023,15 @@ cp_parser_omp_assumption_clauses (cp_parser *parser, cp_token *pragma_tok, matching_parens parens; if (parens.require_open (parser)) { + location_t eloc = cp_lexer_peek_token (parser->lexer)->location; tree t = cp_parser_assignment_expression (parser); if (!type_dependent_expression_p (t)) t = contextual_conv_bool (t, tf_warning_or_error); - if (is_assume) + if (is_assume && !error_operand_p (t)) { - /* FIXME: Emit .ASSUME (t) call here. */ - (void) t; + t = build_call_expr_internal_loc (eloc, IFN_ASSUME, + void_type_node, 1, t); + finish_expr_stmt (t); } if (!parens.require_close (parser)) cp_parser_skip_to_closing_parenthesis (parser, |