[flang-commits] [flang] [flang] add internal_assoc flag to mark variable captured in internal procedure (PR #117161)

via flang-commits flang-commits at lists.llvm.org
Fri Nov 22 05:05:35 PST 2024


================
@@ -1670,6 +1670,25 @@ cuf::DataAttributeAttr Fortran::lower::translateSymbolCUFDataAttribute(
   return cuf::getDataAttribute(mlirContext, cudaAttr);
 }
 
+static bool
+isCapturedInInternalProcedure(Fortran::lower::AbstractConverter &converter,
+                              const Fortran::semantics::Symbol &sym) {
+  const Fortran::lower::pft::FunctionLikeUnit *funit =
+      converter.getCurrentFunctionUnit();
+  if (!funit || funit->getHostAssoc().empty())
+    return false;
+  if (funit->getHostAssoc().isAssociated(sym))
+    return true;
+  // Consider that any capture of a variable that is in an equivalence with the
+  // symbol imply that the storage of the symbol may also be accessed inside
----------------
jeanPerier wrote:

Thanks!

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


More information about the flang-commits mailing list