Skip to content

Conversation

@mdfazlay
Copy link
Contributor

This PR enhances the OpenMP nowait clause implementation by adding support for optional argument in both parsing and semantic analysis phases.

Reference:

  1. OpenMP 6.0 Specification, page 481

@mdfazlay mdfazlay requested a review from mjklemm September 18, 2025 19:06
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang:as-a-library libclang and C++ API flang:openmp clang:openmp OpenMP related changes to Clang labels Sep 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 18, 2025

@llvm/pr-subscribers-clang
@llvm/pr-subscribers-clang-modules

@llvm/pr-subscribers-flang-openmp

Author: Fazlay Rabbi (mdfazlay)

Changes

This PR enhances the OpenMP nowait clause implementation by adding support for optional argument in both parsing and semantic analysis phases.

Reference:

  1. OpenMP 6.0 Specification, page 481

Patch is 39.54 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/159628.diff

26 Files Affected:

  • (modified) clang/include/clang/AST/OpenMPClause.h (+51-7)
  • (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+2-1)
  • (modified) clang/include/clang/Sema/SemaOpenMP.h (+4-2)
  • (modified) clang/lib/AST/OpenMPClause.cpp (+13-1)
  • (modified) clang/lib/AST/StmtProfile.cpp (+4-1)
  • (modified) clang/lib/Parse/ParseOpenMP.cpp (+3-2)
  • (modified) clang/lib/Sema/SemaOpenMP.cpp (+22-3)
  • (modified) clang/lib/Sema/TreeTransform.h (+19-2)
  • (modified) clang/lib/Serialization/ASTReader.cpp (+4-1)
  • (modified) clang/lib/Serialization/ASTWriter.cpp (+4-1)
  • (added) clang/test/OpenMP/nowait_ast_print.cpp (+56)
  • (modified) clang/test/OpenMP/target_enter_data_nowait_messages.cpp (+11-3)
  • (modified) clang/test/OpenMP/target_exit_data_nowait_messages.cpp (+7-3)
  • (modified) clang/test/OpenMP/target_nowait_messages.cpp (+11-2)
  • (modified) clang/test/OpenMP/target_parallel_for_nowait_messages.cpp (+11-3)
  • (modified) clang/test/OpenMP/target_parallel_for_simd_nowait_messages.cpp (+11-3)
  • (modified) clang/test/OpenMP/target_parallel_nowait_messages.cpp (+12-3)
  • (modified) clang/test/OpenMP/target_simd_nowait_messages.cpp (+11-3)
  • (modified) clang/test/OpenMP/target_teams_distribute_nowait_messages.cpp (+3-4)
  • (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_nowait_messages.cpp (+11-3)
  • (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_nowait_messages.cpp (+11-3)
  • (modified) clang/test/OpenMP/target_teams_distribute_simd_nowait_messages.cpp (+11-3)
  • (modified) clang/test/OpenMP/target_teams_nowait_messages.cpp (+11-4)
  • (modified) clang/test/OpenMP/target_update_nowait_messages.cpp (+8-4)
  • (modified) clang/tools/libclang/CIndex.cpp (+3-1)
  • (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+2)
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index b2a6d4b9182b0..fd90988971d8d 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -2217,18 +2217,62 @@ class OMPOrderedClause final
 /// This represents 'nowait' clause in the '#pragma omp ...' directive.
 ///
 /// \code
-/// #pragma omp for nowait
+/// #pragma omp for nowait (cond)
 /// \endcode
-/// In this example directive '#pragma omp for' has 'nowait' clause.
-class OMPNowaitClause final : public OMPNoChildClause<llvm::omp::OMPC_nowait> {
+/// In this example directive '#pragma omp for' has simple 'nowait' clause with
+/// condition 'cond'.
+class OMPNowaitClause final : public OMPClause {
+  friend class OMPClauseReader;
+
+  /// Location of '('.
+  SourceLocation LParenLoc;
+
+  /// Condition of the 'nowait' clause.
+  Stmt *Condition = nullptr;
+
+  /// Set condition.
+  void setCondition(Expr *Cond) { Condition = Cond; }
+
 public:
-  /// Build 'nowait' clause.
+  /// Build 'nowait' clause with condition \a Cond.
   ///
+  /// \param Cond Condition of the clause.
   /// \param StartLoc Starting location of the clause.
+  /// \param LParenLoc Location of '('.
   /// \param EndLoc Ending location of the clause.
-  OMPNowaitClause(SourceLocation StartLoc = SourceLocation(),
-                  SourceLocation EndLoc = SourceLocation())
-      : OMPNoChildClause(StartLoc, EndLoc) {}
+  OMPNowaitClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc,
+                  SourceLocation EndLoc)
+      : OMPClause(llvm::omp::OMPC_nowait, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), Condition(Cond) {}
+
+  /// Build an empty clause.
+  OMPNowaitClause()
+      : OMPClause(llvm::omp::OMPC_nowait, SourceLocation(), SourceLocation()) {}
+
+  /// Sets the location of '('.
+  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
+
+  /// Returns the location of '('.
+  SourceLocation getLParenLoc() const { return LParenLoc; }
+
+  /// Returns condition.
+  Expr *getCondition() const { return cast_or_null<Expr>(Condition); }
+
+  child_range children() { return child_range(&Condition, &Condition + 1); }
+
+  const_child_range children() const {
+    return const_child_range(&Condition, &Condition + 1);
+  }
+
+  child_range used_children();
+  const_child_range used_children() const {
+    auto Children = const_cast<OMPNowaitClause *>(this)->used_children();
+    return const_child_range(Children.begin(), Children.end());
+  }
+
+  static bool classof(const OMPClause *T) {
+    return T->getClauseKind() == llvm::omp::OMPC_nowait;
+  }
 };
 
 /// This represents 'untied' clause in the '#pragma omp ...' directive.
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index c1944487716de..8f1500993dcc8 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -3576,7 +3576,8 @@ bool RecursiveASTVisitor<Derived>::VisitOMPOrderedClause(OMPOrderedClause *C) {
 }
 
 template <typename Derived>
-bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *) {
+bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *C) {
+  TRY_TO(TraverseStmt(C->getCondition()));
   return true;
 }
 
diff --git a/clang/include/clang/Sema/SemaOpenMP.h b/clang/include/clang/Sema/SemaOpenMP.h
index 23827051ed724..511aab39ec93d 100644
--- a/clang/include/clang/Sema/SemaOpenMP.h
+++ b/clang/include/clang/Sema/SemaOpenMP.h
@@ -1002,8 +1002,10 @@ class SemaOpenMP : public SemaBase {
   OMPClause *ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc,
                                SourceLocation EndLoc);
   /// Called on well-formed 'nowait' clause.
-  OMPClause *ActOnOpenMPNowaitClause(SourceLocation StartLoc,
-                                     SourceLocation EndLoc);
+  OMPClause *
+  ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc,
+                          SourceLocation LParenLoc = SourceLocation(),
+                          Expr *Condition = nullptr);
   /// Called on well-formed 'untied' clause.
   OMPClause *ActOnOpenMPUntiedClause(SourceLocation StartLoc,
                                      SourceLocation EndLoc);
diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp
index 69d33019c0952..c7876cc9cd1db 100644
--- a/clang/lib/AST/OpenMPClause.cpp
+++ b/clang/lib/AST/OpenMPClause.cpp
@@ -306,6 +306,13 @@ OMPClause::child_range OMPIfClause::used_children() {
   return child_range(&Condition, &Condition + 1);
 }
 
+OMPClause::child_range OMPNowaitClause::used_children() {
+  if (Condition)
+    return child_range(&Condition, &Condition + 1);
+  Stmt *Null = nullptr;
+  return child_range(&Null, &Null);
+}
+
 OMPClause::child_range OMPGrainsizeClause::used_children() {
   if (Stmt **C = getAddrOfExprAsWritten(getPreInitStmt()))
     return child_range(C, C + 1);
@@ -2004,8 +2011,13 @@ void OMPClausePrinter::VisitOMPOrderedClause(OMPOrderedClause *Node) {
   }
 }
 
-void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *) {
+void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *Node) {
   OS << "nowait";
+  if (auto *Cond = Node->getCondition()) {
+    OS << "(";
+    Cond->printPretty(OS, nullptr, Policy, 0);
+    OS << ")";
+  }
 }
 
 void OMPClausePrinter::VisitOMPUntiedClause(OMPUntiedClause *) {
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index 37c4d43ec0b2f..65a03cd7f91b3 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -578,7 +578,10 @@ void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) {
     Profiler->VisitStmt(Num);
 }
 
-void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {}
+void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *C) {
+  if (C->getCondition())
+    Profiler->VisitStmt(C->getCondition());
+}
 
 void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {}
 
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 7dceb2d208352..c17f499a7710f 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -3025,6 +3025,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
   case OMPC_simdlen:
   case OMPC_collapse:
   case OMPC_ordered:
+  case OMPC_nowait:
   case OMPC_priority:
   case OMPC_grainsize:
   case OMPC_num_tasks:
@@ -3073,7 +3074,8 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
       ErrorFound = true;
     }
 
-    if ((CKind == OMPC_ordered || CKind == OMPC_partial) &&
+    if ((CKind == OMPC_ordered || CKind == OMPC_nowait ||
+         CKind == OMPC_partial) &&
         PP.LookAhead(/*N=*/0).isNot(tok::l_paren))
       Clause = ParseOpenMPClause(CKind, WrongDirective);
     else if (CKind == OMPC_grainsize || CKind == OMPC_num_tasks ||
@@ -3138,7 +3140,6 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
   case OMPC_holds:
     Clause = ParseOpenMPSingleExprClause(CKind, WrongDirective);
     break;
-  case OMPC_nowait:
   case OMPC_untied:
   case OMPC_mergeable:
   case OMPC_read:
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 6a7a5a9a4303a..b14bbfc163e9c 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -15646,6 +15646,9 @@ OMPClause *SemaOpenMP::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind,
   case OMPC_ordered:
     Res = ActOnOpenMPOrderedClause(StartLoc, EndLoc, LParenLoc, Expr);
     break;
+  case OMPC_nowait:
+    Res = ActOnOpenMPNowaitClause(StartLoc, EndLoc, LParenLoc, Expr);
+    break;
   case OMPC_priority:
     Res = ActOnOpenMPPriorityClause(Expr, StartLoc, LParenLoc, EndLoc);
     break;
@@ -15701,7 +15704,6 @@ OMPClause *SemaOpenMP::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind,
   case OMPC_aligned:
   case OMPC_copyin:
   case OMPC_copyprivate:
-  case OMPC_nowait:
   case OMPC_untied:
   case OMPC_mergeable:
   case OMPC_threadprivate:
@@ -17233,9 +17235,26 @@ OMPClause *SemaOpenMP::ActOnOpenMPClause(OpenMPClauseKind Kind,
 }
 
 OMPClause *SemaOpenMP::ActOnOpenMPNowaitClause(SourceLocation StartLoc,
-                                               SourceLocation EndLoc) {
+                                               SourceLocation EndLoc,
+                                               SourceLocation LParenLoc,
+                                               Expr *Condition) {
+  Expr *ValExpr = Condition;
+  if (Condition && LParenLoc.isValid()) {
+    if (!Condition->isValueDependent() && !Condition->isTypeDependent() &&
+        !Condition->isInstantiationDependent() &&
+        !Condition->containsUnexpandedParameterPack()) {
+      ExprResult Val = SemaRef.CheckBooleanCondition(StartLoc, Condition);
+      if (Val.isInvalid())
+        return nullptr;
+
+      ValExpr = Val.get();
+    }
+  } else {
+    ValExpr = nullptr;
+  }
   DSAStack->setNowaitRegion();
-  return new (getASTContext()) OMPNowaitClause(StartLoc, EndLoc);
+  return new (getASTContext())
+      OMPNowaitClause(ValExpr, StartLoc, LParenLoc, EndLoc);
 }
 
 OMPClause *SemaOpenMP::ActOnOpenMPUntiedClause(SourceLocation StartLoc,
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 242ffb09af006..a748219051304 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -1857,6 +1857,17 @@ class TreeTransform {
                                                        LParenLoc, Num);
   }
 
+  /// Build a new OpenMP 'nowait' clause.
+  ///
+  /// By default, performs semantic analysis to build the new OpenMP clause.
+  /// Subclasses may override this routine to provide different behavior.
+  OMPClause *RebuildOMPNowaitClause(Expr *Condition, SourceLocation StartLoc,
+                                    SourceLocation LParenLoc,
+                                    SourceLocation EndLoc) {
+    return getSema().OpenMP().ActOnOpenMPNowaitClause(StartLoc, EndLoc,
+                                                      LParenLoc, Condition);
+  }
+
   /// Build a new OpenMP 'private' clause.
   ///
   /// By default, performs semantic analysis to build the new OpenMP clause.
@@ -10569,8 +10580,14 @@ TreeTransform<Derived>::TransformOMPDetachClause(OMPDetachClause *C) {
 template <typename Derived>
 OMPClause *
 TreeTransform<Derived>::TransformOMPNowaitClause(OMPNowaitClause *C) {
-  // No need to rebuild this clause, no template-dependent parameters.
-  return C;
+  ExprResult Cond;
+  if (auto *Condition = C->getCondition()) {
+    Cond = getDerived().TransformExpr(Condition);
+    if (Cond.isInvalid())
+      return nullptr;
+  }
+  return getDerived().RebuildOMPNowaitClause(Cond.get(), C->getBeginLoc(),
+                                             C->getLParenLoc(), C->getEndLoc());
 }
 
 template <typename Derived>
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 9ee8a0fb0f060..8f9fda88bd661 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -11673,7 +11673,10 @@ void OMPClauseReader::VisitOMPDetachClause(OMPDetachClause *C) {
   C->setLParenLoc(Record.readSourceLocation());
 }
 
-void OMPClauseReader::VisitOMPNowaitClause(OMPNowaitClause *) {}
+void OMPClauseReader::VisitOMPNowaitClause(OMPNowaitClause *C) {
+  C->setCondition(Record.readSubExpr());
+  C->setLParenLoc(Record.readSourceLocation());
+}
 
 void OMPClauseReader::VisitOMPUntiedClause(OMPUntiedClause *) {}
 
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 3293a54a0a093..fac91d86858e7 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -7926,7 +7926,10 @@ void OMPClauseWriter::VisitOMPOrderedClause(OMPOrderedClause *C) {
   Record.AddSourceLocation(C->getLParenLoc());
 }
 
-void OMPClauseWriter::VisitOMPNowaitClause(OMPNowaitClause *) {}
+void OMPClauseWriter::VisitOMPNowaitClause(OMPNowaitClause *C) {
+  Record.AddStmt(C->getCondition());
+  Record.AddSourceLocation(C->getLParenLoc());
+}
 
 void OMPClauseWriter::VisitOMPUntiedClause(OMPUntiedClause *) {}
 
diff --git a/clang/test/OpenMP/nowait_ast_print.cpp b/clang/test/OpenMP/nowait_ast_print.cpp
new file mode 100644
index 0000000000000..4151a397beb9c
--- /dev/null
+++ b/clang/test/OpenMP/nowait_ast_print.cpp
@@ -0,0 +1,56 @@
+// Check no warnings/errors
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+// Check AST and unparsing
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -ast-dump  %s | FileCheck %s --check-prefix=DUMP
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -ast-print %s | FileCheck %s --check-prefix=PRINT
+
+// Check same results after serialization round-trip
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -emit-pch -o %t %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -include-pch %t -ast-dump-all %s | FileCheck %s --check-prefix=DUMP
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -include-pch %t -ast-print    %s | FileCheck %s --check-prefix=PRINT
+
+#ifndef HEADER
+#define HEADER
+
+void nowait() {
+  int A=1;
+
+  // DUMP: OMPTargetDirective
+  // DUMP-NEXT: OMPNowaitClause
+  // DUMP-NEXT: <<<NULL>>>
+  // PRINT: #pragma omp target nowait
+  #pragma omp target nowait
+  {
+  }
+
+  // DUMP: OMPTargetDirective
+  // DUMP-NEXT: OMPNowaitClause
+  // DUMP-NEXT: XXBoolLiteralExpr {{.*}} 'bool' false
+  // PRINT: #pragma omp target nowait(false)
+  #pragma omp target nowait(false)
+  {
+  }
+
+  // DUMP: OMPTargetDirective
+  // DUMP-NEXT: OMPNowaitClause
+  // DUMP-NEXT: XXBoolLiteralExpr {{.*}} 'bool' true
+  // PRINT: #pragma omp target nowait(true)
+  #pragma omp target nowait(true)
+  {
+  }
+
+  // DUMP: OMPTargetDirective
+  // DUMP-NEXT: OMPNowaitClause
+  // DUMP-NEXT: BinaryOperator {{.*}} 'bool' '>'
+  // DUMP-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
+  // DUMP-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'A' 'int'
+  // DUMP-NEXT: IntegerLiteral {{.*}} 'int' 5
+  // PRINT: #pragma omp target nowait(A > 5)
+  #pragma omp target nowait(A>5)
+  {
+  }
+
+}
+#endif
\ No newline at end of file
diff --git a/clang/test/OpenMP/target_enter_data_nowait_messages.cpp b/clang/test/OpenMP/target_enter_data_nowait_messages.cpp
index ba5eaf1d2214a..0b892325a1c69 100644
--- a/clang/test/OpenMP/target_enter_data_nowait_messages.cpp
+++ b/clang/test/OpenMP/target_enter_data_nowait_messages.cpp
@@ -13,15 +13,23 @@ int main(int argc, char **argv) {
   {}
   #pragma omp target enter nowait data map(to: i) // expected-error {{expected an OpenMP directive}}
   {}
-  #pragma omp target enter data nowait() map(to: i) // expected-warning {{extra tokens at the end of '#pragma omp target enter data' are ignored}} expected-error {{expected at least one 'map' clause for '#pragma omp target enter data'}}
+  #pragma omp target enter data nowait() map(to: i) // expected-error {{expected expression}}
   {}
-  #pragma omp target enter data map(to: i) nowait( // expected-warning {{extra tokens at the end of '#pragma omp target enter data' are ignored}}
+  #pragma omp target enter data map(to: i) nowait( // expected-error {{expected expression}} //  expected-error {{expected ')'}} // expected-note {{to match this '('}}
   {}
   #pragma omp target enter data map(to: i) nowait (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target enter data' are ignored}}
   {}
   #pragma omp target enter data map(to: i) nowait device (-10u)
   {}
-  #pragma omp target enter data map(to: i) nowait (3.14) device (-10u) // expected-warning {{extra tokens at the end of '#pragma omp target enter data' are ignored}}
+  #pragma omp target enter data map(to: i) nowait (3.14) device (-10u)
+  {}
+  #pragma omp target enter data map(to: i) nowait (argc>> i)
+  {}
+  #pragma omp target enter data map(to: i) nowait (argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
+  {}
+  #pragma omp target enter data map(to: i) nowait (argc > 0 ? argv[1] : argv[2])
+  {}
+  #pragma omp target enter data map(to: i) nowait (S1) // expected-error {{use of undeclared identifier 'S1'}}
   {}
   #pragma omp target enter data map(to: i) nowait nowait // expected-error {{directive '#pragma omp target enter data' cannot contain more than one 'nowait' clause}}
   {}
diff --git a/clang/test/OpenMP/target_exit_data_nowait_messages.cpp b/clang/test/OpenMP/target_exit_data_nowait_messages.cpp
index 307e2c34b27fb..a248704a49e9e 100644
--- a/clang/test/OpenMP/target_exit_data_nowait_messages.cpp
+++ b/clang/test/OpenMP/target_exit_data_nowait_messages.cpp
@@ -8,11 +8,15 @@ int main(int argc, char **argv) {
   #pragma omp nowait target exit data map(from: i) // expected-error {{expected an OpenMP directive}}
   #pragma omp target nowait exit data map(from: i) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
   #pragma omp target exit nowait data map(from: i) // expected-error {{expected an OpenMP directive}}
-  #pragma omp target exit data nowait() map(from: i) // expected-warning {{extra tokens at the end of '#pragma omp target exit data' are ignored}} expected-error {{expected at least one 'map' clause for '#pragma omp target exit data'}}
-  #pragma omp target exit data map(from: i) nowait( // expected-warning {{extra tokens at the end of '#pragma omp target exit data' are ignored}}
+  #pragma omp target exit data nowait() map(from: i) // expected-error {{expected expression}}
+  #pragma omp target exit data map(from: i) nowait( // expected-error {{expected expression}} //  expected-error {{expected ')'}} // expected-note {{to match this '('}}
   #pragma omp target exit data map(from: i) nowait (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target exit data' are ignored}}
   #pragma omp target exit data map(from: i) nowait device (-10u)
-  #pragma omp target exit data map(from: i) nowait (3.14) device (-10u) // expected-warning {{extra tokens at the end of '#pragma omp target exit data' are ignored}}
+  #pragma omp target exit data map(from: i) nowait (3.14) device (-10u)
+  #pragma omp target exit data map(from: i) nowait (argc>> i)
+  #pragma omp target exit data map(from: i) nowait (argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
+  #pragma omp target exit data map(from: i) nowait (argc > 0 ? argv[1] : argv[2])
+  #pragma omp target exit data map(from: i) nowait (S1) // expected-error {{use of undeclared identifier 'S1'}}
   #pragma omp target exit data map(from: i) nowait nowait // expected-error {{directive '#pragma omp target exit data' cannot contain more than one 'nowait' clause}}
   #pragma omp target exit data nowait map(from: i) nowait // expected-error {{directive '#pragma omp target exit data' cannot contain more than one 'nowait' clause}}
   return 0;
diff --git a/clang/test/OpenMP/target_nowait_messages.cpp b/clang/test/OpenMP/target_nowait_messages.cpp
index 6b8a1f4d0ac47..6c2d85529eb71 100644
--- a/clang/test/OpenMP/target_nowait_messages.cpp
+++ b/clang/test/OpenMP/target_nowait_messages.cpp
@@ -6,13 +6,22 @@ void foo() {
 }
 
 int main(int argc, char **argv) {
-  #pragma omp target nowait( // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
+  int i;
+  #pragma omp target nowait(// expected-error {{expected expression}} //  expected-error {{expected ')'}} // expected-note {{to match this '('}}
   foo();
   #pragma omp target nowait (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
   foo();
   #pragma omp target nowait device (-10u)
   foo();
-  #pragma omp target nowait (3.14) device (-10u) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
+  #pragma omp target nowait (3.14) device (-10u)
+  foo();
+  #pragma omp target nowait (argc>> i)
+  foo();
+  #pragma omp target nowait (argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target nowait (argc > 0 ? argv[1] : argv[2])
+  foo();
+  #pragma omp target nowait (S1) // expected-error {{use of unde...
[truncated]

@mdfazlay
Copy link
Contributor Author

mdfazlay commented Sep 18, 2025

@mjklemm - This PR is based on and supersedes #135030. I have addressed both of your comments regarding the error messages (including the one about floating-point) in this PR. Please take a look and let me know if it is good now. Thank you.

@alexey-bataev @jplehr, FYI.

@mdfazlay mdfazlay force-pushed the nowait-with-optional-args-parsing-sema branch from 6a22af1 to 7ac98f1 Compare September 18, 2025 19:52
@mdfazlay
Copy link
Contributor Author

ping - @alexey-bataev @mjklemm

@mdfazlay mdfazlay force-pushed the nowait-with-optional-args-parsing-sema branch from 7ac98f1 to 8586a7c Compare September 24, 2025 15:53
@github-actions

This comment was marked as resolved.

@mdfazlay mdfazlay force-pushed the nowait-with-optional-args-parsing-sema branch from fc4f4fd to 4b90786 Compare September 25, 2025 16:20
Copy link
Member

@alexey-bataev alexey-bataev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, you'll need to handle capturing just like for if clause

@mdfazlay
Copy link
Contributor Author

mdfazlay commented Sep 25, 2025

IIRC, you'll need to handle capturing just like for if clause

ParseOpenMPSingleExprWithArgClause function is used to parse if clause as it accepts an optional directive modifier. But that is not the case for nowait clause as it only accepts an optional expr (no modifier), hence I used ParseOpenMPSingleExprClause for OMP >= 60. Please take a look and let me know if I missed s/t. Thank you, Alexey!

@mdfazlay mdfazlay force-pushed the nowait-with-optional-args-parsing-sema branch from 4b90786 to 333f924 Compare October 8, 2025 15:59
@mdfazlay mdfazlay requested a review from alexey-bataev October 8, 2025 18:11
@mdfazlay mdfazlay requested a review from alexey-bataev October 9, 2025 04:57
…o accept optional argument

This PR enhances the OpenMP `nowait` clause implementation by adding support
for optional argument in both parsing and semantic analysis phases.

Reference:
1. OpenMP 6.0 Specification, page 481
@mdfazlay mdfazlay force-pushed the nowait-with-optional-args-parsing-sema branch from 974a4b9 to 6f41617 Compare October 13, 2025 20:15
@mdfazlay mdfazlay merged commit f9910a2 into llvm:main Oct 13, 2025
13 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 13, 2025

LLVM Buildbot has detected a new failure on builder hip-third-party-libs-test running on ext_buildbot_hw_05-hip-docker while building clang,llvm at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/206/builds/7481

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/hip-tpl.py --jobs=32' (failure)
...
[4264/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseTentative.cpp.o
[4265/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExpr.cpp.o
[4266/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExprCXX.cpp.o
[4267/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDeclCXX.cpp.o
[4268/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseObjc.cpp.o
[4269/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseTemplate.cpp.o
[4270/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParsePragma.cpp.o
[4271/8121] Building AMDGPUGenRegisterBank.inc...
[4272/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseOpenMP.cpp.o
[4273/8121] Building CXX object tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o
FAILED: tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/lib/Dialect/ArmSME/IR -I/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR -I/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/include -I/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/include -I/home/botworker/bbot/hip-third-party-libs-test/build/include -I/home/botworker/bbot/hip-third-party-libs-test/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o -MF tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o.d -o tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o -c /home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp
In file included from /home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h:24,
                 from /home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/include/mlir/Dialect/ArmSME/Utils/Utils.h:19,
                 from /home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp:13:
/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h.inc:101:133: error: template argument 2 is invalid
  101 |   struct ArmSMETileOpInterfaceTrait : public ::mlir::OpInterface<ArmSMETileOpInterface, detail::ArmSMETileOpInterfaceInterfaceTraits>::Trait<ConcreteOp> {
      |                                                                                                                                     ^
/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h.inc:101:134: error: expected ‘{’ before ‘::’ token
  101 |   struct ArmSMETileOpInterfaceTrait : public ::mlir::OpInterface<ArmSMETileOpInterface, detail::ArmSMETileOpInterfaceInterfaceTraits>::Trait<ConcreteOp> {
      |                                                                                                                                      ^~
/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h.inc:88:21: warning: ‘mlir::IntegerAttr mlir::arm_sme::{anonymous}::ArmSMETileOpInterface::getTileId()’ used but never defined
   88 |   mlir::IntegerAttr getTileId();
      |                     ^~~~~~~~~
/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp:166:12: warning: ‘mlir::OpOperand* mlir::arm_sme::getTileOpOperand(mlir::arm_sme::{anonymous}::ArmSMETileOpInterface)’ defined but not used [-Wunused-function]
  166 | OpOperand *getTileOpOperand(arm_sme::ArmSMETileOpInterface tileOp) {
      |            ^~~~~~~~~~~~~~~~
/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp:158:6: warning: ‘bool mlir::arm_sme::hasTileResult(mlir::arm_sme::{anonymous}::ArmSMETileOpInterface)’ defined but not used [-Wunused-function]
  158 | bool hasTileResult(arm_sme::ArmSMETileOpInterface tileOp) {
      |      ^~~~~~~~~~~~~
/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp:153:6: warning: ‘bool mlir::arm_sme::isTriviallyCloneableTileOp(mlir::arm_sme::{anonymous}::ArmSMETileOpInterface)’ defined but not used [-Wunused-function]
  153 | bool isTriviallyCloneableTileOp(arm_sme::ArmSMETileOpInterface tileOp) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
[4274/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDecl.cpp.o
[4275/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataFlow/ConstantPropagationAnalysis.cpp.o
[4276/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataFlowFramework.cpp.o
[4277/8121] Building CXX object tools/mlir/tools/mlir-pdll/CMakeFiles/mlir-pdll.dir/mlir-pdll.cpp.o
[4278/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/SliceAnalysis.cpp.o
[4279/8121] Building CXX object tools/mlir/tools/mlir-irdl-to-cpp/CMakeFiles/mlir-irdl-to-cpp.dir/mlir-irdl-to-cpp.cpp.o
[4280/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/AliasAnalysis/LocalAliasAnalysis.cpp.o
[4281/8121] Building AMDGPUGenRegisterInfo.inc...
[4282/8121] Building CXX object tools/clang/lib/ASTMatchers/CMakeFiles/obj.clangASTMatchers.dir/ASTMatchersInternal.cpp.o
[4283/8121] Building CXX object tools/mlir/lib/Dialect/ArmSVE/TransformOps/CMakeFiles/obj.MLIRArmSVEVectorTransformOps.dir/ArmSVEVectorTransformOps.cpp.o
[4284/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataLayoutAnalysis.cpp.o
[4285/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/FlatLinearValueConstraints.cpp.o
[4286/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataFlow/IntegerRangeAnalysis.cpp.o
[4287/8121] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ASTDumper.cpp.o
[4288/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataFlow/DeadCodeAnalysis.cpp.o
[4289/8121] Building CXX object tools/mlir/lib/Dialect/ArmSVE/Transforms/CMakeFiles/obj.MLIRArmSVETransforms.dir/LegalizeVectorStorage.cpp.o
Step 7 (build cmake config) failure: build cmake config (failure)
...
[4264/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseTentative.cpp.o
[4265/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExpr.cpp.o
[4266/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExprCXX.cpp.o
[4267/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDeclCXX.cpp.o
[4268/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseObjc.cpp.o
[4269/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseTemplate.cpp.o
[4270/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParsePragma.cpp.o
[4271/8121] Building AMDGPUGenRegisterBank.inc...
[4272/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseOpenMP.cpp.o
[4273/8121] Building CXX object tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o
FAILED: tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/lib/Dialect/ArmSME/IR -I/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR -I/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/include -I/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/include -I/home/botworker/bbot/hip-third-party-libs-test/build/include -I/home/botworker/bbot/hip-third-party-libs-test/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o -MF tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o.d -o tools/mlir/lib/Dialect/ArmSME/IR/CMakeFiles/obj.MLIRArmSMEDialect.dir/Utils.cpp.o -c /home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp
In file included from /home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h:24,
                 from /home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/include/mlir/Dialect/ArmSME/Utils/Utils.h:19,
                 from /home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp:13:
/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h.inc:101:133: error: template argument 2 is invalid
  101 |   struct ArmSMETileOpInterfaceTrait : public ::mlir::OpInterface<ArmSMETileOpInterface, detail::ArmSMETileOpInterfaceInterfaceTraits>::Trait<ConcreteOp> {
      |                                                                                                                                     ^
/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h.inc:101:134: error: expected ‘{’ before ‘::’ token
  101 |   struct ArmSMETileOpInterfaceTrait : public ::mlir::OpInterface<ArmSMETileOpInterface, detail::ArmSMETileOpInterfaceInterfaceTraits>::Trait<ConcreteOp> {
      |                                                                                                                                      ^~
/home/botworker/bbot/hip-third-party-libs-test/build/tools/mlir/include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h.inc:88:21: warning: ‘mlir::IntegerAttr mlir::arm_sme::{anonymous}::ArmSMETileOpInterface::getTileId()’ used but never defined
   88 |   mlir::IntegerAttr getTileId();
      |                     ^~~~~~~~~
/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp:166:12: warning: ‘mlir::OpOperand* mlir::arm_sme::getTileOpOperand(mlir::arm_sme::{anonymous}::ArmSMETileOpInterface)’ defined but not used [-Wunused-function]
  166 | OpOperand *getTileOpOperand(arm_sme::ArmSMETileOpInterface tileOp) {
      |            ^~~~~~~~~~~~~~~~
/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp:158:6: warning: ‘bool mlir::arm_sme::hasTileResult(mlir::arm_sme::{anonymous}::ArmSMETileOpInterface)’ defined but not used [-Wunused-function]
  158 | bool hasTileResult(arm_sme::ArmSMETileOpInterface tileOp) {
      |      ^~~~~~~~~~~~~
/home/botworker/bbot/hip-third-party-libs-test/llvm-project/mlir/lib/Dialect/ArmSME/IR/Utils.cpp:153:6: warning: ‘bool mlir::arm_sme::isTriviallyCloneableTileOp(mlir::arm_sme::{anonymous}::ArmSMETileOpInterface)’ defined but not used [-Wunused-function]
  153 | bool isTriviallyCloneableTileOp(arm_sme::ArmSMETileOpInterface tileOp) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
[4274/8121] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDecl.cpp.o
[4275/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataFlow/ConstantPropagationAnalysis.cpp.o
[4276/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataFlowFramework.cpp.o
[4277/8121] Building CXX object tools/mlir/tools/mlir-pdll/CMakeFiles/mlir-pdll.dir/mlir-pdll.cpp.o
[4278/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/SliceAnalysis.cpp.o
[4279/8121] Building CXX object tools/mlir/tools/mlir-irdl-to-cpp/CMakeFiles/mlir-irdl-to-cpp.dir/mlir-irdl-to-cpp.cpp.o
[4280/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/AliasAnalysis/LocalAliasAnalysis.cpp.o
[4281/8121] Building AMDGPUGenRegisterInfo.inc...
[4282/8121] Building CXX object tools/clang/lib/ASTMatchers/CMakeFiles/obj.clangASTMatchers.dir/ASTMatchersInternal.cpp.o
[4283/8121] Building CXX object tools/mlir/lib/Dialect/ArmSVE/TransformOps/CMakeFiles/obj.MLIRArmSVEVectorTransformOps.dir/ArmSVEVectorTransformOps.cpp.o
[4284/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataLayoutAnalysis.cpp.o
[4285/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/FlatLinearValueConstraints.cpp.o
[4286/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataFlow/IntegerRangeAnalysis.cpp.o
[4287/8121] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ASTDumper.cpp.o
[4288/8121] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/obj.MLIRAnalysis.dir/DataFlow/DeadCodeAnalysis.cpp.o
[4289/8121] Building CXX object tools/mlir/lib/Dialect/ArmSVE/Transforms/CMakeFiles/obj.MLIRArmSVETransforms.dir/LegalizeVectorStorage.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 13, 2025

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building clang,llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/22683

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clangd Unit Tests :: ./ClangdTests/160/335' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/tools/extra/clangd/unittests/./ClangdTests-Clangd Unit Tests-377087-160-335.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=335 GTEST_SHARD_INDEX=160 /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/tools/extra/clangd/unittests/./ClangdTests
--

Note: This is test shard 161 of 335.
[==========] Running 4 tests from 4 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CompletionTest
[ RUN      ] CompletionTest.NoInsertIncludeIfOnePresent
Built preamble of size 341944 for file /clangd-test/TestTU.cpp version null in 0.13 seconds
Code complete: fuzzyFind({
  "AnyScope": false,
  "Limit": null,
  "PreferredTypes": [],
  "ProximityPaths": [
    "/clangd-test/TestTU.cpp"
  ],
  "Query": "Fun",
  "RestrictForCodeCompletion": true,
  "Scopes": [
    ""
  ]
})
Code complete: sema context TopLevel, query scopes [] (AnyScope=false), expected type <none>
Code complete: 0 results from Sema, 1 from Index, 0 matched, 0 from identifiers, 1 returned.
[       OK ] CompletionTest.NoInsertIncludeIfOnePresent (143 ms)
[----------] 1 test from CompletionTest (143 ms total)

[----------] 1 test from FileIndexTest
[ RUN      ] FileIndexTest.CollectMacros
Built preamble of size 342204 for file /clangd-test/f.cpp version null in 0.01 seconds
indexed preamble AST for /clangd-test/f.cpp version null:
  symbol slab: 1 symbols, 4304 bytes
  ref slab: 0 symbols, 0 refs, 72 bytes
  relations slab: 0 relations, 12 bytes
Build dynamic index for header symbols with estimated memory usage of 6112 bytes
Dex query tree: true
[       OK ] FileIndexTest.CollectMacros (33 ms)
[----------] 1 test from FileIndexTest (33 ms total)

[----------] 1 test from JSONTransportTest
[ RUN      ] JSONTransportTest.StandardDense
<<< {"jsonrpc":"2.0","method":"call","params":1234}

>>> {"id":42,"jsonrpc":"2.0","method":"echo call","params":1234}

<<< {"id":1234,"jsonrpc":"2.0","result":5678}

...

@mdfazlay mdfazlay deleted the nowait-with-optional-args-parsing-sema branch October 14, 2025 03:52
akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
…o accept optional argument (llvm#159628)

This PR enhances the OpenMP `nowait` clause implementation by adding
support for optional argument in both parsing and semantic analysis
phases.

Reference:
1. OpenMP 6.0 Specification, page 481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:as-a-library libclang and C++ API clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang:openmp OpenMP related changes to Clang clang Clang issues not falling into any other category flang:openmp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants