[flang-commits] [flang] [llvm] [OpenMP][flang] Use auto-generated data for modifier verification (PR #215648)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Thu Aug 13 05:17:06 PDT 2026


================
@@ -423,28 +448,30 @@ bool verifyUltimate(const std::optional<std::list<UnionTy>> &modifiers,
   // Walk over the list, and if a given item has the Ultimate property but is
   // not at the right position, mark it as an error.
   for (auto it{first}, end{modifiers->cend()}; it != end; ++it) {
-    result =
-        common::visit(
-            [&](auto &&m) {
-              using SpecificTy = llvm::remove_cvref_t<decltype(m)>;
-              const OmpModifierDescriptor &desc{OmpGetDescriptor<SpecificTy>()};
-              auto &props{desc.props(version)};
-
-              if (props.test(OmpProperty::Ultimate)) {
-                bool isPre = !props.test(OmpProperty::Post);
-                if (it == (isPre ? last : first)) {
-                  // Skip, since this is the correct place for this modifier.
-                  return true;
-                }
-                llvm::StringRef where{isPre ? "last" : "first"};
-                semaCtx.Say(it->source,
-                    "'%s' should be the %s modifier"_err_en_US, desc.name.str(),
-                    where.str());
-                return false;
-              }
-              return true;
-            },
-            it->u) &&
+    result = common::visit(
+                 [&](auto &&m) {
+                   using SpecificTy = llvm::remove_cvref_t<decltype(m)>;
+                   const llvm::omp::descriptor::Modifier &desc{
+                       OmpGetDescriptor<SpecificTy>()};
+                   const auto &props{desc.getProperties(version)};
+
+                   if (props.test(llvm::omp::Property::Ultimate)) {
+                     bool isPre = !llvm::omp::getProperties(id, version)
+                                       .test(llvm::omp::Property::PostModified);
----------------
kparzysz wrote:

`props` are the properties of the modifier.  `PostModified` is a property of a clause, hence the function call.

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


More information about the flang-commits mailing list