[flang-commits] [flang] [Flang] Add partial support for lowering procedure pointer assignment. (PR #70461)

via flang-commits flang-commits at lists.llvm.org
Fri Oct 27 08:12:00 PDT 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 3e32b809001cf3a9d6f9cea4030fb9fe66f083f2 6ca8970b425dcb478af03b1d2efbf26c0a91a63d -- flang/lib/Lower/Bridge.cpp flang/lib/Lower/ConvertCall.cpp flang/lib/Lower/ConvertProcedureDesignator.cpp flang/lib/Lower/ConvertType.cpp flang/lib/Lower/ConvertVariable.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp
index 6918001a3f17..dbe7ddcbd38e 100644
--- a/flang/lib/Lower/ConvertCall.cpp
+++ b/flang/lib/Lower/ConvertCall.cpp
@@ -334,9 +334,9 @@ fir::ExtendedValue Fortran::lower::genCallOpAndResult(
       operands.push_back(builder.create<fir::BoxAddrOp>(loc, funcType, func));
     } else
       operands.push_back(
-        funcPointer.getType().isa<fir::BoxProcType>()
-            ? builder.create<fir::BoxAddrOp>(loc, funcType, funcPointer)
-            : builder.createConvert(loc, funcType, funcPointer));
+          funcPointer.getType().isa<fir::BoxProcType>()
+              ? builder.create<fir::BoxAddrOp>(loc, funcType, funcPointer)
+              : builder.createConvert(loc, funcType, funcPointer));
   }
 
   // Deal with potential mismatches in arguments types. Passing an array to a
diff --git a/flang/lib/Lower/ConvertType.cpp b/flang/lib/Lower/ConvertType.cpp
index 25e301dbf8a4..3bda1c05a3f7 100644
--- a/flang/lib/Lower/ConvertType.cpp
+++ b/flang/lib/Lower/ConvertType.cpp
@@ -586,7 +586,7 @@ struct TypeBuilderImpl {
     // Use association. Need to get to the ultimate definition.
     if (auto procDetails{proc->detailsIf<UseDetails>()}) {
       auto sym{procDetails->symbol()};
-      for (;sym.detailsIf<UseDetails>();)
+      for (; sym.detailsIf<UseDetails>();)
         sym = sym.detailsIf<UseDetails>()->symbol();
       if (auto pd{sym.detailsIf<SubprogramDetails>()})
         return genFunctionType(*pd);
diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp
index 54dd5709b4a7..0d9a99c8bbcb 100644
--- a/flang/lib/Lower/ConvertVariable.cpp
+++ b/flang/lib/Lower/ConvertVariable.cpp
@@ -1708,12 +1708,11 @@ genAllocatableOrPointerDeclare(Fortran::lower::AbstractConverter &converter,
 }
 
 /// Map a procedure pointer
-static void
-genProcPointer(Fortran::lower::AbstractConverter &converter,
-               Fortran::lower::SymMap &symMap,
-               const Fortran::semantics::Symbol &sym,
-               mlir::Value addr, bool force = false) {
-  genDeclareSymbol(converter, symMap, sym, addr, mlir::Value {},
+static void genProcPointer(Fortran::lower::AbstractConverter &converter,
+                           Fortran::lower::SymMap &symMap,
+                           const Fortran::semantics::Symbol &sym,
+                           mlir::Value addr, bool force = false) {
+  genDeclareSymbol(converter, symMap, sym, addr, mlir::Value{},
                    /*shape=*/std::nullopt,
                    /*lbounds=*/std::nullopt, force);
 }

``````````

</details>


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


More information about the flang-commits mailing list