[PATCH] D114941: [flang][OpenMP] Add some semantic checks for threadprivate and declare target directives

Peixin Qiao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 01:41:50 PST 2022


peixin added a comment.

Thanks for @kiranchandramohan accepting this patch. Addressed the comment.



================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:1479-1480
+                          context_.Say(name.source,
+                              "A THREADPRIVATE variable cannot be in %s "
+                              "clause"_err_en_US,
+                              parser::ToUpperCaseLetters(
----------------
kiranchandramohan wrote:
> peixin wrote:
> > shraiysh wrote:
> > > This same error is reported above too. Can you please explain why there is a duplication of code and if possible, can we merge the objects on which this has loop has to run (`mem` and `name`) and run this loop only once?
> > This is not duplication. The std::visit walks along the parse-tree from "ompObject.u". The "parse::Name" is for common block, and "parser::Designator" is for scalar, array, and so on. This is defined in parse-tree. You can write one simple correct example, and dump the parse-tree with the option "-fdebug-dump-parse-tree" to check it.
> One trivial code-sharing will be to have a lambda that, given a symbol, tests the Threadprivate flag and prints the error.
Good idea. Fixed.


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

https://reviews.llvm.org/D114941



More information about the llvm-commits mailing list