diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp index 1204ba77c1d49..e3b4fb820d80b 100644 --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -683,7 +683,8 @@ createTargetDataOp(Fortran::lower::AbstractConverter &converter, llvm::SmallVector mapTypes; auto addMapClause = [&firOpBuilder, &converter, &mapOperands, - &mapTypes](const auto &mapClause) { + &mapTypes](const auto &mapClause, + mlir::Location ¤tLocation) { auto mapType = std::get( std::get>(mapClause->v.t) ->t); @@ -725,10 +726,26 @@ createTargetDataOp(Fortran::lower::AbstractConverter &converter, mapTypeBits)); llvm::SmallVector mapOperand; + /// Check for unsupported map operand types. + for (const Fortran::parser::OmpObject &ompObject : + std::get(mapClause->v.t).v) { + if (Fortran::parser::Unwrap(ompObject) || + Fortran::parser::Unwrap( + ompObject)) + TODO(currentLocation, + "OMPD_target_data for Array Expressions or Structure Components"); + } genObjectList(std::get(mapClause->v.t), converter, mapOperand); for (mlir::Value mapOp : mapOperand) { + /// Check for unsupported map operand types. + mlir::Type checkType = mapOp.getType(); + if (auto refType = checkType.dyn_cast()) + checkType = refType.getElementType(); + if (checkType.isa()) + TODO(currentLocation, "OMPD_target_data MapOperand BoxType"); + mapOperands.push_back(mapOp); mapTypes.push_back(mapTypeAttr); } @@ -764,7 +781,7 @@ createTargetDataOp(Fortran::lower::AbstractConverter &converter, nowaitAttr = firOpBuilder.getUnitAttr(); } else if (const auto &mapClause = std::get_if(&clause.u)) { - addMapClause(mapClause); + addMapClause(mapClause, currentLocation); } else { TODO(currentLocation, "OMPD_target unhandled clause"); }