[PATCH] D92732: [Flang][OpenMP 4.5] Add semantic check for OpenMP Do Loop Constructs

Yashaswini Hegde via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 14 11:11:58 PST 2021


yhegde added inline comments.


================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:246-248
+      const auto it{block.begin()};
+      loop = it != block.end() ? parser::Unwrap<parser::DoConstruct>(*it)
+                               : nullptr;
----------------
kiranchandramohan wrote:
> yhegde wrote:
> > kiranchandramohan wrote:
> > > Is something missing here?
> > > If "it" is block.begin() in the previous patch, how can it ever be block.end in this line unless the block is empty?
> > > 
> > > If nothing is missing, add a comment.
> > > Is something missing here?
> > > If "it" is block.begin() in the previous patch, how can it ever be block.end in this line unless the block is empty?
> > > 
> > I think If the block is empty then Fortran::parser::ExecutableConstruct has "no contained value".   If block is not empty then DoConstruct, if exists in ExecutableConstruct, is fetched. Please let me know otherwise.
> > 
> > > If nothing is missing, add a comment.
> > 
> > 
> Nit: Consider switching to the following.
> 
> ```
> loop = block.empty() ? nullptr : parser::Unwrap<parser::DoConstruct>(block.begin());
> ```
> 
Tried this. Didn't get expected results (errors). Block is a list type. Similar kind of implementation can be found in resolve-directives:806 , 1201.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92732/new/

https://reviews.llvm.org/D92732



More information about the llvm-commits mailing list