On Wed, Dec 23, 2020 at 07:02:09PM +0800, Chung-Lin Tang wrote:
> Hi Jakub,
> this patch is to fix some of the problems with target mapping when inside
> C++ member functions:
> 
> 1. Allow deref '->' in map clauses.
> 2. Allow this[X] in map clauses.

I must say I'd prefer not to go this way by adding further and further
exceptions on what we allow during parsing.
The OpenMP 5.0 wording basically says that we should parse (for map and
to/from) arbitrary base language expressions with the OpenMP additional
extensions (e.g. the array section syntax and array shaping), which I think
means we need to set some flag in the parse when we start parsing the
expression in the clause, which will tell the parser that array sections
and/or array shaping is allowed, add tree codes for ARRAY_SECTION_REF and
the array shaping, parse it (ideally with as few foldings as possible if the
foldings would prevent us from behaving correctly) and when parsed (probably
in the *finish_omp_clauses helper routines) go over those expressions,
diagnose ARRAY_SECTION_REF and/or array shaping used in inappropriate
locations in the expression and then go through what the 5.0 spec says on
how the expressions should be mapped, what to do on ARRAY_REF, what to do on
ARRAY_SECTION_REF, what to do on COMPONENT_REF, what to do on INDIRECT_REF,
...
Because I'm afraid we can't avoid doing that and when we do, the -> and
this[X] etc. handling would be thrown away again.
The hack to just parse decl or optional . member after it several times)
followed by [ with array section syntax in there was possibly only for 4.5
and earlier.

        Jakub

Reply via email to