[flang-commits] [flang] [flang][openacc] Allow open acc routines from other modules. (PR #136012)

via flang-commits flang-commits at lists.llvm.org
Fri May 2 05:40:22 PDT 2025


================
@@ -403,18 +403,21 @@ class FirConverter : public Fortran::lower::AbstractConverter {
               [&](Fortran::lower::pft::FunctionLikeUnit &f) {
                 if (f.isMainProgram())
                   hasMainProgram = true;
-                declareFunction(f);
+                createGlobalOutsideOfFunctionLowering(
----------------
jeanPerier wrote:

Could you make that a single call that wraps the whole `for (Fortran::lower::pft::Program::Units &u` ...`, there is no real need to create an delete a  mock builder for each declaration.

I think that would involve modifying `createGlobalOutsideOfFunctionLowering` to check if a builder is already set and just directly call the callback in that case to allow nested call.

Also this should probably be renamed to something like `createBuilderOutsideOfFuncOpAndDo` if used for other things than global creations.

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


More information about the flang-commits mailing list