================ @@ -7742,15 +7744,42 @@ class MappableExprsHandler { else if (C->getMapType() == OMPC_MAP_alloc) Kind = Allocs; const auto *EI = C->getVarRefs().begin(); - for (const auto L : C->component_lists()) { - const Expr *E = (C->getMapLoc().isValid()) ? *EI : nullptr; - InfoGen(std::get<0>(L), Kind, std::get<1>(L), C->getMapType(), - C->getMapTypeModifiers(), std::nullopt, - /*ReturnDevicePointer=*/false, C->isImplicit(), std::get<2>(L), - E); - ++EI; + if (*EI && !isa<OMPArraySectionExpr>(*EI)) { + for (const auto L : C->component_lists()) { + const Expr *E = (C->getMapLoc().isValid()) ? *EI : nullptr; + InfoGen(std::get<0>(L), Kind, std::get<1>(L), C->getMapType(), + C->getMapTypeModifiers(), std::nullopt, + /*ReturnDevicePointer=*/false, C->isImplicit(), + std::get<2>(L), E); + ++EI; + } + } + } + + // Process the maps with sections. + for (const auto *Cl : Clauses) { + const auto *C = dyn_cast<OMPMapClause>(Cl); + if (!C) + continue; + MapKind Kind = Other; + if (llvm::is_contained(C->getMapTypeModifiers(), + OMPC_MAP_MODIFIER_present)) + Kind = Present; + else if (C->getMapType() == OMPC_MAP_alloc) + Kind = Allocs; + const auto *EI = C->getVarRefs().begin(); + if (*EI && isa<OMPArraySectionExpr>(*EI)) { + for (const auto L : C->component_lists()) { + const Expr *E = (C->getMapLoc().isValid()) ? *EI : nullptr; + InfoGen(std::get<0>(L), Kind, std::get<1>(L), C->getMapType(), + C->getMapTypeModifiers(), std::nullopt, + /*ReturnDevicePointer=*/false, C->isImplicit(), + std::get<2>(L), E); + ++EI; + } ---------------- jdoerfert wrote:
This duplicates the loop nest, which is very unfortunate. Why not actually sort the clause list? That will also make it easier to add/change things in the future, e.g., we simply modify the comparator. https://github.com/llvm/llvm-project/pull/72410 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits