[flang-commits] [flang] [flang][openmp]Add UserReductionDetails and use in DECLARE REDUCTION (PR #140066)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Wed Jun 4 09:02:26 PDT 2025


================
@@ -728,14 +730,48 @@ class GenericDetails {
 };
 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const GenericDetails &);
 
+// Used for OpenMP DECLARE REDUCTION, it holds the information
+// needed to resolve which declaration (there could be multiple
+// with the same name) to use for a given type.
+class UserReductionDetails {
+public:
+  using TypeVector = std::vector<const DeclTypeSpec *>;
+  using DeclInfo = std::variant<const parser::OpenMPDeclareReductionConstruct *,
+      const parser::OmpMetadirectiveDirective *>;
+  using DeclVector = std::vector<DeclInfo>;
+
+  UserReductionDetails() = default;
+
+  void AddType(const DeclTypeSpec &type) { typeList_.push_back(&type); }
----------------
tblah wrote:

I ignored here (because it is just adding a pointer). But the other one does benefit from emplace_back to construct the variant in place. Thanks

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


More information about the flang-commits mailing list