[PATCH] D98580: [flang][OpenMP] Add support for getting parent context and clauses and modify the relevant sema checks to use the new functions.

Arnamoy B via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 13 06:26:07 PST 2021


arnamoy10 created this revision.
arnamoy10 added reviewers: kiranchandramohan, clementval, tskeith, sameeranjoshi, SouraVX, bryanpkc.
Herald added subscribers: guansong, yaxunl.
arnamoy10 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a project: LLVM.

rGa59665930b87 <https://reviews.llvm.org/rGa59665930b87d7510002dcf1f292b290673a47d3> introduced a different algorithm to check context nesting.  With each nested context, we push an entry in the `dirContext_` vector.  Therefore intuitively, a the current context should be considered nested when the size of the vector is at least 2 e.g.

  !$ omp do  --> context pushed in vector, size 1
    !$omp single --> context pushed in vector, size 2

With the change introduced in rGa59665930b87 <https://reviews.llvm.org/rGa59665930b87d7510002dcf1f292b290673a47d3> , 4 test cases were failing.  Those tests were to do with nesting checking, BUT the nesting check was being done BEFORE pushing the current context into the vector.  That was counterintuitive.

This patch fixes the code (that was causing test failure) and uses the more intuitive structure of ALWAYS pushing the context first while visiting a construct, and then implement checks that are dependent on nesting check.

Also introduces helper functions for getting the parent context and checking whether a clause is present in the parent context.

These helper functions help in the implementation of more sema checks that requires getting information about the parent context.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98580

Files:
  flang/lib/Semantics/check-directive-structure.h
  flang/lib/Semantics/check-omp-structure.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98580.330448.patch
Type: text/x-patch
Size: 3949 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210313/0c69fd68/attachment.bin>


More information about the llvm-commits mailing list