[flang-commits] [flang] [mlir] [mlir][OpenMP][flang] make private variable allocation implicit in omp.private (PR #124019)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Fri Jan 24 12:33:13 PST 2025


================
@@ -94,8 +95,60 @@ void DataSharingProcessor::insertDeallocs() {
 
 void DataSharingProcessor::cloneSymbol(const semantics::Symbol *sym) {
   bool isFirstPrivate = sym->test(semantics::Symbol::Flag::OmpFirstPrivate);
-  bool success = converter.createHostAssociateVarClone(
-      *sym, /*skipDefaultInit=*/isFirstPrivate);
+
+  // If we are doing eager-privatization on a symbol created using delayed
+  // privatization there could be incompatible types here e.g.
+  // fir.ref<fir.box<fir.array<>>>
+  bool success = false;
+  [&]() {
----------------
luporl wrote:

This lambda looks strange to me. It is used just to provide an easy way to skip the normal case, when eager-privatization is detected, right?
What about changing it to:
```
bool success = [&]() {
...
```

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


More information about the flang-commits mailing list