[flang-commits] [flang] [Flang][OpenMP][NFC] Track Objects for BlockArgs (PR #197442)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Thu May 14 07:58:14 PDT 2026


================
@@ -1541,26 +1541,32 @@ bool ClauseProcessor::processIf(
 }
 
 template <typename T>
-void collectReductionSyms(
-    const T &reduction,
-    llvm::SmallVectorImpl<const semantics::Symbol *> &reductionSyms) {
-  const auto &objectList{std::get<omp::ObjectList>(reduction.t)};
-  for (const Object &object : objectList) {
-    const semantics::Symbol *symbol = object.sym();
-    reductionSyms.push_back(symbol);
-  }
+void collectReductionObjects(const T &reduction,
+                             llvm::SmallVectorImpl<Object> &reductionObjects) {
+  const omp::ObjectList &objectList{std::get<omp::ObjectList>(reduction.t)};
+  llvm::copy(objectList, std::back_inserter(reductionObjects));
----------------
tblah wrote:

nit: This has me thinking all of the for loops above should also use `llvm::copy`/`llvm::transform` - it is a matter of taste which you go with (I can't find any rule in LLVM docs) but we should at least stick with one method instead of mixing explicit loops with helpers in the same patch.

Even with llvm::copy these will still benefit from a resize call.

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


More information about the flang-commits mailing list