[clang] [Clang][OpenMP] Fix the wrong transform of `num_teams` claused introduced in #99732 (PR #102716)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 9 20:13:42 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Shilei Tian (shiltian)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/102716.diff
1 Files Affected:
- (modified) clang/lib/Sema/TreeTransform.h (+9-4)
``````````diff
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>
``````````
</details>
https://github.com/llvm/llvm-project/pull/102716
More information about the cfe-commits
mailing list