https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/102716
None >From 2850033e440d7c43fcd7bdf55ed05de482697eaa Mon Sep 17 00:00:00 2001 From: Shilei Tian <i...@tianshilei.me> Date: Fri, 9 Aug 2024 23:11:43 -0400 Subject: [PATCH] [Clang][OpenMP] Fix the wrong transform of `num_teams` claused introduced in #99732 --- clang/lib/Sema/TreeTransform.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 8f6f30434af65e..029d6d57319ac0 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -11018,11 +11018,16 @@ TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *C) { template <typename Derived> OMPClause * TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *C) { - ExprResult E = getDerived().TransformExpr(C->getNumTeams().front()); - if (E.isInvalid()) - return nullptr; + llvm::SmallVector<Expr *, 3> Vars; + Vars.reserve(C->varlist_size()); + for (auto *VE : C->varlist()) { + ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE)); + if (EVar.isInvalid()) + return nullptr; + Vars.push_back(EVar.get()); + } return getDerived().RebuildOMPNumTeamsClause( - E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template <typename Derived> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits