[flang-commits] [clang] [flang] [mlir] [Flang][OpenMP] Lower DECLARE TARGET INDIRECT clause (PR #208387)
via flang-commits
flang-commits at lists.llvm.org
Tue Aug 11 10:47:19 PDT 2026
================
@@ -478,6 +474,25 @@ bool ClauseProcessor::processDeviceType(
return false;
}
+bool ClauseProcessor::processIndirect(
+ mlir::omp::IndirectClauseOps &result) const {
+ if (auto *clause = findUniqueClause<omp::clause::Indirect>()) {
+ // Case: declare target ... indirect[(scalar-logical-constant)]
+ // An `indirect` clause with no argument defaults to `.true.`.
+ bool isIndirect = true;
+ if (clause->v) {
+ auto foldedExpr = Fortran::evaluate::Fold(
+ semaCtx.foldingContext(), Fortran::common::Clone(*clause->v));
+ if (auto logicalVal = Fortran::evaluate::GetScalarConstantValue<
----------------
chichunchen wrote:
Fortran::evaluate::LogicalResult is defined in flang/include/flang/Evaluate/type.h as `using LogicalResult = Type<TypeCategory::Logical, 4>;` so if the folded expression is logical(1) or logical(8) then logicaVal well get `std::nullopt`. (.false._1 and .false._8 -> true)
https://github.com/llvm/llvm-project/pull/208387
More information about the flang-commits
mailing list