[flang-commits] [flang] [flang][OpenMP] Handle fixed length `charater`s in delayed privatization (PR #126704)

via flang-commits flang-commits at lists.llvm.org
Tue Feb 11 01:55:32 PST 2025


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 9d134f26ea83cd53e7b38220c2b95d6f20ba3221 b84c9d54c6ddb0f63e24803fb412765e3ef0cf92 --extensions cpp,h -- flang/include/flang/Optimizer/Dialect/FIRType.h flang/lib/Lower/OpenMP/PrivateReductionUtils.cpp flang/lib/Optimizer/Dialect/FIRType.cpp
``````````

</details>

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

``````````diff
diff --git a/flang/lib/Lower/OpenMP/PrivateReductionUtils.cpp b/flang/lib/Lower/OpenMP/PrivateReductionUtils.cpp
index 9a7379064e..ed89861a52 100644
--- a/flang/lib/Lower/OpenMP/PrivateReductionUtils.cpp
+++ b/flang/lib/Lower/OpenMP/PrivateReductionUtils.cpp
@@ -198,19 +198,19 @@ static void getLengthParameters(fir::FirOpBuilder &builder, mlir::Location loc,
   // character already has static LEN. genLengthParameters may still return them
   // in this case.
   auto strTy = [&]() -> fir::CharacterType {
-      if (auto result = mlir::dyn_cast<fir::CharacterType>(
-              fir::unwrapRefOrBoxedRefType(moldArg.getType())))
-        return result;
+    if (auto result = mlir::dyn_cast<fir::CharacterType>(
+            fir::unwrapRefOrBoxedRefType(moldArg.getType())))
+      return result;
 
-      if (auto result = mlir::dyn_cast<fir::CharacterType>(fir::unwrapRefType(
-              fir::unwrapSeqOrBoxedSeqType(moldArg.getType()))))
-        return result;
+    if (auto result = mlir::dyn_cast<fir::CharacterType>(fir::unwrapRefType(
+            fir::unwrapSeqOrBoxedSeqType(moldArg.getType()))))
+      return result;
 
-      return nullptr;
+    return nullptr;
   }();
 
   if (strTy && strTy.hasConstantLen())
-      lenParams.resize(0);
+    lenParams.resize(0);
 }
 
 static bool
diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp
index 1684319bfa..0a30d4beeb 100644
--- a/flang/lib/Optimizer/Dialect/FIRType.cpp
+++ b/flang/lib/Optimizer/Dialect/FIRType.cpp
@@ -427,12 +427,12 @@ mlir::Type unwrapAllRefAndSeqType(mlir::Type ty) {
 }
 
 mlir::Type unwrapRefOrBoxedRefType(mlir::Type ty) {
-    mlir::Type eleTy;
+  mlir::Type eleTy;
 
-    if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(ty))
-      eleTy = boxTy.getEleTy();
+  if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(ty))
+    eleTy = boxTy.getEleTy();
 
-    return unwrapRefType(eleTy);
+  return unwrapRefType(eleTy);
 }
 
 mlir::Type unwrapSeqOrBoxedSeqType(mlir::Type ty) {

``````````

</details>


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


More information about the flang-commits mailing list