You missed formatting with clang-format.
Please add additional tests to ensure allocate clause is accepted in all directives where it is allowed.
More comments inline.
There are two minor issues with putting this check here,
This should be changed to something like "must appear in a private ...".
Check whether this kind of clause is present in OpenACC also. If not then move it to the OmpDirectiveVisitor class.
Is this field required? Can we use an additional check (whether symbol is private) on the dataSharingAttributeObjects_ to obtain this set?
Thanks Rin for making the changes. A few more comments.
Do all OpenMPBlockConstructs have allocate clause?
Is a line required above?
Can this check be done before the find on dataSharingAttributeObjects?
We need more error tests.
Is the code in each of the above cases the same? Can we avoid the duplication by the following or making the common code a function?
|211 ↗||(On Diff #288331)|
This information is not used in Flang at the moment. Looks like couple of Clang OpenMP tests are failing with this patch and Clang is using this information. So I'm not sure it is worth adding this now or you would have to check the failure in Clang.
Looking good. Few minor comments. Please wait for one more approval.
Thinking about this again, this set will probably not work since different occurrences of names have different pointers. And we probably want to flag error at each occurrence of the same variable. So we can very well have a vector/smallvector. Add a test
integer :: N = 2 integer :: x !ERROR: The ALLOCATE clause requires that 'x' must be listed in a private data-sharing attribute clause on the same directive !$omp parallel allocate(omp_default_mem_space : x) allocate(omp_default_mem_space : x) do i = 1, N x = 2 enddo !$omp end parallel end
Check the clang-tidy warning here.
I think the ToString() is not required here.