[flang-commits] [flang] [flang][OpenMP] Implement OpenMP stylized expressions (PR #165049)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Mon Oct 27 11:17:16 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};
----------------
tblah wrote:
That's unfortunate. In that case, please could you at least document the expected lifetime of this field.
We could perhaps achieve some of what a smart pointer would do by adding a destructor and accessors to this structure to control usage, but I'm not sure how much it would help in practice in this case. I don't think we have to apply design patterns for the sake of it. Feel free to add this only if you think it would be beneficial.
https://github.com/llvm/llvm-project/pull/165049
More information about the flang-commits
mailing list