[llvm-branch-commits] [clang] [clang][OpenMP] Split OMPOrderedDirective into two classes (PR #214730)

Krzysztof Parzyszek via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 7 07:03:03 PDT 2026


https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/214730

>From 376fbd3d1c03f427b224ab32e43836cb0ddda629 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Thu, 6 Aug 2026 15:05:11 -0500
Subject: [PATCH] [clang][OpenMP] Split OMPOrderedDirective into two classes

Now that OMPD_ordered has been replaced with two variants, split
the OMPOrderedDirective class into two classes, one for each
variant.
---
 clang/bindings/python/clang/cindex.py         |   7 +-
 clang/include/clang-c/Index.h                 |   8 +-
 clang/include/clang/AST/RecursiveASTVisitor.h |   5 +-
 clang/include/clang/AST/StmtOpenMP.h          |  80 ++++++++--
 clang/include/clang/Basic/StmtNodes.td        |   3 +-
 .../include/clang/Serialization/ASTBitCodes.h |   3 +-
 clang/lib/AST/StmtOpenMP.cpp                  |  45 +++---
 clang/lib/AST/StmtPrinter.cpp                 |  11 +-
 clang/lib/AST/StmtProfile.cpp                 |   8 +-
 clang/lib/CIR/CodeGen/CIRGenFunction.h        |   5 +-
 clang/lib/CIR/CodeGen/CIRGenStmt.cpp          |   8 +-
 clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp    |  13 +-
 clang/lib/CodeGen/CGStmt.cpp                  |   7 +-
 clang/lib/CodeGen/CGStmtOpenMP.cpp            | 148 +++++++++---------
 clang/lib/CodeGen/CodeGenFunction.h           |   5 +-
 clang/lib/Sema/SemaExceptionSpec.cpp          |   3 +-
 clang/lib/Sema/SemaOpenMP.cpp                 |   7 +-
 clang/lib/Sema/TreeTransform.h                |  17 +-
 clang/lib/Serialization/ASTReaderStmt.cpp     |  23 ++-
 clang/lib/Serialization/ASTWriterStmt.cpp     |  12 +-
 clang/lib/StaticAnalyzer/Core/ExprEngine.cpp  |   3 +-
 clang/tools/libclang/CIndex.cpp               |  19 ++-
 clang/tools/libclang/CXCursor.cpp             |   7 +-
 23 files changed, 300 insertions(+), 147 deletions(-)

diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py
index 126c7bf44d1d1..8fb63af29bc56 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -1261,8 +1261,8 @@ def is_unexposed(self):
     # Windows Structured Exception Handling's leave statement.
     SEH_LEAVE_STMT = 247
 
-    # OpenMP ordered directive.
-    OMP_ORDERED_DIRECTIVE = 248
+    # OpenMP ordered-standalone directive.
+    OMP_ORDERED_STANDALONE_DIRECTIVE = 248
 
     # OpenMP atomic directive.
     OMP_ATOMIC_DIRECTIVE = 249
@@ -1456,6 +1456,9 @@ def is_unexposed(self):
     # OpenMP split directive.
     OMP_SPLIT_DIRECTIVE = 312
 
+    # OpenMP ordered-blockassoc directive.
+    OMP_ORDERED_BLOCKASSOC_DIRECTIVE = 313
+
     # OpenACC Compute Construct.
     OPEN_ACC_COMPUTE_DIRECTIVE = 320
 
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 8427236e0b444..1c8d097f1beab 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -1910,9 +1910,9 @@ enum CXCursorKind {
    */
   CXCursor_SEHLeaveStmt = 247,
 
-  /** OpenMP ordered directive.
+  /** OpenMP ordered-standalone directive.
    */
-  CXCursor_OMPOrderedDirective = 248,
+  CXCursor_OMPOrderedStandaloneDirective = 248,
 
   /** OpenMP atomic directive.
    */
@@ -2170,6 +2170,10 @@ enum CXCursorKind {
    */
   CXCursor_OMPSplitDirective = 312,
 
+  /** OpenMP ordered-blockassoc directive.
+   */
+  CXCursor_OMPOrderedBlockAssocDirective = 313,
+
   /** OpenACC Compute Construct.
    */
   CXCursor_OpenACCComputeConstruct = 320,
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 6913e9b614315..617990b82edca 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -3319,7 +3319,10 @@ DEF_TRAVERSE_STMT(OMPDepobjDirective,
 DEF_TRAVERSE_STMT(OMPScanDirective,
                   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
-DEF_TRAVERSE_STMT(OMPOrderedDirective,
+DEF_TRAVERSE_STMT(OMPOrderedStandaloneDirective,
+                  { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
+DEF_TRAVERSE_STMT(OMPOrderedBlockAssocDirective,
                   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
 DEF_TRAVERSE_STMT(OMPAtomicDirective,
diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h
index dedf90b248bc7..cb154866e1ca2 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -554,11 +554,6 @@ class OMPExecutableDirective : public Stmt {
   }
 
   OpenMPDirectiveKind getDirectiveKind() const { return Kind; }
-  /// Horrible temporary hack to allow OMPOrderedDirective to be used
-  /// with both OMPD_ordered_standalone and OMPD_ordered_blockassoc.
-  void setDirectiveKind(OpenMPDirectiveKind D) const {
-    const_cast<OMPExecutableDirective *>(this)->Kind = D;
-  }
 
   static bool classof(const Stmt *S) {
     return S->getStmtClass() >= firstOMPExecutableDirectiveConstant &&
@@ -2936,13 +2931,13 @@ class OMPDepobjDirective final : public OMPExecutableDirective {
   }
 };
 
-/// This represents '#pragma omp ordered' directive.
+/// This represents standalone '#pragma omp ordered' directive.
 ///
 /// \code
 /// #pragma omp ordered
 /// \endcode
 ///
-class OMPOrderedDirective : public OMPExecutableDirective {
+class OMPOrderedStandaloneDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2950,18 +2945,71 @@ class OMPOrderedDirective : public OMPExecutableDirective {
   /// \param StartLoc Starting location of the directive kind.
   /// \param EndLoc Ending location of the directive.
   ///
-  OMPOrderedDirective(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPExecutableDirective(OMPOrderedDirectiveClass,
+  OMPOrderedStandaloneDirective(SourceLocation StartLoc, SourceLocation EndLoc)
+      : OMPExecutableDirective(OMPOrderedStandaloneDirectiveClass,
                                llvm::omp::OMPD_ordered_standalone, StartLoc,
                                EndLoc) {}
 
   /// Build an empty directive.
   ///
-  explicit OMPOrderedDirective()
-      : OMPExecutableDirective(OMPOrderedDirectiveClass,
+  explicit OMPOrderedStandaloneDirective()
+      : OMPExecutableDirective(OMPOrderedStandaloneDirectiveClass,
                                llvm::omp::OMPD_ordered_standalone,
                                SourceLocation(), SourceLocation()) {}
 
+public:
+  /// Creates directive.
+  ///
+  /// \param C AST context.
+  /// \param StartLoc Starting location of the directive kind.
+  /// \param EndLoc Ending Location of the directive.
+  /// \param Clauses List of clauses.
+  ///
+  static OMPOrderedStandaloneDirective *Create(const ASTContext &C,
+                                               SourceLocation StartLoc,
+                                               SourceLocation EndLoc,
+                                               ArrayRef<OMPClause *> Clauses);
+
+  /// Creates an empty directive.
+  ///
+  /// \param C AST context.
+  /// \param NumClauses Number of clauses.
+  ///
+  static OMPOrderedStandaloneDirective *
+  CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
+
+  static bool classof(const Stmt *T) {
+    return T->getStmtClass() == OMPOrderedStandaloneDirectiveClass;
+  }
+};
+
+/// This represents block-associated '#pragma omp ordered' directive.
+///
+/// \code
+/// #pragma omp ordered
+/// { body }
+/// \endcode
+///
+class OMPOrderedBlockAssocDirective : public OMPExecutableDirective {
+  friend class ASTStmtReader;
+  friend class OMPExecutableDirective;
+  /// Build directive with the given start and end location.
+  ///
+  /// \param StartLoc Starting location of the directive kind.
+  /// \param EndLoc Ending location of the directive.
+  ///
+  OMPOrderedBlockAssocDirective(SourceLocation StartLoc, SourceLocation EndLoc)
+      : OMPExecutableDirective(OMPOrderedBlockAssocDirectiveClass,
+                               llvm::omp::OMPD_ordered_blockassoc, StartLoc,
+                               EndLoc) {}
+
+  /// Build an empty directive.
+  ///
+  explicit OMPOrderedBlockAssocDirective()
+      : OMPExecutableDirective(OMPOrderedBlockAssocDirectiveClass,
+                               llvm::omp::OMPD_ordered_blockassoc,
+                               SourceLocation(), SourceLocation()) {}
+
 public:
   /// Creates directive.
   ///
@@ -2971,7 +3019,7 @@ class OMPOrderedDirective : public OMPExecutableDirective {
   /// \param Clauses List of clauses.
   /// \param AssociatedStmt Statement, associated with the directive.
   ///
-  static OMPOrderedDirective *
+  static OMPOrderedBlockAssocDirective *
   Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
          ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
 
@@ -2979,14 +3027,12 @@ class OMPOrderedDirective : public OMPExecutableDirective {
   ///
   /// \param C AST context.
   /// \param NumClauses Number of clauses.
-  /// \param IsStandalone true, if the standalone directive is created.
   ///
-  static OMPOrderedDirective *CreateEmpty(const ASTContext &C,
-                                          unsigned NumClauses,
-                                          bool IsStandalone, EmptyShell);
+  static OMPOrderedBlockAssocDirective *
+  CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
 
   static bool classof(const Stmt *T) {
-    return T->getStmtClass() == OMPOrderedDirectiveClass;
+    return T->getStmtClass() == OMPOrderedBlockAssocDirectiveClass;
   }
 };
 
diff --git a/clang/include/clang/Basic/StmtNodes.td b/clang/include/clang/Basic/StmtNodes.td
index f5fa397c92ef3..6df244d7a8c90 100644
--- a/clang/include/clang/Basic/StmtNodes.td
+++ b/clang/include/clang/Basic/StmtNodes.td
@@ -278,7 +278,8 @@ def OMPTaskgroupDirective : StmtNode<OMPExecutableDirective>;
 def OMPFlushDirective : StmtNode<OMPExecutableDirective>;
 def OMPDepobjDirective : StmtNode<OMPExecutableDirective>;
 def OMPScanDirective : StmtNode<OMPExecutableDirective>;
-def OMPOrderedDirective : StmtNode<OMPExecutableDirective>;
+def OMPOrderedStandaloneDirective : StmtNode<OMPExecutableDirective>;
+def OMPOrderedBlockAssocDirective : StmtNode<OMPExecutableDirective>;
 def OMPAtomicDirective : StmtNode<OMPExecutableDirective>;
 def OMPTargetDirective : StmtNode<OMPExecutableDirective>;
 def OMPTargetDataDirective : StmtNode<OMPExecutableDirective>;
diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h
index 7dee847e44410..fcaa6cf2a6af4 100644
--- a/clang/include/clang/Serialization/ASTBitCodes.h
+++ b/clang/include/clang/Serialization/ASTBitCodes.h
@@ -2004,7 +2004,8 @@ enum StmtCode {
   STMT_OMP_FLUSH_DIRECTIVE,
   STMT_OMP_DEPOBJ_DIRECTIVE,
   STMT_OMP_SCAN_DIRECTIVE,
-  STMT_OMP_ORDERED_DIRECTIVE,
+  STMT_OMP_ORDERED_STANDALONE_DIRECTIVE,
+  STMT_OMP_ORDERED_BLOCKASSOC_DIRECTIVE,
   STMT_OMP_ATOMIC_DIRECTIVE,
   STMT_OMP_TARGET_DIRECTIVE,
   STMT_OMP_TARGET_DATA_DIRECTIVE,
diff --git a/clang/lib/AST/StmtOpenMP.cpp b/clang/lib/AST/StmtOpenMP.cpp
index e4144cb544a9d..0a0cf6352808f 100644
--- a/clang/lib/AST/StmtOpenMP.cpp
+++ b/clang/lib/AST/StmtOpenMP.cpp
@@ -1057,28 +1057,33 @@ OMPScanDirective *OMPScanDirective::CreateEmpty(const ASTContext &C,
   return createEmptyDirective<OMPScanDirective>(C, NumClauses);
 }
 
-OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
-                                                 SourceLocation StartLoc,
-                                                 SourceLocation EndLoc,
-                                                 ArrayRef<OMPClause *> Clauses,
-                                                 Stmt *AssociatedStmt) {
-  auto *D = createDirective<OMPOrderedDirective>(
-      C, Clauses, cast_or_null<CapturedStmt>(AssociatedStmt),
-      /*NumChildren=*/0, StartLoc, EndLoc);
-  if (AssociatedStmt)
-    D->setDirectiveKind(OMPD_ordered_blockassoc);
-  return D;
+OMPOrderedStandaloneDirective *OMPOrderedStandaloneDirective::Create(
+    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
+    ArrayRef<OMPClause *> Clauses) {
+  return createDirective<OMPOrderedStandaloneDirective>(
+      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
+      EndLoc);
 }
 
-OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
-                                                      unsigned NumClauses,
-                                                      bool IsStandalone,
-                                                      EmptyShell) {
-  auto *D =
-      createEmptyDirective<OMPOrderedDirective>(C, NumClauses, !IsStandalone);
-  if (!IsStandalone)
-    D->setDirectiveKind(OMPD_ordered_blockassoc);
-  return D;
+OMPOrderedStandaloneDirective *
+OMPOrderedStandaloneDirective::CreateEmpty(const ASTContext &C,
+                                           unsigned NumClauses, EmptyShell) {
+  return createEmptyDirective<OMPOrderedStandaloneDirective>(C, NumClauses);
+}
+
+OMPOrderedBlockAssocDirective *OMPOrderedBlockAssocDirective::Create(
+    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
+    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
+  return createDirective<OMPOrderedBlockAssocDirective>(
+      C, Clauses, cast<CapturedStmt>(AssociatedStmt), /*NumChildren=*/0,
+      StartLoc, EndLoc);
+}
+
+OMPOrderedBlockAssocDirective *
+OMPOrderedBlockAssocDirective::CreateEmpty(const ASTContext &C,
+                                           unsigned NumClauses, EmptyShell) {
+  return createEmptyDirective<OMPOrderedBlockAssocDirective>(
+      C, NumClauses, /*HasAssociatedStmt=*/true);
 }
 
 OMPAtomicDirective *
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index 877191d456b35..eeb377c794e05 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/lib/AST/StmtPrinter.cpp
@@ -967,9 +967,16 @@ void StmtPrinter::VisitOMPScanDirective(OMPScanDirective *Node) {
   PrintOMPExecutableDirective(Node);
 }
 
-void StmtPrinter::VisitOMPOrderedDirective(OMPOrderedDirective *Node) {
+void StmtPrinter::VisitOMPOrderedStandaloneDirective(
+    OMPOrderedStandaloneDirective *Node) {
   Indent() << "#pragma omp ordered";
-  PrintOMPExecutableDirective(Node, Node->hasClausesOfKind<OMPDependClause>());
+  PrintOMPExecutableDirective(Node, true);
+}
+
+void StmtPrinter::VisitOMPOrderedBlockAssocDirective(
+    OMPOrderedBlockAssocDirective *Node) {
+  Indent() << "#pragma omp ordered";
+  PrintOMPExecutableDirective(Node);
 }
 
 void StmtPrinter::VisitOMPAtomicDirective(OMPAtomicDirective *Node) {
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index ec4493d0afa41..45c962aa27553 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -1203,7 +1203,13 @@ void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) {
   VisitOMPExecutableDirective(S);
 }
 
-void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
+void StmtProfiler::VisitOMPOrderedStandaloneDirective(
+    const OMPOrderedStandaloneDirective *S) {
+  VisitOMPExecutableDirective(S);
+}
+
+void StmtProfiler::VisitOMPOrderedBlockAssocDirective(
+    const OMPOrderedBlockAssocDirective *S) {
   VisitOMPExecutableDirective(S);
 }
 
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h
index d318338187f12..c639b06eff17c 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.h
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h
@@ -2569,7 +2569,10 @@ class CIRGenFunction : public CIRGenTypeCache {
   mlir::LogicalResult emitOMPFlushDirective(const OMPFlushDirective &s);
   mlir::LogicalResult emitOMPDepobjDirective(const OMPDepobjDirective &s);
   mlir::LogicalResult emitOMPScanDirective(const OMPScanDirective &s);
-  mlir::LogicalResult emitOMPOrderedDirective(const OMPOrderedDirective &s);
+  mlir::LogicalResult
+  emitOMPOrderedStandaloneDirective(const OMPOrderedStandaloneDirective &s);
+  mlir::LogicalResult
+  emitOMPOrderedBlockAssocDirective(const OMPOrderedBlockAssocDirective &s);
   mlir::LogicalResult emitOMPAtomicDirective(const OMPAtomicDirective &s);
   mlir::LogicalResult emitOMPTargetDirective(const OMPTargetDirective &s);
   mlir::LogicalResult emitOMPTeamsDirective(const OMPTeamsDirective &s);
diff --git a/clang/lib/CIR/CodeGen/CIRGenStmt.cpp b/clang/lib/CIR/CodeGen/CIRGenStmt.cpp
index ceda5811cd065..ae2dcbd244988 100644
--- a/clang/lib/CIR/CodeGen/CIRGenStmt.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenStmt.cpp
@@ -302,8 +302,12 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s,
     return emitOMPDepobjDirective(cast<OMPDepobjDirective>(*s));
   case Stmt::OMPScanDirectiveClass:
     return emitOMPScanDirective(cast<OMPScanDirective>(*s));
-  case Stmt::OMPOrderedDirectiveClass:
-    return emitOMPOrderedDirective(cast<OMPOrderedDirective>(*s));
+  case Stmt::OMPOrderedStandaloneDirectiveClass:
+    return emitOMPOrderedStandaloneDirective(
+        cast<OMPOrderedStandaloneDirective>(*s));
+  case Stmt::OMPOrderedBlockAssocDirectiveClass:
+    return emitOMPOrderedBlockAssocDirective(
+        cast<OMPOrderedBlockAssocDirective>(*s));
   case Stmt::OMPAtomicDirectiveClass:
     return emitOMPAtomicDirective(cast<OMPAtomicDirective>(*s));
   case Stmt::OMPTargetDirectiveClass:
diff --git a/clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp b/clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
index 17a1fb8090f5c..a42735391629f 100644
--- a/clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenStmtOpenMP.cpp
@@ -205,9 +205,16 @@ CIRGenFunction::emitOMPScanDirective(const OMPScanDirective &s) {
   getCIRGenModule().errorNYI(s.getSourceRange(), "OpenMP OMPScanDirective");
   return mlir::failure();
 }
-mlir::LogicalResult
-CIRGenFunction::emitOMPOrderedDirective(const OMPOrderedDirective &s) {
-  getCIRGenModule().errorNYI(s.getSourceRange(), "OpenMP OMPOrderedDirective");
+mlir::LogicalResult CIRGenFunction::emitOMPOrderedStandaloneDirective(
+    const OMPOrderedStandaloneDirective &s) {
+  getCIRGenModule().errorNYI(s.getSourceRange(),
+                             "OpenMP OMPOrderedStandaloneDirective");
+  return mlir::failure();
+}
+mlir::LogicalResult CIRGenFunction::emitOMPOrderedBlockAssocDirective(
+    const OMPOrderedBlockAssocDirective &s) {
+  getCIRGenModule().errorNYI(s.getSourceRange(),
+                             "OpenMP OMPOrderedBlockAssocDirective");
   return mlir::failure();
 }
 mlir::LogicalResult
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 73f6c3c4aff1d..18f1e87d3245d 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -304,8 +304,11 @@ void CodeGenFunction::EmitStmt(const Stmt *S, ArrayRef<const Attr *> Attrs) {
   case Stmt::OMPScanDirectiveClass:
     EmitOMPScanDirective(cast<OMPScanDirective>(*S));
     break;
-  case Stmt::OMPOrderedDirectiveClass:
-    EmitOMPOrderedDirective(cast<OMPOrderedDirective>(*S));
+  case Stmt::OMPOrderedStandaloneDirectiveClass:
+    EmitOMPOrderedStandaloneDirective(cast<OMPOrderedStandaloneDirective>(*S));
+    break;
+  case Stmt::OMPOrderedBlockAssocDirectiveClass:
+    EmitOMPOrderedBlockAssocDirective(cast<OMPOrderedBlockAssocDirective>(*S));
     break;
   case Stmt::OMPAtomicDirectiveClass:
     EmitOMPAtomicDirective(cast<OMPAtomicDirective>(*S));
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index c7c13af972255..122e5db698548 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2785,7 +2785,7 @@ static void emitSimdlenSafelenClause(CodeGenFunction &CGF,
   }
 }
 
-// Check for the presence of an `OMPOrderedDirective`,
+// Check for the presence of an `OMPOrderedBlockAssocDirective`,
 // i.e., `ordered` in `#pragma omp ordered simd`.
 //
 // Consider the following source code:
@@ -2806,7 +2806,7 @@ static void emitSimdlenSafelenClause(CodeGenFunction &CGF,
 //
 // Suppose we are in `CodeGenFunction::EmitOMPSimdInit(const OMPLoopDirective
 // &D)`. By examining `D.dump()` we have the following AST containing
-// `OMPOrderedDirective`:
+// `OMPOrderedBlockAssocDirective`:
 //
 // ```
 // OMPSimdDirective 0x1c32950
@@ -2824,24 +2824,24 @@ static void emitSimdlenSafelenClause(CodeGenFunction &CGF,
 //   | | |-UnaryOperator 0x1c31348 'int' prefix '++'
 //   | | | `-DeclRefExpr 0x1c31328 'int' lvalue Var 0x1c31208 'k' 'int'
 //   | | `-CompoundStmt 0x1c31e18
-//   | |   `-OMPOrderedDirective 0x1c31dd8
+//   | |   `-OMPOrderedBlockAssocDirective 0x1c31dd8
 //   | |     |-OMPSimdClause 0x1c31380
 //   | |     `-CapturedStmt 0x1c31cd0
 // ```
 //
-// Note the presence of `OMPOrderedDirective` above:
+// Note the presence of `OMPOrderedBlockAssocDirective` above:
 // It's (transitively) nested in a `CapturedStmt` representing the pragma
 // annotated compound statement. Thus, we need to consider this nesting and
 // include checking the `getCapturedStmt` in this case.
-static bool hasOrderedDirective(const Stmt *S) {
-  if (isa<OMPOrderedDirective>(S))
+static bool hasOrderedBlockAssocDirective(const Stmt *S) {
+  if (isa<OMPOrderedBlockAssocDirective>(S))
     return true;
 
   if (const auto *CS = dyn_cast<CapturedStmt>(S))
-    return hasOrderedDirective(CS->getCapturedStmt());
+    return hasOrderedBlockAssocDirective(CS->getCapturedStmt());
 
   for (const Stmt *Child : S->children()) {
-    if (Child && hasOrderedDirective(Child))
+    if (Child && hasOrderedBlockAssocDirective(Child))
       return true;
   }
 
@@ -2850,9 +2850,9 @@ static bool hasOrderedDirective(const Stmt *S) {
 
 static void applyConservativeSimdOrderedDirective(const Stmt &AssociatedStmt,
                                                   LoopInfoStack &LoopStack) {
-  // Check for the presence of an `OMPOrderedDirective`
+  // Check for the presence of an `OMPOrderedBlockAssocDirective`
   // i.e., `ordered` in `#pragma omp ordered simd`
-  bool HasOrderedDirective = hasOrderedDirective(&AssociatedStmt);
+  bool HasOrderedDirective = hasOrderedBlockAssocDirective(&AssociatedStmt);
   // If present then conservatively disable loop vectorization
   // analogously to how `emitSimdlenSafelenClause` does.
   if (HasOrderedDirective)
@@ -3087,9 +3087,9 @@ static bool isSimdSupportedByOpenMPIRBuilder(const OMPLoopDirective &S) {
       return false;
   }
 
-  // Check if we have a statement with the ordered directive.
+  // Check if we have a statement with the ordered-blockassoc directive.
   // Visit the statement hierarchy to find a compound statement
-  // with a ordered directive in it.
+  // with a ordered-blockassoc directive in it.
   if (const auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(S.getRawStmt())) {
     if (const Stmt *SyntacticalLoop = CanonLoop->getLoopStmt()) {
       for (const Stmt *SubStmt : SyntacticalLoop->children()) {
@@ -3099,7 +3099,7 @@ static bool isSimdSupportedByOpenMPIRBuilder(const OMPLoopDirective &S) {
           for (const Stmt *CSSubStmt : CS->children()) {
             if (!CSSubStmt)
               continue;
-            if (isa<OMPOrderedDirective>(CSSubStmt)) {
+            if (isa<OMPOrderedBlockAssocDirective>(CSSubStmt)) {
               return false;
             }
           }
@@ -6503,78 +6503,84 @@ static void emitRestoreIP(CodeGenFunction &CGF, const T *C,
                                      StoreValues, ".cnt.addr", IsDependSource));
 }
 
-void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) {
+void CodeGenFunction::EmitOMPOrderedStandaloneDirective(
+    const OMPOrderedStandaloneDirective &S) {
+  assert((S.hasClausesOfKind<OMPDependClause>() ||
+          S.hasClausesOfKind<OMPDoacrossClause>()) &&
+         "Standalone ordered directive should have either depend or doacross "
+         "clause");
+  // The ordered-standalone directive.
+  assert(!S.hasAssociatedStmt() && "No associated statement must be in "
+                                   "ordered depend|doacross construct.");
+
   if (CGM.getLangOpts().OpenMPIRBuilder) {
     llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder();
     using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
 
-    if (S.hasClausesOfKind<OMPDependClause>() ||
-        S.hasClausesOfKind<OMPDoacrossClause>()) {
-      // The ordered directive with depend clause.
-      assert(!S.hasAssociatedStmt() && "No associated statement must be in "
-                                       "ordered depend|doacross construct.");
-      InsertPointTy AllocaIP(AllocaInsertPt->getParent(),
-                             AllocaInsertPt->getIterator());
-      for (const auto *DC : S.getClausesOfKind<OMPDependClause>())
-        emitRestoreIP(*this, DC, AllocaIP, OMPBuilder);
-      for (const auto *DC : S.getClausesOfKind<OMPDoacrossClause>())
-        emitRestoreIP(*this, DC, AllocaIP, OMPBuilder);
-    } else {
-      // The ordered directive with threads or simd clause, or without clause.
-      // Without clause, it behaves as if the threads clause is specified.
-      const auto *C = S.getSingleClause<OMPSIMDClause>();
-
-      auto FiniCB = [this](InsertPointTy IP) {
-        OMPBuilderCBHelpers::FinalizeOMPRegion(*this, IP);
-        return llvm::Error::success();
-      };
-
-      auto BodyGenCB = [&S, C,
-                        this](InsertPointTy AllocIP, InsertPointTy CodeGenIP,
-                              ArrayRef<llvm::BasicBlock *> DeallocBlocks) {
-        Builder.restoreIP(CodeGenIP);
-
-        const CapturedStmt *CS = S.getInnermostCapturedStmt();
-        if (C) {
-          llvm::BasicBlock *FiniBB = splitBBWithSuffix(
-              Builder, /*CreateBranch=*/false, ".ordered.after");
-          llvm::SmallVector<llvm::Value *, 16> CapturedVars;
-          GenerateOpenMPCapturedVars(*CS, CapturedVars);
-          llvm::Function *OutlinedFn = emitOutlinedOrderedFunction(CGM, CS, S);
-          assert(S.getBeginLoc().isValid() &&
-                 "Outlined function call location must be valid.");
-          ApplyDebugLocation::CreateDefaultArtificial(*this, S.getBeginLoc());
-          OMPBuilderCBHelpers::EmitCaptureStmt(*this, CodeGenIP, *FiniBB,
-                                               OutlinedFn, CapturedVars);
-        } else {
-          OMPBuilderCBHelpers::EmitOMPInlinedRegionBody(
-              *this, CS->getCapturedStmt(), AllocIP, CodeGenIP, "ordered");
-        }
-        return llvm::Error::success();
-      };
-
-      OMPLexicalScope Scope(*this, S, OMPD_unknown);
-      llvm::OpenMPIRBuilder::InsertPointTy AfterIP = cantFail(
-          OMPBuilder.createOrderedThreadsSimd(Builder, BodyGenCB, FiniCB, !C));
-      Builder.restoreIP(AfterIP);
-    }
+    InsertPointTy AllocaIP(AllocaInsertPt->getParent(),
+                           AllocaInsertPt->getIterator());
+    for (const auto *DC : S.getClausesOfKind<OMPDependClause>())
+      emitRestoreIP(*this, DC, AllocaIP, OMPBuilder);
+    for (const auto *DC : S.getClausesOfKind<OMPDoacrossClause>())
+      emitRestoreIP(*this, DC, AllocaIP, OMPBuilder);
     return;
   }
 
   if (S.hasClausesOfKind<OMPDependClause>()) {
-    assert(!S.hasAssociatedStmt() &&
-           "No associated statement must be in ordered depend construct.");
     for (const auto *DC : S.getClausesOfKind<OMPDependClause>())
       CGM.getOpenMPRuntime().emitDoacrossOrdered(*this, DC);
-    return;
-  }
-  if (S.hasClausesOfKind<OMPDoacrossClause>()) {
-    assert(!S.hasAssociatedStmt() &&
-           "No associated statement must be in ordered doacross construct.");
+  } else if (S.hasClausesOfKind<OMPDoacrossClause>()) {
     for (const auto *DC : S.getClausesOfKind<OMPDoacrossClause>())
       CGM.getOpenMPRuntime().emitDoacrossOrdered(*this, DC);
+  }
+}
+
+void CodeGenFunction::EmitOMPOrderedBlockAssocDirective(
+    const OMPOrderedBlockAssocDirective &S) {
+  if (CGM.getLangOpts().OpenMPIRBuilder) {
+    llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder();
+    using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
+
+    // The ordered directive with threads or simd clause, or without clause.
+    // Without clause, it behaves as if the threads clause is specified.
+    const auto *C = S.getSingleClause<OMPSIMDClause>();
+
+    auto FiniCB = [this](InsertPointTy IP) {
+      OMPBuilderCBHelpers::FinalizeOMPRegion(*this, IP);
+      return llvm::Error::success();
+    };
+
+    auto BodyGenCB = [&S, C, this](InsertPointTy AllocIP,
+                                   InsertPointTy CodeGenIP,
+                                   ArrayRef<llvm::BasicBlock *> DeallocBlocks) {
+      Builder.restoreIP(CodeGenIP);
+
+      const CapturedStmt *CS = S.getInnermostCapturedStmt();
+      if (C) {
+        llvm::BasicBlock *FiniBB = splitBBWithSuffix(
+            Builder, /*CreateBranch=*/false, ".ordered.after");
+        llvm::SmallVector<llvm::Value *, 16> CapturedVars;
+        GenerateOpenMPCapturedVars(*CS, CapturedVars);
+        llvm::Function *OutlinedFn = emitOutlinedOrderedFunction(CGM, CS, S);
+        assert(S.getBeginLoc().isValid() &&
+               "Outlined function call location must be valid.");
+        ApplyDebugLocation::CreateDefaultArtificial(*this, S.getBeginLoc());
+        OMPBuilderCBHelpers::EmitCaptureStmt(*this, CodeGenIP, *FiniBB,
+                                             OutlinedFn, CapturedVars);
+      } else {
+        OMPBuilderCBHelpers::EmitOMPInlinedRegionBody(
+            *this, CS->getCapturedStmt(), AllocIP, CodeGenIP, "ordered");
+      }
+      return llvm::Error::success();
+    };
+
+    OMPLexicalScope Scope(*this, S, OMPD_unknown);
+    llvm::OpenMPIRBuilder::InsertPointTy AfterIP = cantFail(
+        OMPBuilder.createOrderedThreadsSimd(Builder, BodyGenCB, FiniCB, !C));
+    Builder.restoreIP(AfterIP);
     return;
   }
+
   const auto *C = S.getSingleClause<OMPSIMDClause>();
   auto &&CodeGen = [&S, C, this](CodeGenFunction &CGF,
                                  PrePostActionTy &Action) {
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 783f97dc354eb..8c1c8d052579a 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3971,7 +3971,10 @@ class CodeGenFunction : public CodeGenTypeCache {
   void EmitOMPFlushDirective(const OMPFlushDirective &S);
   void EmitOMPDepobjDirective(const OMPDepobjDirective &S);
   void EmitOMPScanDirective(const OMPScanDirective &S);
-  void EmitOMPOrderedDirective(const OMPOrderedDirective &S);
+  void
+  EmitOMPOrderedStandaloneDirective(const OMPOrderedStandaloneDirective &S);
+  void
+  EmitOMPOrderedBlockAssocDirective(const OMPOrderedBlockAssocDirective &S);
   void EmitOMPAtomicDirective(const OMPAtomicDirective &S);
   void EmitOMPTargetDirective(const OMPTargetDirective &S);
   void EmitOMPTargetDataDirective(const OMPTargetDataDirective &S);
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp
index 0ed5c35c40c1a..d41137ddc85d5 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -1489,7 +1489,8 @@ CanThrowResult Sema::canThrow(const Stmt *S) {
   case Stmt::OMPMaskedTaskLoopDirectiveClass:
   case Stmt::OMPMasterTaskLoopSimdDirectiveClass:
   case Stmt::OMPMaskedTaskLoopSimdDirectiveClass:
-  case Stmt::OMPOrderedDirectiveClass:
+  case Stmt::OMPOrderedStandaloneDirectiveClass:
+  case Stmt::OMPOrderedBlockAssocDirectiveClass:
   case Stmt::OMPCanonicalLoopClass:
   case Stmt::OMPParallelDirectiveClass:
   case Stmt::OMPParallelForDirectiveClass:
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 9c7be1e46298e..22a877576cac5 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -11848,8 +11848,11 @@ SemaOpenMP::ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses,
     SemaRef.setFunctionHasBranchProtectedScope();
   }
 
-  return OMPOrderedDirective::Create(getASTContext(), StartLoc, EndLoc, Clauses,
-                                     AStmt);
+  if (!AStmt)
+    return OMPOrderedStandaloneDirective::Create(getASTContext(), StartLoc,
+                                                 EndLoc, Clauses);
+  return OMPOrderedBlockAssocDirective::Create(getASTContext(), StartLoc,
+                                               EndLoc, Clauses, AStmt);
 }
 
 namespace {
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index db2d24fdbfcce..e6abb3ad577c6 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -10280,11 +10280,22 @@ TreeTransform<Derived>::TransformOMPScanDirective(OMPScanDirective *D) {
 }
 
 template <typename Derived>
-StmtResult
-TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *D) {
+StmtResult TreeTransform<Derived>::TransformOMPOrderedStandaloneDirective(
+    OMPOrderedStandaloneDirective *D) {
   DeclarationNameInfo DirName;
   getDerived().getSema().OpenMP().StartOpenMPDSABlock(
-      D->getDirectiveKind(), DirName, nullptr, D->getBeginLoc());
+      OMPD_ordered_standalone, DirName, nullptr, D->getBeginLoc());
+  StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
+  getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
+  return Res;
+}
+
+template <typename Derived>
+StmtResult TreeTransform<Derived>::TransformOMPOrderedBlockAssocDirective(
+    OMPOrderedBlockAssocDirective *D) {
+  DeclarationNameInfo DirName;
+  getDerived().getSema().OpenMP().StartOpenMPDSABlock(
+      OMPD_ordered_blockassoc, DirName, nullptr, D->getBeginLoc());
   StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
   getDerived().getSema().OpenMP().EndOpenMPDSABlock(Res.get());
   return Res;
diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp
index 6cde6c1816dc7..a1d9dd7a14a87 100644
--- a/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -2698,7 +2698,14 @@ void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective *D) {
   VisitOMPExecutableDirective(D);
 }
 
-void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
+void ASTStmtReader::VisitOMPOrderedStandaloneDirective(
+    OMPOrderedStandaloneDirective *D) {
+  VisitStmt(D);
+  VisitOMPExecutableDirective(D);
+}
+
+void ASTStmtReader::VisitOMPOrderedBlockAssocDirective(
+    OMPOrderedBlockAssocDirective *D) {
   VisitStmt(D);
   VisitOMPExecutableDirective(D);
 }
@@ -3877,11 +3884,17 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
           Context, Record[ASTStmtReader::NumStmtFields], Empty);
       break;
 
-    case STMT_OMP_ORDERED_DIRECTIVE: {
+    case STMT_OMP_ORDERED_STANDALONE_DIRECTIVE: {
+      unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
+      S = OMPOrderedStandaloneDirective::CreateEmpty(Context, NumClauses,
+                                                     Empty);
+      break;
+    }
+
+    case STMT_OMP_ORDERED_BLOCKASSOC_DIRECTIVE: {
       unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
-      bool HasAssociatedStmt = Record[ASTStmtReader::NumStmtFields + 2];
-      S = OMPOrderedDirective::CreateEmpty(Context, NumClauses,
-                                           !HasAssociatedStmt, Empty);
+      S = OMPOrderedBlockAssocDirective::CreateEmpty(Context, NumClauses,
+                                                     Empty);
       break;
     }
 
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp
index 10443d42df8c0..75971c811946c 100644
--- a/clang/lib/Serialization/ASTWriterStmt.cpp
+++ b/clang/lib/Serialization/ASTWriterStmt.cpp
@@ -2793,10 +2793,18 @@ void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
   Code = serialization::STMT_OMP_SCAN_DIRECTIVE;
 }
 
-void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
+void ASTStmtWriter::VisitOMPOrderedStandaloneDirective(
+    OMPOrderedStandaloneDirective *D) {
   VisitStmt(D);
   VisitOMPExecutableDirective(D);
-  Code = serialization::STMT_OMP_ORDERED_DIRECTIVE;
+  Code = serialization::STMT_OMP_ORDERED_STANDALONE_DIRECTIVE;
+}
+
+void ASTStmtWriter::VisitOMPOrderedBlockAssocDirective(
+    OMPOrderedBlockAssocDirective *D) {
+  VisitStmt(D);
+  VisitOMPExecutableDirective(D);
+  Code = serialization::STMT_OMP_ORDERED_BLOCKASSOC_DIRECTIVE;
 }
 
 void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 6373e9aafe97b..fe4dc8a49cb99 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1744,7 +1744,8 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred,
     case Stmt::OMPFlushDirectiveClass:
     case Stmt::OMPDepobjDirectiveClass:
     case Stmt::OMPScanDirectiveClass:
-    case Stmt::OMPOrderedDirectiveClass:
+    case Stmt::OMPOrderedStandaloneDirectiveClass:
+    case Stmt::OMPOrderedBlockAssocDirectiveClass:
     case Stmt::OMPAtomicDirectiveClass:
     case Stmt::OMPAssumeDirectiveClass:
     case Stmt::OMPTargetDirectiveClass:
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 034f89029122c..e485e6e2e5547 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -2194,7 +2194,10 @@ class EnqueueVisitor : public ConstStmtVisitor<EnqueueVisitor, void>,
   void VisitOMPFlushDirective(const OMPFlushDirective *D);
   void VisitOMPDepobjDirective(const OMPDepobjDirective *D);
   void VisitOMPScanDirective(const OMPScanDirective *D);
-  void VisitOMPOrderedDirective(const OMPOrderedDirective *D);
+  void
+  VisitOMPOrderedStandaloneDirective(const OMPOrderedStandaloneDirective *D);
+  void
+  VisitOMPOrderedBlockAssocDirective(const OMPOrderedBlockAssocDirective *D);
   void VisitOMPAtomicDirective(const OMPAtomicDirective *D);
   void VisitOMPTargetDirective(const OMPTargetDirective *D);
   void VisitOMPTargetDataDirective(const OMPTargetDataDirective *D);
@@ -3474,7 +3477,13 @@ void EnqueueVisitor::VisitOMPScanDirective(const OMPScanDirective *D) {
   VisitOMPExecutableDirective(D);
 }
 
-void EnqueueVisitor::VisitOMPOrderedDirective(const OMPOrderedDirective *D) {
+void EnqueueVisitor::VisitOMPOrderedStandaloneDirective(
+    const OMPOrderedStandaloneDirective *D) {
+  VisitOMPExecutableDirective(D);
+}
+
+void EnqueueVisitor::VisitOMPOrderedBlockAssocDirective(
+    const OMPOrderedBlockAssocDirective *D) {
   VisitOMPExecutableDirective(D);
 }
 
@@ -6389,8 +6398,10 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
     return cxstring::createRef("OMPDepobjDirective");
   case CXCursor_OMPScanDirective:
     return cxstring::createRef("OMPScanDirective");
-  case CXCursor_OMPOrderedDirective:
-    return cxstring::createRef("OMPOrderedDirective");
+  case CXCursor_OMPOrderedStandaloneDirective:
+    return cxstring::createRef("OMPOrderedStandaloneDirective");
+  case CXCursor_OMPOrderedBlockAssocDirective:
+    return cxstring::createRef("OMPOrderedBlockAssocDirective");
   case CXCursor_OMPAtomicDirective:
     return cxstring::createRef("OMPAtomicDirective");
   case CXCursor_OMPTargetDirective:
diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp
index fb0b3c1502574..e27964d0ad6e1 100644
--- a/clang/tools/libclang/CXCursor.cpp
+++ b/clang/tools/libclang/CXCursor.cpp
@@ -775,8 +775,11 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent,
   case Stmt::OMPScanDirectiveClass:
     K = CXCursor_OMPScanDirective;
     break;
-  case Stmt::OMPOrderedDirectiveClass:
-    K = CXCursor_OMPOrderedDirective;
+  case Stmt::OMPOrderedStandaloneDirectiveClass:
+    K = CXCursor_OMPOrderedStandaloneDirective;
+    break;
+  case Stmt::OMPOrderedBlockAssocDirectiveClass:
+    K = CXCursor_OMPOrderedBlockAssocDirective;
     break;
   case Stmt::OMPAtomicDirectiveClass:
     K = CXCursor_OMPAtomicDirective;



More information about the llvm-branch-commits mailing list