[clang] [OpenMP][Clang] Parsing support for num_teams lower bound (PR #180608)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 08:43:02 PST 2026
================
@@ -2290,8 +2290,26 @@ void OMPClausePrinter::VisitOMPDeviceClause(OMPDeviceClause *Node) {
void OMPClausePrinter::VisitOMPNumTeamsClause(OMPNumTeamsClause *Node) {
if (!Node->varlist_empty()) {
- OS << "num_teams";
- VisitOMPClauseList(Node, '(');
+ OS << "num_teams(";
+ // Handle lower-bound:upper-bound syntax when there are exactly 2
+ // expressions
+ if (Node->varlist_size() == 2) {
+ auto *I = Node->varlist_begin();
+ (*I)->printPretty(OS, nullptr, Policy, 0);
+ OS << ":";
+ ++I;
+ (*I)->printPretty(OS, nullptr, Policy, 0);
+ } else {
+ // For single expression or other cases, use comma-separated list
+ bool First = true;
+ for (auto *I = Node->varlist_begin(), *E = Node->varlist_end(); I != E;
+ ++I) {
+ if (!First)
+ OS << ",";
+ First = false;
+ (*I)->printPretty(OS, nullptr, Policy, 0);
+ }
----------------
ykhatav wrote:
Applied,thanks!
https://github.com/llvm/llvm-project/pull/180608
More information about the cfe-commits
mailing list