This is an archive of the discontinued LLVM Phabricator instance.

[flang] [openmp] Add Fortran specific semantic checks for OpenMP Allocate directive.
ClosedPublic

Authored by I_Perry on May 7 2021, 3:59 AM.

Details

Summary

This patch adds Fortran specific semantic checks for the OpenMP allocate
directive.

Due to an issue in the parser (described in https://reviews.llvm.org/D93549/new/)
the checks: "List items specified in an allocate directive that is
associated with an allocate statement must be variables that are allocated
by the allocate statement" and "Multiple directives can only be associated
with an allocate statement if list items are specified on each allocate directive"
cannot be implemented yet.

I have used code written as part of https://reviews.llvm.org/D93549/new/
as a basis for the implementations of these checks.

Diff Detail

Event Timeline

I_Perry created this revision.May 7 2021, 3:59 AM
I_Perry requested review of this revision.May 7 2021, 3:59 AM
Herald added a project: Restricted Project. · View Herald Transcript
kiranchandramohan requested changes to this revision.May 13 2021, 7:49 AM

A few comments.

flang/lib/Semantics/check-omp-structure.cpp
1136

Nit: Use braced initialization.

1163–1173

Can you make the type parameter inquiry check the first check and the other one the second and remove (!IsDataRefTypeParamInquiry(dataRef)) from the current first check?

flang/lib/Semantics/resolve-directives.cpp
1491–1492

Nit: Is this clang-formatted?

flang/test/Semantics/omp-allocate06.f90
15–16

The line 15 omp allocate should come before line 11. The line 12 allocate is an executable statement, which makes the line 15 openmp allocate directive an executable allocate.

flang/test/Semantics/omp-allocate07.f90
24

Can you add a test which has allocate directive having an array's kind?

This revision now requires changes to proceed.May 13 2021, 7:49 AM
I_Perry updated this revision to Diff 346144.May 18 2021, 5:07 AM

Addressed comments.

I_Perry added inline comments.May 18 2021, 5:36 AM
flang/lib/Semantics/resolve-directives.cpp
1491–1492

I've just edited then formatted this code with clang-format and this is the result. Could there possibly be a clang-format version issue if this shouldn't be the case?

This revision is now accepted and ready to land.May 24 2021, 9:39 AM
I_Perry marked 5 inline comments as done.May 25 2021, 5:13 AM
This revision was landed with ongoing or failed builds.May 27 2021, 7:51 AM
This revision was automatically updated to reflect the committed changes.