From 752ef8f4f5ddf9a3372e6d5dc08df6aa05a60ea3 Mon Sep 17 00:00:00 2001 From: Kwok Cheung Yeung Date: Mon, 13 Jan 2025 13:08:07 +0000 Subject: openmp: Add support for using custom mappers with iterators (C, C++) gcc/c-family/ * c-omp.cc (omp_instantiate_mapper): Apply iterator to new clauses generated from mapper. gcc/c/ * c-parser.cc (c_parser_omp_clause_map): Apply iterator to push and pop mapper clauses. gcc/cp/ * parser.cc (cp_parser_omp_clause_map): Apply iterator to push and pop mapper clauses. * semantics.cc (cxx_omp_map_array_section): Allow array types for base type of array sections. libgomp/ * testsuite/libgomp.c-c++-common/mapper-iterators-1.c: New test. * testsuite/libgomp.c-c++-common/mapper-iterators-2.c: New test. * testsuite/libgomp.c-c++-common/mapper-iterators-3.c: New test. Co-authored-by: Andrew Stubbs --- gcc/c/c-parser.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 8a5b493..31ab7d0 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -20738,6 +20738,8 @@ c_parser_omp_clause_map (c_parser *parser, tree list, enum gomp_map_kind kind) tree name = build_omp_clause (input_location, OMP_CLAUSE_MAP); OMP_CLAUSE_SET_MAP_KIND (name, GOMP_MAP_PUSH_MAPPER_NAME); OMP_CLAUSE_DECL (name) = mapper_name; + if (iterators) + OMP_CLAUSE_ITERATORS (name) = iterators; OMP_CLAUSE_CHAIN (name) = nl; nl = name; @@ -20746,6 +20748,8 @@ c_parser_omp_clause_map (c_parser *parser, tree list, enum gomp_map_kind kind) name = build_omp_clause (input_location, OMP_CLAUSE_MAP); OMP_CLAUSE_SET_MAP_KIND (name, GOMP_MAP_POP_MAPPER_NAME); OMP_CLAUSE_DECL (name) = null_pointer_node; + if (iterators) + OMP_CLAUSE_ITERATORS (name) = iterators; OMP_CLAUSE_CHAIN (name) = OMP_CLAUSE_CHAIN (last_new); OMP_CLAUSE_CHAIN (last_new) = name; } -- cgit v1.1