[flang-commits] [flang] [flang][OpenMP] Implement OpenMP stylized expressions (PR #165049)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Mon Oct 27 07:20:54 PDT 2025


================
@@ -3532,6 +3536,33 @@ struct OmpObjectList {
   WRAPPER_CLASS_BOILERPLATE(OmpObjectList, std::list<OmpObject>);
 };
 
+struct OmpStylizedDeclaration {
+  COPY_AND_ASSIGN_BOILERPLATE(OmpStylizedDeclaration);
+  // Since "Reference" isn't handled by parse-tree-visitor, add EmptyTrait,
+  // and visit the members by hand when needed.
+  using EmptyTrait = std::true_type;
+  common::Reference<const OmpTypeName> type;
+  EntityDecl var;
+};
+
+struct OmpStylizedInstance {
+  struct Instance {
+    UNION_CLASS_BOILERPLATE(Instance);
+    std::variant<AssignmentStmt, CallStmt, common::Indirection<Expr>> u;
+  };
+  TUPLE_CLASS_BOILERPLATE(OmpStylizedInstance);
+  std::tuple<std::list<OmpStylizedDeclaration>, Instance> t;
+};
+
+class ParseState;
+
+struct OmpStylizedExpression {
+  CharBlock source;
+  const ParseState *state{nullptr};
----------------
kparzysz wrote:

I've tried that.  To make it std::unique_ptr<ParseState>, the class ParseState must be either defined in full or have a forward declaration here (in parse-tree.h).  It can't really be fully defined because we can't include parse-state.h (because the dependence is the other way, i.e. parse-state.h includes parse-tree.h).  With just a forward declaration the OmpStylizedExpression type is incomplete, and several files that include parse-tree.h (but not parse-state.h) fail to compile.

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


More information about the flang-commits mailing list