[flang-commits] [flang] [flang][OpenMP] Semantic checks for metadirective loop nests (PR #207088)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Fri Jul 10 09:33:17 PDT 2026


================
@@ -585,12 +602,174 @@ void OmpStructureChecker::Leave(const parser::OmpDirectiveSpecification &x) {
 
 void OmpStructureChecker::Enter(const parser::OmpMetadirectiveDirective &x) {
   EnterDirectiveNest(MetadirectiveNest);
+  metadirectiveLoopVariants_.clear();
 }
 
 void OmpStructureChecker::Leave(const parser::OmpMetadirectiveDirective &) {
   ExitDirectiveNest(MetadirectiveNest);
 }
 
+// Return true if the variant guarded by `selector` might be selected, so its
+// associated loop must still be checked. Skip it only when it is provably
+// unselectable.
+static bool mayVariantBeSelected(
----------------
abidh wrote:

Semantics seems to use UpperCamalCase. So its name should be MayVariantBeSelected.  Other thing is that I wonder if this could be moved next to MakeVariantMatchInfo in openmp-utils. I am thinking that I could use this function in declare variant work too. 

https://github.com/llvm/llvm-project/pull/207088


More information about the flang-commits mailing list