[flang-commits] [flang] [llvm] [Flang][OpenMP][WIP] Initial OpenMP 6.1 Polymorpic Mapping Implementation (PR #228747)

via flang-commits flang-commits at lists.llvm.org
Sat Oct 3 10:19:39 PDT 2026


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 origin/main HEAD --extensions h,cpp -- flang/lib/Lower/Bridge.cpp flang/lib/Lower/ConvertVariable.cpp flang/lib/Lower/OpenMP/Utils.cpp flang/lib/Lower/OpenMP/Utils.h flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp flang/lib/Semantics/check-omp-structure.cpp flang/lib/Semantics/check-omp-structure.h --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index ba4a8482f..eee0c4974 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -12,6 +12,7 @@
 
 #include "flang/Lower/Bridge.h"
 
+#include "OpenMP/Utils.h"
 #include "flang/Evaluate/tools.h"
 #include "flang/Lower/Allocatable.h"
 #include "flang/Lower/CUDA.h"
@@ -86,7 +87,6 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Target/TargetMachine.h"
-#include "OpenMP/Utils.h"
 #include <optional>
 
 #define DEBUG_TYPE "flang-lower-bridge"
diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp
index eb9a1100d..557d61403 100644
--- a/flang/lib/Lower/ConvertVariable.cpp
+++ b/flang/lib/Lower/ConvertVariable.cpp
@@ -11,6 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "flang/Lower/ConvertVariable.h"
+#include "OpenMP/Utils.h"
 #include "flang/Lower/AbstractConverter.h"
 #include "flang/Lower/Allocatable.h"
 #include "flang/Lower/BoxAnalyzer.h"
@@ -49,7 +50,6 @@
 #include "mlir/Dialect/Complex/IR/Complex.h"
 #include "mlir/Dialect/OpenACC/OpenACC.h"
 #include "mlir/Dialect/OpenMP/Utils/Utils.h"
-#include "OpenMP/Utils.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/CommandLine.h"
@@ -3384,13 +3384,13 @@ void Fortran::lower::createRuntimeTypeInfoGlobal(
   // For OpenMP we make the compiler generated RTTI objects declare-target
   // globals so that we do not have to transfer the RTTI to device on each map
   // of a RTTI dependent type and all RTTI remains consistent on device, in
-  // particular the polymorphic function dispatch table, the RTTI and the dispatch
-  // functions are lowered to device and have device consistent addresses through
-  // declare target, and we simply have to then redirect any mapped polymorphic
-  // types descriptor to point at this global type information to access the
-  // device side dispatch table for the type and any other RTTI that's required
-  // for things like SELECT statements, dynamic variable access and polymorphic
-  // intrinsic functions.
+  // particular the polymorphic function dispatch table, the RTTI and the
+  // dispatch functions are lowered to device and have device consistent
+  // addresses through declare target, and we simply have to then redirect any
+  // mapped polymorphic types descriptor to point at this global type
+  // information to access the device side dispatch table for the type and any
+  // other RTTI that's required for things like SELECT statements, dynamic
+  // variable access and polymorphic intrinsic functions.
   if (converter.getFoldingContext().languageFeatures().IsEnabled(
           Fortran::common::LanguageFeature::OpenMP) &&
       mlir::omp::getOpenMPVersionAttribute(converter.getModuleOp(),
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index c930105d5..6053351ef 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -850,9 +850,9 @@ void OmpStructureChecker::CheckPolymorphicMapObjects(
   llvm::SmallPtrSet<const Symbol *, 8> diagnosed;
   for (const parser::OmpObject &object : objects.v) {
     llvm::SmallVector<const Symbol *, 2> candidates;
-    if (const Symbol * symbol{GetObjectSymbol(object, /*ultimate=*/true)})
+    if (const Symbol *symbol{GetObjectSymbol(object, /*ultimate=*/true)})
       candidates.push_back(symbol);
-    if (const Symbol * symbol{GetBaseObjectSymbol(object)})
+    if (const Symbol *symbol{GetBaseObjectSymbol(object)})
       candidates.push_back(symbol);
 
     for (const Symbol *symbol : candidates) {

``````````

</details>


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


More information about the flang-commits mailing list