[flang] [llvm] [Flang] Adding lowering for the allocation and deallocation of coarrays (PR #182110)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 06:36:38 PST 2026
================
@@ -478,6 +481,29 @@ class AllocateStmtHelper {
!box.isPointer();
unsigned allocatorIdx = Fortran::lower::getAllocatorIdx(alloc.getSymbol());
+ const Fortran::lower::SomeExpr *expr =
+ Fortran::semantics::GetExpr(alloc.getAllocObj());
+ std::optional<Fortran::evaluate::DataRef> dataRef =
+ !expr ? std::nullopt : Fortran::evaluate::ExtractDataRef(expr);
+ bool isCoarrayAllocate = alloc.hasCoarraySpec();
+
+ if (isCoarrayAllocate) {
----------------
jeanPerier wrote:
```suggestion
if (alloc.hasCoarraySpec() {
```
Nit and probably a personal preference, but if you are not reusing the boolean and the condition is simple, I find that the variable adds more complexity.
https://github.com/llvm/llvm-project/pull/182110
More information about the llvm-commits
mailing list