[flang-commits] [flang] [Flang][OpenMP] Improve Semantics for Derived Type Array Elements (PR #167296)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Mon Nov 10 04:08:30 PST 2025


================
@@ -1210,6 +1210,26 @@ bool HasConstant(const Expr<SomeType> &expr) {
   return HasConstantHelper{}(expr);
 }
 
+// HasStructureComponent()
+struct HasStructureComponentHelper
+    : public AnyTraverse<HasStructureComponentHelper, bool, false> {
+  using Base = AnyTraverse<HasStructureComponentHelper, bool, false>;
+  HasStructureComponentHelper() : Base(*this) {}
+  using Base::operator();
+
+  bool operator()(const DataRef &dataRef) const {
+    return std::holds_alternative<Component>(dataRef.u);
+  }
+  bool operator()(const NamedEntity &NamedEntity) const {
+    return NamedEntity.UnwrapComponent() != nullptr;
+  }
+  bool operator()(const Component &) const { return true; }
----------------
tblah wrote:

Do we need the other two visitors or will it still catch them here after one more traversal?

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


More information about the flang-commits mailing list