[PATCH] D89562: [flang]Add Parser Support for OpenMP Allocate Directive
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 3 06:07:57 PST 2020
clementval added inline comments.
================
Comment at: flang/lib/Parser/openmp-parsers.cpp:457
+ sourced(construct<OpenMPExecutableAllocate>(verbatim("ALLOCATE"_tok),
+ maybe(parenthesized(Parser<OmpObjectList>{})), Parser<OmpClauseList>{},
+ maybe(Parser<OpenMPDeclarativeAllocate>{}) / endOmpLine,
----------------
sameeranjoshi wrote:
> In case of `OpenMPExecutableAllocate` are the clauses mandatory as the standard doesn't seem to have square brackets around them?
> Or that's wrongly mentioned in standard.
>
> As `OmpClauseList` is a list it can be optional.
> ```
> !$omp allocate[(list)] clause
> [!$omp allocate[(list)] clause
> [...]]
> ```
>
> So a test case like
> ```
> !$omp allocate(a, b)
> allocate ( darray(a, b) )
> ```
> becomes invalid in that case.
If there are required clauses they are set in the TableGen file. `OmpClauseList` should be used in preference of a stricter parser.
================
Comment at: flang/lib/Parser/openmp-parsers.cpp:474
+ parenthesized(Parser<OmpObjectList>{}), Parser<OmpClauseList>{})) /
+ lookAhead(endOmpLine / !statement(allocateStmt)))
+
----------------
sameeranjoshi wrote:
> Does a test with no newline and an allocateStmt fall under `OpenMPDeclarativeAllocate` as per current implementations?
> ```
> !$omp allocate(x, y) allocator(omp_default_mem_alloc) allocate( darray(x,y) )
> ```
I don't think the `allocate` statement in that case will be handle by the fortran parser. The whole line is considered as a "comment" so the Fortran parser will not try to infer what is inside of it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89562/new/
https://reviews.llvm.org/D89562
More information about the llvm-commits
mailing list