[llvm-branch-commits] [llvm] ba52c84 - [OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`

Johannes Doerfert via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Apr 3 23:58:37 PDT 2020


Author: Johannes Doerfert
Date: 2020-04-04T00:27:07-05:00
New Revision: ba52c8466bf950d34581c696737e5b5d83c1ac5c

URL: https://github.com/llvm/llvm-project/commit/ba52c8466bf950d34581c696737e5b5d83c1ac5c
DIFF: https://github.com/llvm/llvm-project/commit/ba52c8466bf950d34581c696737e5b5d83c1ac5c.diff

LOG: [OpenMP][NFCI] Move OpenMP clause information to `lib/Frontend/OpenMP`

Summary:
This is a cleanup and normalization patch that also enables reuse with
Flang later on. A follow up will clean up and move the directive ->
clauses mapping.

Reviewers: lebedev.ri, JonChesterfield, ABataev, fghanim

Reviewed By: fghanim

Subscribers: yaxunl, jholewinski, mgorny, hiraditya, bollu, guansong, arphaman, jfb, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77112

Added: 
    

Modified: 
    clang/include/clang/AST/ASTFwd.h
    clang/include/clang/AST/ASTTypeTraits.h
    clang/include/clang/AST/OpenMPClause.h
    clang/include/clang/AST/RecursiveASTVisitor.h
    clang/include/clang/Basic/Attr.td
    clang/include/clang/Basic/OpenMPKinds.def
    clang/include/clang/Basic/OpenMPKinds.h
    clang/lib/AST/ASTTypeTraits.cpp
    clang/lib/AST/AttrImpl.cpp
    clang/lib/AST/OpenMPClause.cpp
    clang/lib/AST/StmtProfile.cpp
    clang/lib/AST/TextNodeDumper.cpp
    clang/lib/ASTMatchers/CMakeLists.txt
    clang/lib/ASTMatchers/Dynamic/Marshallers.h
    clang/lib/Analysis/CMakeLists.txt
    clang/lib/Basic/OpenMPKinds.cpp
    clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
    clang/lib/Parse/ParseOpenMP.cpp
    clang/lib/Sema/SemaOpenMP.cpp
    clang/lib/Sema/TreeTransform.h
    clang/lib/Serialization/ASTReader.cpp
    clang/lib/Serialization/ASTWriter.cpp
    clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
    clang/lib/StaticAnalyzer/Core/CMakeLists.txt
    clang/tools/libclang/CIndex.cpp
    clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
    llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
    llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
    llvm/lib/Frontend/OpenMP/OMPConstants.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/ASTFwd.h b/clang/include/clang/AST/ASTFwd.h
index 5a891817b336..65319a19728b 100644
--- a/clang/include/clang/AST/ASTFwd.h
+++ b/clang/include/clang/AST/ASTFwd.h
@@ -27,8 +27,8 @@ class Type;
 #include "clang/AST/TypeNodes.inc"
 class CXXCtorInitializer;
 class OMPClause;
-#define OPENMP_CLAUSE(KIND, CLASSNAME) class CLASSNAME;
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) class Class;
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
 
 
 } // end namespace clang

diff  --git a/clang/include/clang/AST/ASTTypeTraits.h b/clang/include/clang/AST/ASTTypeTraits.h
index a9c2e334a29e..cd80e9bc3808 100644
--- a/clang/include/clang/AST/ASTTypeTraits.h
+++ b/clang/include/clang/AST/ASTTypeTraits.h
@@ -148,8 +148,8 @@ class ASTNodeKind {
 #define TYPE(DERIVED, BASE) NKI_##DERIVED##Type,
 #include "clang/AST/TypeNodes.inc"
     NKI_OMPClause,
-#define OPENMP_CLAUSE(TextualSpelling, Class) NKI_##Class,
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) NKI_##Class,
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
     NKI_NumberOfKinds
   };
 
@@ -204,8 +204,8 @@ KIND_TO_KIND_ID(OMPClause)
 #include "clang/AST/StmtNodes.inc"
 #define TYPE(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Type)
 #include "clang/AST/TypeNodes.inc"
-#define OPENMP_CLAUSE(TextualSpelling, Class) KIND_TO_KIND_ID(Class)
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class)
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
 #undef KIND_TO_KIND_ID
 
 inline raw_ostream &operator<<(raw_ostream &OS, ASTNodeKind K) {

diff  --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index efa6d0554a7c..9f5ff5a85182 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -285,12 +285,13 @@ class OMPAllocatorClause : public OMPClause {
   /// \param EndLoc Ending location of the clause.
   OMPAllocatorClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc,
                      SourceLocation EndLoc)
-      : OMPClause(OMPC_allocator, StartLoc, EndLoc), LParenLoc(LParenLoc),
-        Allocator(A) {}
+      : OMPClause(llvm::omp::OMPC_allocator, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), Allocator(A) {}
 
   /// Build an empty clause.
   OMPAllocatorClause()
-      : OMPClause(OMPC_allocator, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_allocator, SourceLocation(),
+                  SourceLocation()) {}
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -315,7 +316,7 @@ class OMPAllocatorClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_allocator;
+    return T->getClauseKind() == llvm::omp::OMPC_allocator;
   }
 };
 
@@ -350,17 +351,17 @@ class OMPAllocateClause final
   OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                     Expr *Allocator, SourceLocation ColonLoc,
                     SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPAllocateClause>(OMPC_allocate, StartLoc, LParenLoc,
-                                            EndLoc, N),
+      : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate, StartLoc,
+                                            LParenLoc, EndLoc, N),
         Allocator(Allocator), ColonLoc(ColonLoc) {}
 
   /// Build an empty clause.
   ///
   /// \param N Number of variables.
   explicit OMPAllocateClause(unsigned N)
-      : OMPVarListClause<OMPAllocateClause>(OMPC_allocate, SourceLocation(),
+      : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate,
                                             SourceLocation(), SourceLocation(),
-                                            N) {}
+                                            SourceLocation(), N) {}
 
   /// Sets location of ':' symbol in clause.
   void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
@@ -412,7 +413,7 @@ class OMPAllocateClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_allocate;
+    return T->getClauseKind() == llvm::omp::OMPC_allocate;
   }
 };
 
@@ -470,15 +471,16 @@ class OMPIfClause : public OMPClause, public OMPClauseWithPreInit {
               OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
               SourceLocation LParenLoc, SourceLocation NameModifierLoc,
               SourceLocation ColonLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_if, StartLoc, EndLoc), OMPClauseWithPreInit(this),
-        LParenLoc(LParenLoc), Condition(Cond), ColonLoc(ColonLoc),
-        NameModifier(NameModifier), NameModifierLoc(NameModifierLoc) {
+      : OMPClause(llvm::omp::OMPC_if, StartLoc, EndLoc),
+        OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Condition(Cond),
+        ColonLoc(ColonLoc), NameModifier(NameModifier),
+        NameModifierLoc(NameModifierLoc) {
     setPreInitStmt(HelperCond, CaptureRegion);
   }
 
   /// Build an empty clause.
   OMPIfClause()
-      : OMPClause(OMPC_if, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_if, SourceLocation(), SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
@@ -512,7 +514,7 @@ class OMPIfClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_if;
+    return T->getClauseKind() == llvm::omp::OMPC_if;
   }
 };
 
@@ -548,14 +550,14 @@ class OMPFinalClause : public OMPClause, public OMPClauseWithPreInit {
   OMPFinalClause(Expr *Cond, Stmt *HelperCond,
                  OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
                  SourceLocation LParenLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_final, StartLoc, EndLoc), OMPClauseWithPreInit(this),
-        LParenLoc(LParenLoc), Condition(Cond) {
+      : OMPClause(llvm::omp::OMPC_final, StartLoc, EndLoc),
+        OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Condition(Cond) {
     setPreInitStmt(HelperCond, CaptureRegion);
   }
 
   /// Build an empty clause.
   OMPFinalClause()
-      : OMPClause(OMPC_final, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_final, SourceLocation(), SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
@@ -580,7 +582,7 @@ class OMPFinalClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_final;
+    return T->getClauseKind() == llvm::omp::OMPC_final;
   }
 };
 
@@ -618,7 +620,7 @@ class OMPNumThreadsClause : public OMPClause, public OMPClauseWithPreInit {
                       OpenMPDirectiveKind CaptureRegion,
                       SourceLocation StartLoc, SourceLocation LParenLoc,
                       SourceLocation EndLoc)
-      : OMPClause(OMPC_num_threads, StartLoc, EndLoc),
+      : OMPClause(llvm::omp::OMPC_num_threads, StartLoc, EndLoc),
         OMPClauseWithPreInit(this), LParenLoc(LParenLoc),
         NumThreads(NumThreads) {
     setPreInitStmt(HelperNumThreads, CaptureRegion);
@@ -626,7 +628,8 @@ class OMPNumThreadsClause : public OMPClause, public OMPClauseWithPreInit {
 
   /// Build an empty clause.
   OMPNumThreadsClause()
-      : OMPClause(OMPC_num_threads, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_num_threads, SourceLocation(),
+                  SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
@@ -652,7 +655,7 @@ class OMPNumThreadsClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_num_threads;
+    return T->getClauseKind() == llvm::omp::OMPC_num_threads;
   }
 };
 
@@ -688,12 +691,13 @@ class OMPSafelenClause : public OMPClause {
   /// \param EndLoc Ending location of the clause.
   OMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc,
                    SourceLocation EndLoc)
-      : OMPClause(OMPC_safelen, StartLoc, EndLoc), LParenLoc(LParenLoc),
-        Safelen(Len) {}
+      : OMPClause(llvm::omp::OMPC_safelen, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), Safelen(Len) {}
 
   /// Build an empty clause.
   explicit OMPSafelenClause()
-      : OMPClause(OMPC_safelen, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_safelen, SourceLocation(), SourceLocation()) {
+  }
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -718,7 +722,7 @@ class OMPSafelenClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_safelen;
+    return T->getClauseKind() == llvm::omp::OMPC_safelen;
   }
 };
 
@@ -753,12 +757,13 @@ class OMPSimdlenClause : public OMPClause {
   /// \param EndLoc Ending location of the clause.
   OMPSimdlenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc,
                    SourceLocation EndLoc)
-      : OMPClause(OMPC_simdlen, StartLoc, EndLoc), LParenLoc(LParenLoc),
-        Simdlen(Len) {}
+      : OMPClause(llvm::omp::OMPC_simdlen, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), Simdlen(Len) {}
 
   /// Build an empty clause.
   explicit OMPSimdlenClause()
-      : OMPClause(OMPC_simdlen, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_simdlen, SourceLocation(), SourceLocation()) {
+  }
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -783,7 +788,7 @@ class OMPSimdlenClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_simdlen;
+    return T->getClauseKind() == llvm::omp::OMPC_simdlen;
   }
 };
 
@@ -819,12 +824,13 @@ class OMPCollapseClause : public OMPClause {
   /// \param EndLoc Ending location of the clause.
   OMPCollapseClause(Expr *Num, SourceLocation StartLoc,
                     SourceLocation LParenLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_collapse, StartLoc, EndLoc), LParenLoc(LParenLoc),
-        NumForLoops(Num) {}
+      : OMPClause(llvm::omp::OMPC_collapse, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), NumForLoops(Num) {}
 
   /// Build an empty clause.
   explicit OMPCollapseClause()
-      : OMPClause(OMPC_collapse, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_collapse, SourceLocation(),
+                  SourceLocation()) {}
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -849,7 +855,7 @@ class OMPCollapseClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_collapse;
+    return T->getClauseKind() == llvm::omp::OMPC_collapse;
   }
 };
 
@@ -893,12 +899,13 @@ class OMPDefaultClause : public OMPClause {
   OMPDefaultClause(llvm::omp::DefaultKind A, SourceLocation ALoc,
                    SourceLocation StartLoc, SourceLocation LParenLoc,
                    SourceLocation EndLoc)
-      : OMPClause(OMPC_default, StartLoc, EndLoc), LParenLoc(LParenLoc),
-        Kind(A), KindKwLoc(ALoc) {}
+      : OMPClause(llvm::omp::OMPC_default, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
 
   /// Build an empty clause.
   OMPDefaultClause()
-      : OMPClause(OMPC_default, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_default, SourceLocation(), SourceLocation()) {
+  }
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -928,7 +935,7 @@ class OMPDefaultClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_default;
+    return T->getClauseKind() == llvm::omp::OMPC_default;
   }
 };
 
@@ -974,12 +981,13 @@ class OMPProcBindClause : public OMPClause {
   OMPProcBindClause(llvm::omp::ProcBindKind A, SourceLocation ALoc,
                     SourceLocation StartLoc, SourceLocation LParenLoc,
                     SourceLocation EndLoc)
-      : OMPClause(OMPC_proc_bind, StartLoc, EndLoc), LParenLoc(LParenLoc),
-        Kind(A), KindKwLoc(ALoc) {}
+      : OMPClause(llvm::omp::OMPC_proc_bind, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
 
   /// Build an empty clause.
   OMPProcBindClause()
-      : OMPClause(OMPC_proc_bind, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_proc_bind, SourceLocation(),
+                  SourceLocation()) {}
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -1009,7 +1017,7 @@ class OMPProcBindClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_proc_bind;
+    return T->getClauseKind() == llvm::omp::OMPC_proc_bind;
   }
 };
 
@@ -1029,11 +1037,12 @@ class OMPUnifiedAddressClause final : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_unified_address, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_unified_address, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPUnifiedAddressClause()
-      : OMPClause(OMPC_unified_address, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_unified_address, SourceLocation(),
+                  SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1051,7 +1060,7 @@ class OMPUnifiedAddressClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_unified_address;
+    return T->getClauseKind() == llvm::omp::OMPC_unified_address;
   }
 };
 
@@ -1071,11 +1080,12 @@ class OMPUnifiedSharedMemoryClause final : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_unified_shared_memory, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_unified_shared_memory, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPUnifiedSharedMemoryClause()
-      : OMPClause(OMPC_unified_shared_memory, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_unified_shared_memory, SourceLocation(),
+                  SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1093,7 +1103,7 @@ class OMPUnifiedSharedMemoryClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_unified_shared_memory;
+    return T->getClauseKind() == llvm::omp::OMPC_unified_shared_memory;
   }
 };
 
@@ -1113,11 +1123,12 @@ class OMPReverseOffloadClause final : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_reverse_offload, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_reverse_offload, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPReverseOffloadClause()
-      : OMPClause(OMPC_reverse_offload, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_reverse_offload, SourceLocation(),
+                  SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1135,7 +1146,7 @@ class OMPReverseOffloadClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_reverse_offload;
+    return T->getClauseKind() == llvm::omp::OMPC_reverse_offload;
   }
 };
 
@@ -1155,12 +1166,12 @@ class OMPDynamicAllocatorsClause final : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_dynamic_allocators, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_dynamic_allocators, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPDynamicAllocatorsClause()
-      : OMPClause(OMPC_dynamic_allocators, SourceLocation(), SourceLocation()) {
-  }
+      : OMPClause(llvm::omp::OMPC_dynamic_allocators, SourceLocation(),
+                  SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1178,7 +1189,7 @@ class OMPDynamicAllocatorsClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_dynamic_allocators;
+    return T->getClauseKind() == llvm::omp::OMPC_dynamic_allocators;
   }
 };
 
@@ -1230,12 +1241,12 @@ class OMPAtomicDefaultMemOrderClause final : public OMPClause {
                                  SourceLocation ALoc, SourceLocation StartLoc,
                                  SourceLocation LParenLoc,
                                  SourceLocation EndLoc)
-      : OMPClause(OMPC_atomic_default_mem_order, StartLoc, EndLoc),
+      : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, StartLoc, EndLoc),
         LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
 
   /// Build an empty clause.
   OMPAtomicDefaultMemOrderClause()
-      : OMPClause(OMPC_atomic_default_mem_order, SourceLocation(),
+      : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, SourceLocation(),
                   SourceLocation()) {}
 
   /// Sets the location of '('.
@@ -1268,7 +1279,7 @@ class OMPAtomicDefaultMemOrderClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_atomic_default_mem_order;
+    return T->getClauseKind() == llvm::omp::OMPC_atomic_default_mem_order;
   }
 };
 
@@ -1387,9 +1398,9 @@ class OMPScheduleClause : public OMPClause, public OMPClauseWithPreInit {
                     Expr *ChunkSize, Stmt *HelperChunkSize,
                     OpenMPScheduleClauseModifier M1, SourceLocation M1Loc,
                     OpenMPScheduleClauseModifier M2, SourceLocation M2Loc)
-      : OMPClause(OMPC_schedule, StartLoc, EndLoc), OMPClauseWithPreInit(this),
-        LParenLoc(LParenLoc), Kind(Kind), KindLoc(KLoc), CommaLoc(CommaLoc),
-        ChunkSize(ChunkSize) {
+      : OMPClause(llvm::omp::OMPC_schedule, StartLoc, EndLoc),
+        OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Kind(Kind),
+        KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
     setPreInitStmt(HelperChunkSize);
     Modifiers[FIRST] = M1;
     Modifiers[SECOND] = M2;
@@ -1399,7 +1410,7 @@ class OMPScheduleClause : public OMPClause, public OMPClauseWithPreInit {
 
   /// Build an empty clause.
   explicit OMPScheduleClause()
-      : OMPClause(OMPC_schedule, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_schedule, SourceLocation(), SourceLocation()),
         OMPClauseWithPreInit(this) {
     Modifiers[FIRST] = OMPC_SCHEDULE_MODIFIER_unknown;
     Modifiers[SECOND] = OMPC_SCHEDULE_MODIFIER_unknown;
@@ -1461,7 +1472,7 @@ class OMPScheduleClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_schedule;
+    return T->getClauseKind() == llvm::omp::OMPC_schedule;
   }
 };
 
@@ -1496,12 +1507,12 @@ class OMPOrderedClause final
   /// \param EndLoc Ending location of the clause.
   OMPOrderedClause(Expr *Num, unsigned NumLoops, SourceLocation StartLoc,
                    SourceLocation LParenLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_ordered, StartLoc, EndLoc), LParenLoc(LParenLoc),
-        NumForLoops(Num), NumberOfLoops(NumLoops) {}
+      : OMPClause(llvm::omp::OMPC_ordered, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), NumForLoops(Num), NumberOfLoops(NumLoops) {}
 
   /// Build an empty clause.
   explicit OMPOrderedClause(unsigned NumLoops)
-      : OMPClause(OMPC_ordered, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_ordered, SourceLocation(), SourceLocation()),
         NumberOfLoops(NumLoops) {}
 
   /// Set the number of associated for-loops.
@@ -1557,7 +1568,7 @@ class OMPOrderedClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_ordered;
+    return T->getClauseKind() == llvm::omp::OMPC_ordered;
   }
 };
 
@@ -1574,11 +1585,11 @@ class OMPNowaitClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_nowait, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_nowait, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPNowaitClause()
-      : OMPClause(OMPC_nowait, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_nowait, SourceLocation(), SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1596,7 +1607,7 @@ class OMPNowaitClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_nowait;
+    return T->getClauseKind() == llvm::omp::OMPC_nowait;
   }
 };
 
@@ -1613,11 +1624,11 @@ class OMPUntiedClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_untied, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_untied, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPUntiedClause()
-      : OMPClause(OMPC_untied, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_untied, SourceLocation(), SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1635,7 +1646,7 @@ class OMPUntiedClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_untied;
+    return T->getClauseKind() == llvm::omp::OMPC_untied;
   }
 };
 
@@ -1653,11 +1664,12 @@ class OMPMergeableClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_mergeable, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_mergeable, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPMergeableClause()
-      : OMPClause(OMPC_mergeable, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_mergeable, SourceLocation(),
+                  SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1675,7 +1687,7 @@ class OMPMergeableClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_mergeable;
+    return T->getClauseKind() == llvm::omp::OMPC_mergeable;
   }
 };
 
@@ -1692,10 +1704,11 @@ class OMPReadClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_read, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_read, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
-  OMPReadClause() : OMPClause(OMPC_read, SourceLocation(), SourceLocation()) {}
+  OMPReadClause()
+      : OMPClause(llvm::omp::OMPC_read, SourceLocation(), SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1713,7 +1726,7 @@ class OMPReadClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_read;
+    return T->getClauseKind() == llvm::omp::OMPC_read;
   }
 };
 
@@ -1730,11 +1743,11 @@ class OMPWriteClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_write, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_write, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPWriteClause()
-      : OMPClause(OMPC_write, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_write, SourceLocation(), SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1752,7 +1765,7 @@ class OMPWriteClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_write;
+    return T->getClauseKind() == llvm::omp::OMPC_write;
   }
 };
 
@@ -1812,11 +1825,12 @@ class OMPUpdateClause final
   /// \param EndLoc Ending location of the clause.
   OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc,
                   bool IsExtended)
-      : OMPClause(OMPC_update, StartLoc, EndLoc), IsExtended(IsExtended) {}
+      : OMPClause(llvm::omp::OMPC_update, StartLoc, EndLoc),
+        IsExtended(IsExtended) {}
 
   /// Build an empty clause.
   OMPUpdateClause(bool IsExtended)
-      : OMPClause(OMPC_update, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_update, SourceLocation(), SourceLocation()),
         IsExtended(IsExtended) {}
 
 public:
@@ -1886,7 +1900,7 @@ class OMPUpdateClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_update;
+    return T->getClauseKind() == llvm::omp::OMPC_update;
   }
 };
 
@@ -1904,11 +1918,12 @@ class OMPCaptureClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_capture, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_capture, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPCaptureClause()
-      : OMPClause(OMPC_capture, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_capture, SourceLocation(), SourceLocation()) {
+  }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1926,7 +1941,7 @@ class OMPCaptureClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_capture;
+    return T->getClauseKind() == llvm::omp::OMPC_capture;
   }
 };
 
@@ -1944,11 +1959,12 @@ class OMPSeqCstClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_seq_cst, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_seq_cst, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPSeqCstClause()
-      : OMPClause(OMPC_seq_cst, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_seq_cst, SourceLocation(), SourceLocation()) {
+  }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -1966,7 +1982,7 @@ class OMPSeqCstClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_seq_cst;
+    return T->getClauseKind() == llvm::omp::OMPC_seq_cst;
   }
 };
 
@@ -1984,11 +2000,12 @@ class OMPAcqRelClause final : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_acq_rel, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_acq_rel, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPAcqRelClause()
-      : OMPClause(OMPC_acq_rel, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_acq_rel, SourceLocation(), SourceLocation()) {
+  }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -2006,7 +2023,7 @@ class OMPAcqRelClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_acq_rel;
+    return T->getClauseKind() == llvm::omp::OMPC_acq_rel;
   }
 };
 
@@ -2024,11 +2041,12 @@ class OMPAcquireClause final : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_acquire, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_acquire, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPAcquireClause()
-      : OMPClause(OMPC_acquire, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_acquire, SourceLocation(), SourceLocation()) {
+  }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -2046,7 +2064,7 @@ class OMPAcquireClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_acquire;
+    return T->getClauseKind() == llvm::omp::OMPC_acquire;
   }
 };
 
@@ -2064,11 +2082,12 @@ class OMPReleaseClause final : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_release, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_release, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPReleaseClause()
-      : OMPClause(OMPC_release, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_release, SourceLocation(), SourceLocation()) {
+  }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -2086,7 +2105,7 @@ class OMPReleaseClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_release;
+    return T->getClauseKind() == llvm::omp::OMPC_release;
   }
 };
 
@@ -2104,11 +2123,12 @@ class OMPRelaxedClause final : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_relaxed, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_relaxed, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPRelaxedClause()
-      : OMPClause(OMPC_relaxed, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_relaxed, SourceLocation(), SourceLocation()) {
+  }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -2126,7 +2146,7 @@ class OMPRelaxedClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_relaxed;
+    return T->getClauseKind() == llvm::omp::OMPC_relaxed;
   }
 };
 
@@ -2152,16 +2172,16 @@ class OMPPrivateClause final
   /// \param N Number of the variables in the clause.
   OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                    SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPPrivateClause>(OMPC_private, StartLoc, LParenLoc,
-                                           EndLoc, N) {}
+      : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private, StartLoc,
+                                           LParenLoc, EndLoc, N) {}
 
   /// Build an empty clause.
   ///
   /// \param N Number of variables.
   explicit OMPPrivateClause(unsigned N)
-      : OMPVarListClause<OMPPrivateClause>(OMPC_private, SourceLocation(),
+      : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private,
                                            SourceLocation(), SourceLocation(),
-                                           N) {}
+                                           SourceLocation(), N) {}
 
   /// Sets the list of references to private copies with initializers for
   /// new private variables.
@@ -2231,7 +2251,7 @@ class OMPPrivateClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_private;
+    return T->getClauseKind() == llvm::omp::OMPC_private;
   }
 };
 
@@ -2259,8 +2279,8 @@ class OMPFirstprivateClause final
   /// \param N Number of the variables in the clause.
   OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                         SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPFirstprivateClause>(OMPC_firstprivate, StartLoc,
-                                                LParenLoc, EndLoc, N),
+      : OMPVarListClause<OMPFirstprivateClause>(llvm::omp::OMPC_firstprivate,
+                                                StartLoc, LParenLoc, EndLoc, N),
         OMPClauseWithPreInit(this) {}
 
   /// Build an empty clause.
@@ -2268,7 +2288,7 @@ class OMPFirstprivateClause final
   /// \param N Number of variables.
   explicit OMPFirstprivateClause(unsigned N)
       : OMPVarListClause<OMPFirstprivateClause>(
-            OMPC_firstprivate, SourceLocation(), SourceLocation(),
+            llvm::omp::OMPC_firstprivate, SourceLocation(), SourceLocation(),
             SourceLocation(), N),
         OMPClauseWithPreInit(this) {}
 
@@ -2372,7 +2392,7 @@ class OMPFirstprivateClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_firstprivate;
+    return T->getClauseKind() == llvm::omp::OMPC_firstprivate;
   }
 };
 
@@ -2425,8 +2445,8 @@ class OMPLastprivateClause final
                        SourceLocation EndLoc, OpenMPLastprivateModifier LPKind,
                        SourceLocation LPKindLoc, SourceLocation ColonLoc,
                        unsigned N)
-      : OMPVarListClause<OMPLastprivateClause>(OMPC_lastprivate, StartLoc,
-                                               LParenLoc, EndLoc, N),
+      : OMPVarListClause<OMPLastprivateClause>(llvm::omp::OMPC_lastprivate,
+                                               StartLoc, LParenLoc, EndLoc, N),
         OMPClauseWithPostUpdate(this), LPKind(LPKind), LPKindLoc(LPKindLoc),
         ColonLoc(ColonLoc) {}
 
@@ -2435,7 +2455,7 @@ class OMPLastprivateClause final
   /// \param N Number of variables.
   explicit OMPLastprivateClause(unsigned N)
       : OMPVarListClause<OMPLastprivateClause>(
-            OMPC_lastprivate, SourceLocation(), SourceLocation(),
+            llvm::omp::OMPC_lastprivate, SourceLocation(), SourceLocation(),
             SourceLocation(), N),
         OMPClauseWithPostUpdate(this) {}
 
@@ -2611,7 +2631,7 @@ class OMPLastprivateClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_lastprivate;
+    return T->getClauseKind() == llvm::omp::OMPC_lastprivate;
   }
 };
 
@@ -2636,16 +2656,16 @@ class OMPSharedClause final
   /// \param N Number of the variables in the clause.
   OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                   SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPSharedClause>(OMPC_shared, StartLoc, LParenLoc,
-                                          EndLoc, N) {}
+      : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared, StartLoc,
+                                          LParenLoc, EndLoc, N) {}
 
   /// Build an empty clause.
   ///
   /// \param N Number of variables.
   explicit OMPSharedClause(unsigned N)
-      : OMPVarListClause<OMPSharedClause>(OMPC_shared, SourceLocation(),
+      : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared,
                                           SourceLocation(), SourceLocation(),
-                                          N) {}
+                                          SourceLocation(), N) {}
 
 public:
   /// Creates clause with a list of variables \a VL.
@@ -2683,7 +2703,7 @@ class OMPSharedClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_shared;
+    return T->getClauseKind() == llvm::omp::OMPC_shared;
   }
 };
 
@@ -2734,8 +2754,8 @@ class OMPReductionClause final
                      OpenMPReductionClauseModifier Modifier, unsigned N,
                      NestedNameSpecifierLoc QualifierLoc,
                      const DeclarationNameInfo &NameInfo)
-      : OMPVarListClause<OMPReductionClause>(OMPC_reduction, StartLoc,
-                                             LParenLoc, EndLoc, N),
+      : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
+                                             StartLoc, LParenLoc, EndLoc, N),
         OMPClauseWithPostUpdate(this), Modifier(Modifier),
         ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
         QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
@@ -2744,9 +2764,9 @@ class OMPReductionClause final
   ///
   /// \param N Number of variables.
   explicit OMPReductionClause(unsigned N)
-      : OMPVarListClause<OMPReductionClause>(OMPC_reduction, SourceLocation(),
+      : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
                                              SourceLocation(), SourceLocation(),
-                                             N),
+                                             SourceLocation(), N),
         OMPClauseWithPostUpdate(this) {}
 
   /// Sets reduction modifier.
@@ -2943,7 +2963,7 @@ class OMPReductionClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_reduction;
+    return T->getClauseKind() == llvm::omp::OMPC_reduction;
   }
 };
 
@@ -2985,8 +3005,8 @@ class OMPTaskReductionClause final
                          SourceLocation ColonLoc, SourceLocation EndLoc,
                          unsigned N, NestedNameSpecifierLoc QualifierLoc,
                          const DeclarationNameInfo &NameInfo)
-      : OMPVarListClause<OMPTaskReductionClause>(OMPC_task_reduction, StartLoc,
-                                                 LParenLoc, EndLoc, N),
+      : OMPVarListClause<OMPTaskReductionClause>(
+            llvm::omp::OMPC_task_reduction, StartLoc, LParenLoc, EndLoc, N),
         OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
         QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
 
@@ -2995,7 +3015,7 @@ class OMPTaskReductionClause final
   /// \param N Number of variables.
   explicit OMPTaskReductionClause(unsigned N)
       : OMPVarListClause<OMPTaskReductionClause>(
-            OMPC_task_reduction, SourceLocation(), SourceLocation(),
+            llvm::omp::OMPC_task_reduction, SourceLocation(), SourceLocation(),
             SourceLocation(), N),
         OMPClauseWithPostUpdate(this) {}
 
@@ -3175,7 +3195,7 @@ class OMPTaskReductionClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_task_reduction;
+    return T->getClauseKind() == llvm::omp::OMPC_task_reduction;
   }
 };
 
@@ -3216,8 +3236,8 @@ class OMPInReductionClause final
                        SourceLocation ColonLoc, SourceLocation EndLoc,
                        unsigned N, NestedNameSpecifierLoc QualifierLoc,
                        const DeclarationNameInfo &NameInfo)
-      : OMPVarListClause<OMPInReductionClause>(OMPC_in_reduction, StartLoc,
-                                               LParenLoc, EndLoc, N),
+      : OMPVarListClause<OMPInReductionClause>(llvm::omp::OMPC_in_reduction,
+                                               StartLoc, LParenLoc, EndLoc, N),
         OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
         QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
 
@@ -3226,7 +3246,7 @@ class OMPInReductionClause final
   /// \param N Number of variables.
   explicit OMPInReductionClause(unsigned N)
       : OMPVarListClause<OMPInReductionClause>(
-            OMPC_in_reduction, SourceLocation(), SourceLocation(),
+            llvm::omp::OMPC_in_reduction, SourceLocation(), SourceLocation(),
             SourceLocation(), N),
         OMPClauseWithPostUpdate(this) {}
 
@@ -3430,7 +3450,7 @@ class OMPInReductionClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_in_reduction;
+    return T->getClauseKind() == llvm::omp::OMPC_in_reduction;
   }
 };
 
@@ -3476,8 +3496,8 @@ class OMPLinearClause final
                   OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
                   SourceLocation ColonLoc, SourceLocation EndLoc,
                   unsigned NumVars)
-      : OMPVarListClause<OMPLinearClause>(OMPC_linear, StartLoc, LParenLoc,
-                                          EndLoc, NumVars),
+      : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear, StartLoc,
+                                          LParenLoc, EndLoc, NumVars),
         OMPClauseWithPostUpdate(this), Modifier(Modifier),
         ModifierLoc(ModifierLoc), ColonLoc(ColonLoc) {}
 
@@ -3485,9 +3505,9 @@ class OMPLinearClause final
   ///
   /// \param NumVars Number of variables.
   explicit OMPLinearClause(unsigned NumVars)
-      : OMPVarListClause<OMPLinearClause>(OMPC_linear, SourceLocation(),
+      : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear,
                                           SourceLocation(), SourceLocation(),
-                                          NumVars),
+                                          SourceLocation(), NumVars),
         OMPClauseWithPostUpdate(this) {}
 
   /// Gets the list of initial values for linear variables.
@@ -3707,7 +3727,7 @@ class OMPLinearClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_linear;
+    return T->getClauseKind() == llvm::omp::OMPC_linear;
   }
 };
 
@@ -3742,17 +3762,17 @@ class OMPAlignedClause final
   OMPAlignedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                    SourceLocation ColonLoc, SourceLocation EndLoc,
                    unsigned NumVars)
-      : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, StartLoc, LParenLoc,
-                                           EndLoc, NumVars),
+      : OMPVarListClause<OMPAlignedClause>(llvm::omp::OMPC_aligned, StartLoc,
+                                           LParenLoc, EndLoc, NumVars),
         ColonLoc(ColonLoc) {}
 
   /// Build an empty clause.
   ///
   /// \param NumVars Number of variables.
   explicit OMPAlignedClause(unsigned NumVars)
-      : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, SourceLocation(),
+      : OMPVarListClause<OMPAlignedClause>(llvm::omp::OMPC_aligned,
                                            SourceLocation(), SourceLocation(),
-                                           NumVars) {}
+                                           SourceLocation(), NumVars) {}
 
 public:
   /// Creates clause with a list of variables \a VL and alignment \a A.
@@ -3806,7 +3826,7 @@ class OMPAlignedClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_aligned;
+    return T->getClauseKind() == llvm::omp::OMPC_aligned;
   }
 };
 
@@ -3845,16 +3865,16 @@ class OMPCopyinClause final
   /// \param N Number of the variables in the clause.
   OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                   SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, StartLoc, LParenLoc,
-                                          EndLoc, N) {}
+      : OMPVarListClause<OMPCopyinClause>(llvm::omp::OMPC_copyin, StartLoc,
+                                          LParenLoc, EndLoc, N) {}
 
   /// Build an empty clause.
   ///
   /// \param N Number of variables.
   explicit OMPCopyinClause(unsigned N)
-      : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, SourceLocation(),
+      : OMPVarListClause<OMPCopyinClause>(llvm::omp::OMPC_copyin,
                                           SourceLocation(), SourceLocation(),
-                                          N) {}
+                                          SourceLocation(), N) {}
 
   /// Set list of helper expressions, required for proper codegen of the
   /// clause. These expressions represent source expression in the final
@@ -3982,7 +4002,7 @@ class OMPCopyinClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_copyin;
+    return T->getClauseKind() == llvm::omp::OMPC_copyin;
   }
 };
 
@@ -4009,15 +4029,16 @@ class OMPCopyprivateClause final
   /// \param N Number of the variables in the clause.
   OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                        SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPCopyprivateClause>(OMPC_copyprivate, StartLoc,
-                                               LParenLoc, EndLoc, N) {}
+      : OMPVarListClause<OMPCopyprivateClause>(llvm::omp::OMPC_copyprivate,
+                                               StartLoc, LParenLoc, EndLoc, N) {
+  }
 
   /// Build an empty clause.
   ///
   /// \param N Number of variables.
   explicit OMPCopyprivateClause(unsigned N)
       : OMPVarListClause<OMPCopyprivateClause>(
-            OMPC_copyprivate, SourceLocation(), SourceLocation(),
+            llvm::omp::OMPC_copyprivate, SourceLocation(), SourceLocation(),
             SourceLocation(), N) {}
 
   /// Set list of helper expressions, required for proper codegen of the
@@ -4145,7 +4166,7 @@ class OMPCopyprivateClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_copyprivate;
+    return T->getClauseKind() == llvm::omp::OMPC_copyprivate;
   }
 };
 
@@ -4175,16 +4196,16 @@ class OMPFlushClause final
   /// \param N Number of the variables in the clause.
   OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                  SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPFlushClause>(OMPC_flush, StartLoc, LParenLoc,
-                                         EndLoc, N) {}
+      : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush, StartLoc,
+                                         LParenLoc, EndLoc, N) {}
 
   /// Build an empty clause.
   ///
   /// \param N Number of variables.
   explicit OMPFlushClause(unsigned N)
-      : OMPVarListClause<OMPFlushClause>(OMPC_flush, SourceLocation(),
+      : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush,
                                          SourceLocation(), SourceLocation(),
-                                         N) {}
+                                         SourceLocation(), N) {}
 
 public:
   /// Creates clause with a list of variables \a VL.
@@ -4222,7 +4243,7 @@ class OMPFlushClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_flush;
+    return T->getClauseKind() == llvm::omp::OMPC_flush;
   }
 };
 
@@ -4254,12 +4275,13 @@ class OMPDepobjClause final : public OMPClause {
   /// \param EndLoc Ending location of the clause.
   OMPDepobjClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                   SourceLocation EndLoc)
-      : OMPClause(OMPC_depobj, StartLoc, EndLoc), LParenLoc(LParenLoc) {}
+      : OMPClause(llvm::omp::OMPC_depobj, StartLoc, EndLoc),
+        LParenLoc(LParenLoc) {}
 
   /// Build an empty clause.
   ///
   explicit OMPDepobjClause()
-      : OMPClause(OMPC_depobj, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_depobj, SourceLocation(), SourceLocation()) {}
 
   void setDepobj(Expr *E) { Depobj = E; }
 
@@ -4308,7 +4330,7 @@ class OMPDepobjClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_depobj;
+    return T->getClauseKind() == llvm::omp::OMPC_depobj;
   }
 };
 
@@ -4349,8 +4371,9 @@ class OMPDependClause final
   /// clause.
   OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                   SourceLocation EndLoc, unsigned N, unsigned NumLoops)
-      : OMPVarListClause<OMPDependClause>(OMPC_depend, StartLoc, LParenLoc,
-                                          EndLoc, N), NumLoops(NumLoops) {}
+      : OMPVarListClause<OMPDependClause>(llvm::omp::OMPC_depend, StartLoc,
+                                          LParenLoc, EndLoc, N),
+        NumLoops(NumLoops) {}
 
   /// Build an empty clause.
   ///
@@ -4358,9 +4381,9 @@ class OMPDependClause final
   /// \param NumLoops Number of loops that is associated with this depend
   /// clause.
   explicit OMPDependClause(unsigned N, unsigned NumLoops)
-      : OMPVarListClause<OMPDependClause>(OMPC_depend, SourceLocation(),
+      : OMPVarListClause<OMPDependClause>(llvm::omp::OMPC_depend,
                                           SourceLocation(), SourceLocation(),
-                                          N),
+                                          SourceLocation(), N),
         NumLoops(NumLoops) {}
 
   /// Set dependency kind.
@@ -4448,7 +4471,7 @@ class OMPDependClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_depend;
+    return T->getClauseKind() == llvm::omp::OMPC_depend;
   }
 };
 
@@ -4501,15 +4524,15 @@ class OMPDeviceClause : public OMPClause, public OMPClauseWithPreInit {
                   OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
                   SourceLocation LParenLoc, SourceLocation ModifierLoc,
                   SourceLocation EndLoc)
-      : OMPClause(OMPC_device, StartLoc, EndLoc), OMPClauseWithPreInit(this),
-        LParenLoc(LParenLoc), Modifier(Modifier), ModifierLoc(ModifierLoc),
-        Device(E) {
+      : OMPClause(llvm::omp::OMPC_device, StartLoc, EndLoc),
+        OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Modifier(Modifier),
+        ModifierLoc(ModifierLoc), Device(E) {
     setPreInitStmt(HelperE, CaptureRegion);
   }
 
   /// Build an empty clause.
   OMPDeviceClause()
-      : OMPClause(OMPC_device, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_device, SourceLocation(), SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
@@ -4544,7 +4567,7 @@ class OMPDeviceClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_device;
+    return T->getClauseKind() == llvm::omp::OMPC_device;
   }
 };
 
@@ -4561,11 +4584,12 @@ class OMPThreadsClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_threads, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_threads, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPThreadsClause()
-      : OMPClause(OMPC_threads, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_threads, SourceLocation(), SourceLocation()) {
+  }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -4583,7 +4607,7 @@ class OMPThreadsClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_threads;
+    return T->getClauseKind() == llvm::omp::OMPC_threads;
   }
 };
 
@@ -4600,10 +4624,11 @@ class OMPSIMDClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_simd, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_simd, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
-  OMPSIMDClause() : OMPClause(OMPC_simd, SourceLocation(), SourceLocation()) {}
+  OMPSIMDClause()
+      : OMPClause(llvm::omp::OMPC_simd, SourceLocation(), SourceLocation()) {}
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -4621,7 +4646,7 @@ class OMPSIMDClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_simd;
+    return T->getClauseKind() == llvm::omp::OMPC_simd;
   }
 };
 
@@ -5297,8 +5322,8 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
                         OpenMPMapClauseKind MapType, bool MapTypeIsImplicit,
                         SourceLocation MapLoc, const OMPVarListLocTy &Locs,
                         const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_map, Locs, Sizes, &MapperQualifierLoc,
-                                  &MapperIdInfo),
+      : OMPMappableExprListClause(llvm::omp::OMPC_map, Locs, Sizes,
+                                  &MapperQualifierLoc, &MapperIdInfo),
         MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) {
     assert(llvm::array_lengthof(MapTypeModifiers) == MapModifiers.size() &&
            "Unexpected number of map type modifiers.");
@@ -5318,7 +5343,8 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
   /// 3) NumComponentLists: number of component lists in this clause; and 4)
   /// NumComponents: total number of expression components in the clause.
   explicit OMPMapClause(const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_map, OMPVarListLocTy(), Sizes) {}
+      : OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(),
+                                  Sizes) {}
 
   /// Set map-type-modifier for the clause.
   ///
@@ -5465,7 +5491,7 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
 
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_map;
+    return T->getClauseKind() == llvm::omp::OMPC_map;
   }
 };
 
@@ -5504,14 +5530,15 @@ class OMPNumTeamsClause : public OMPClause, public OMPClauseWithPreInit {
   OMPNumTeamsClause(Expr *E, Stmt *HelperE, OpenMPDirectiveKind CaptureRegion,
                     SourceLocation StartLoc, SourceLocation LParenLoc,
                     SourceLocation EndLoc)
-      : OMPClause(OMPC_num_teams, StartLoc, EndLoc), OMPClauseWithPreInit(this),
-        LParenLoc(LParenLoc), NumTeams(E) {
+      : OMPClause(llvm::omp::OMPC_num_teams, StartLoc, EndLoc),
+        OMPClauseWithPreInit(this), LParenLoc(LParenLoc), NumTeams(E) {
     setPreInitStmt(HelperE, CaptureRegion);
   }
 
   /// Build an empty clause.
   OMPNumTeamsClause()
-      : OMPClause(OMPC_num_teams, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_num_teams, SourceLocation(),
+                  SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
@@ -5540,7 +5567,7 @@ class OMPNumTeamsClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_num_teams;
+    return T->getClauseKind() == llvm::omp::OMPC_num_teams;
   }
 };
 
@@ -5580,14 +5607,15 @@ class OMPThreadLimitClause : public OMPClause, public OMPClauseWithPreInit {
                        OpenMPDirectiveKind CaptureRegion,
                        SourceLocation StartLoc, SourceLocation LParenLoc,
                        SourceLocation EndLoc)
-      : OMPClause(OMPC_thread_limit, StartLoc, EndLoc),
+      : OMPClause(llvm::omp::OMPC_thread_limit, StartLoc, EndLoc),
         OMPClauseWithPreInit(this), LParenLoc(LParenLoc), ThreadLimit(E) {
     setPreInitStmt(HelperE, CaptureRegion);
   }
 
   /// Build an empty clause.
   OMPThreadLimitClause()
-      : OMPClause(OMPC_thread_limit, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_thread_limit, SourceLocation(),
+                  SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
@@ -5616,7 +5644,7 @@ class OMPThreadLimitClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_thread_limit;
+    return T->getClauseKind() == llvm::omp::OMPC_thread_limit;
   }
 };
 
@@ -5655,14 +5683,14 @@ class OMPPriorityClause : public OMPClause, public OMPClauseWithPreInit {
   OMPPriorityClause(Expr *Priority, Stmt *HelperPriority,
                     OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
                     SourceLocation LParenLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_priority, StartLoc, EndLoc), OMPClauseWithPreInit(this),
-        LParenLoc(LParenLoc), Priority(Priority) {
+      : OMPClause(llvm::omp::OMPC_priority, StartLoc, EndLoc),
+        OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Priority(Priority) {
     setPreInitStmt(HelperPriority, CaptureRegion);
   }
 
   /// Build an empty clause.
   OMPPriorityClause()
-      : OMPClause(OMPC_priority, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_priority, SourceLocation(), SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
@@ -5690,7 +5718,7 @@ class OMPPriorityClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_priority;
+    return T->getClauseKind() == llvm::omp::OMPC_priority;
   }
 };
 
@@ -5726,14 +5754,15 @@ class OMPGrainsizeClause : public OMPClause, public OMPClauseWithPreInit {
   OMPGrainsizeClause(Expr *Size, Stmt *HelperSize,
                      OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
                      SourceLocation LParenLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_grainsize, StartLoc, EndLoc), OMPClauseWithPreInit(this),
-        LParenLoc(LParenLoc), Grainsize(Size) {
+      : OMPClause(llvm::omp::OMPC_grainsize, StartLoc, EndLoc),
+        OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Grainsize(Size) {
     setPreInitStmt(HelperSize, CaptureRegion);
   }
 
   /// Build an empty clause.
   explicit OMPGrainsizeClause()
-      : OMPClause(OMPC_grainsize, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_grainsize, SourceLocation(),
+                  SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
@@ -5758,7 +5787,7 @@ class OMPGrainsizeClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_grainsize;
+    return T->getClauseKind() == llvm::omp::OMPC_grainsize;
   }
 };
 
@@ -5775,11 +5804,12 @@ class OMPNogroupClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_nogroup, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_nogroup, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPNogroupClause()
-      : OMPClause(OMPC_nogroup, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_nogroup, SourceLocation(), SourceLocation()) {
+  }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -5797,7 +5827,7 @@ class OMPNogroupClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_nogroup;
+    return T->getClauseKind() == llvm::omp::OMPC_nogroup;
   }
 };
 
@@ -5833,14 +5863,15 @@ class OMPNumTasksClause : public OMPClause, public OMPClauseWithPreInit {
   OMPNumTasksClause(Expr *Size, Stmt *HelperSize,
                     OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
                     SourceLocation LParenLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_num_tasks, StartLoc, EndLoc), OMPClauseWithPreInit(this),
-        LParenLoc(LParenLoc), NumTasks(Size) {
+      : OMPClause(llvm::omp::OMPC_num_tasks, StartLoc, EndLoc),
+        OMPClauseWithPreInit(this), LParenLoc(LParenLoc), NumTasks(Size) {
     setPreInitStmt(HelperSize, CaptureRegion);
   }
 
   /// Build an empty clause.
   explicit OMPNumTasksClause()
-      : OMPClause(OMPC_num_tasks, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_num_tasks, SourceLocation(),
+                  SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
@@ -5865,7 +5896,7 @@ class OMPNumTasksClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_num_tasks;
+    return T->getClauseKind() == llvm::omp::OMPC_num_tasks;
   }
 };
 
@@ -5897,11 +5928,12 @@ class OMPHintClause : public OMPClause {
   /// \param EndLoc Ending location of the clause.
   OMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc,
                 SourceLocation EndLoc)
-      : OMPClause(OMPC_hint, StartLoc, EndLoc), LParenLoc(LParenLoc),
+      : OMPClause(llvm::omp::OMPC_hint, StartLoc, EndLoc), LParenLoc(LParenLoc),
         Hint(Hint) {}
 
   /// Build an empty clause.
-  OMPHintClause() : OMPClause(OMPC_hint, SourceLocation(), SourceLocation()) {}
+  OMPHintClause()
+      : OMPClause(llvm::omp::OMPC_hint, SourceLocation(), SourceLocation()) {}
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -5926,7 +5958,7 @@ class OMPHintClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_hint;
+    return T->getClauseKind() == llvm::omp::OMPC_hint;
   }
 };
 
@@ -5998,7 +6030,7 @@ class OMPDistScheduleClause : public OMPClause, public OMPClauseWithPreInit {
                         SourceLocation EndLoc,
                         OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
                         Stmt *HelperChunkSize)
-      : OMPClause(OMPC_dist_schedule, StartLoc, EndLoc),
+      : OMPClause(llvm::omp::OMPC_dist_schedule, StartLoc, EndLoc),
         OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Kind(Kind),
         KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
     setPreInitStmt(HelperChunkSize);
@@ -6006,7 +6038,8 @@ class OMPDistScheduleClause : public OMPClause, public OMPClauseWithPreInit {
 
   /// Build an empty clause.
   explicit OMPDistScheduleClause()
-      : OMPClause(OMPC_dist_schedule, SourceLocation(), SourceLocation()),
+      : OMPClause(llvm::omp::OMPC_dist_schedule, SourceLocation(),
+                  SourceLocation()),
         OMPClauseWithPreInit(this) {}
 
   /// Get kind of the clause.
@@ -6045,7 +6078,7 @@ class OMPDistScheduleClause : public OMPClause, public OMPClauseWithPreInit {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_dist_schedule;
+    return T->getClauseKind() == llvm::omp::OMPC_dist_schedule;
   }
 };
 
@@ -6115,12 +6148,14 @@ class OMPDefaultmapClause : public OMPClause {
                       SourceLocation MLoc, SourceLocation KLoc,
                       SourceLocation EndLoc, OpenMPDefaultmapClauseKind Kind,
                       OpenMPDefaultmapClauseModifier M)
-      : OMPClause(OMPC_defaultmap, StartLoc, EndLoc), LParenLoc(LParenLoc),
-        Modifier(M), ModifierLoc(MLoc), Kind(Kind), KindLoc(KLoc) {}
+      : OMPClause(llvm::omp::OMPC_defaultmap, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), Modifier(M), ModifierLoc(MLoc), Kind(Kind),
+        KindLoc(KLoc) {}
 
   /// Build an empty clause.
   explicit OMPDefaultmapClause()
-      : OMPClause(OMPC_defaultmap, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_defaultmap, SourceLocation(),
+                  SourceLocation()) {}
 
   /// Get kind of the clause.
   OpenMPDefaultmapClauseKind getDefaultmapKind() const { return Kind; }
@@ -6157,7 +6192,7 @@ class OMPDefaultmapClause : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_defaultmap;
+    return T->getClauseKind() == llvm::omp::OMPC_defaultmap;
   }
 };
 
@@ -6195,8 +6230,8 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
                        DeclarationNameInfo MapperIdInfo,
                        const OMPVarListLocTy &Locs,
                        const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_to, Locs, Sizes, &MapperQualifierLoc,
-                                  &MapperIdInfo) {}
+      : OMPMappableExprListClause(llvm::omp::OMPC_to, Locs, Sizes,
+                                  &MapperQualifierLoc, &MapperIdInfo) {}
 
   /// Build an empty clause.
   ///
@@ -6206,7 +6241,8 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
   /// 3) NumComponentLists: number of component lists in this clause; and 4)
   /// NumComponents: total number of expression components in the clause.
   explicit OMPToClause(const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_to, OMPVarListLocTy(), Sizes) {}
+      : OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(),
+                                  Sizes) {}
 
   /// Define the sizes of each trailing object array except the last one. This
   /// is required for TrailingObjects to work properly.
@@ -6274,7 +6310,7 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_to;
+    return T->getClauseKind() == llvm::omp::OMPC_to;
   }
 };
 
@@ -6313,8 +6349,8 @@ class OMPFromClause final
                          DeclarationNameInfo MapperIdInfo,
                          const OMPVarListLocTy &Locs,
                          const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_from, Locs, Sizes, &MapperQualifierLoc,
-                                  &MapperIdInfo) {}
+      : OMPMappableExprListClause(llvm::omp::OMPC_from, Locs, Sizes,
+                                  &MapperQualifierLoc, &MapperIdInfo) {}
 
   /// Build an empty clause.
   ///
@@ -6324,7 +6360,8 @@ class OMPFromClause final
   /// 3) NumComponentLists: number of component lists in this clause; and 4)
   /// NumComponents: total number of expression components in the clause.
   explicit OMPFromClause(const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_from, OMPVarListLocTy(), Sizes) {}
+      : OMPMappableExprListClause(llvm::omp::OMPC_from, OMPVarListLocTy(),
+                                  Sizes) {}
 
   /// Define the sizes of each trailing object array except the last one. This
   /// is required for TrailingObjects to work properly.
@@ -6392,7 +6429,7 @@ class OMPFromClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_from;
+    return T->getClauseKind() == llvm::omp::OMPC_from;
   }
 };
 
@@ -6426,7 +6463,8 @@ class OMPUseDevicePtrClause final
   /// NumComponents: total number of expression components in the clause.
   explicit OMPUseDevicePtrClause(const OMPVarListLocTy &Locs,
                                  const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_use_device_ptr, Locs, Sizes) {}
+      : OMPMappableExprListClause(llvm::omp::OMPC_use_device_ptr, Locs, Sizes) {
+  }
 
   /// Build an empty clause.
   ///
@@ -6436,8 +6474,8 @@ class OMPUseDevicePtrClause final
   /// 3) NumComponentLists: number of component lists in this clause; and 4)
   /// NumComponents: total number of expression components in the clause.
   explicit OMPUseDevicePtrClause(const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_use_device_ptr, OMPVarListLocTy(),
-                                  Sizes) {}
+      : OMPMappableExprListClause(llvm::omp::OMPC_use_device_ptr,
+                                  OMPVarListLocTy(), Sizes) {}
 
   /// Define the sizes of each trailing object array except the last one. This
   /// is required for TrailingObjects to work properly.
@@ -6555,7 +6593,7 @@ class OMPUseDevicePtrClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_use_device_ptr;
+    return T->getClauseKind() == llvm::omp::OMPC_use_device_ptr;
   }
 };
 
@@ -6589,7 +6627,7 @@ class OMPIsDevicePtrClause final
   /// NumComponents: total number of expression components in the clause.
   explicit OMPIsDevicePtrClause(const OMPVarListLocTy &Locs,
                                 const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_is_device_ptr, Locs, Sizes) {}
+      : OMPMappableExprListClause(llvm::omp::OMPC_is_device_ptr, Locs, Sizes) {}
 
   /// Build an empty clause.
   ///
@@ -6599,8 +6637,8 @@ class OMPIsDevicePtrClause final
   /// 3) NumComponentLists: number of component lists in this clause; and 4)
   /// NumComponents: total number of expression components in the clause.
   explicit OMPIsDevicePtrClause(const OMPMappableExprListSizeTy &Sizes)
-      : OMPMappableExprListClause(OMPC_is_device_ptr, OMPVarListLocTy(),
-                                  Sizes) {}
+      : OMPMappableExprListClause(llvm::omp::OMPC_is_device_ptr,
+                                  OMPVarListLocTy(), Sizes) {}
 
   /// Define the sizes of each trailing object array except the last one. This
   /// is required for TrailingObjects to work properly.
@@ -6658,7 +6696,7 @@ class OMPIsDevicePtrClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_is_device_ptr;
+    return T->getClauseKind() == llvm::omp::OMPC_is_device_ptr;
   }
 };
 
@@ -6684,15 +6722,16 @@ class OMPNontemporalClause final
   /// \param N Number of the variables in the clause.
   OMPNontemporalClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                        SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPNontemporalClause>(OMPC_nontemporal, StartLoc,
-                                               LParenLoc, EndLoc, N) {}
+      : OMPVarListClause<OMPNontemporalClause>(llvm::omp::OMPC_nontemporal,
+                                               StartLoc, LParenLoc, EndLoc, N) {
+  }
 
   /// Build an empty clause.
   ///
   /// \param N Number of variables.
   explicit OMPNontemporalClause(unsigned N)
       : OMPVarListClause<OMPNontemporalClause>(
-            OMPC_nontemporal, SourceLocation(), SourceLocation(),
+            llvm::omp::OMPC_nontemporal, SourceLocation(), SourceLocation(),
             SourceLocation(), N) {}
 
   /// Get the list of privatied copies if the member expression was captured by
@@ -6754,7 +6793,7 @@ class OMPNontemporalClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_nontemporal;
+    return T->getClauseKind() == llvm::omp::OMPC_nontemporal;
   }
 };
 
@@ -6798,12 +6837,12 @@ class OMPOrderClause final : public OMPClause {
   OMPOrderClause(OpenMPOrderClauseKind A, SourceLocation ALoc,
                  SourceLocation StartLoc, SourceLocation LParenLoc,
                  SourceLocation EndLoc)
-      : OMPClause(OMPC_order, StartLoc, EndLoc), LParenLoc(LParenLoc), Kind(A),
-        KindKwLoc(ALoc) {}
+      : OMPClause(llvm::omp::OMPC_order, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
 
   /// Build an empty clause.
   OMPOrderClause()
-      : OMPClause(OMPC_order, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_order, SourceLocation(), SourceLocation()) {}
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -6833,7 +6872,7 @@ class OMPOrderClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_order;
+    return T->getClauseKind() == llvm::omp::OMPC_order;
   }
 };
 
@@ -6851,11 +6890,12 @@ class OMPDestroyClause final : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
   OMPDestroyClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(OMPC_destroy, StartLoc, EndLoc) {}
+      : OMPClause(llvm::omp::OMPC_destroy, StartLoc, EndLoc) {}
 
   /// Build an empty clause.
   OMPDestroyClause()
-      : OMPClause(OMPC_destroy, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_destroy, SourceLocation(), SourceLocation()) {
+  }
 
   child_range children() {
     return child_range(child_iterator(), child_iterator());
@@ -6873,7 +6913,7 @@ class OMPDestroyClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_destroy;
+    return T->getClauseKind() == llvm::omp::OMPC_destroy;
   }
 };
 
@@ -6908,12 +6948,12 @@ class OMPDetachClause final : public OMPClause {
   /// \param EndLoc Ending location of the clause.
   OMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc,
                   SourceLocation EndLoc)
-      : OMPClause(OMPC_detach, StartLoc, EndLoc), LParenLoc(LParenLoc),
-        Evt(Evt) {}
+      : OMPClause(llvm::omp::OMPC_detach, StartLoc, EndLoc),
+        LParenLoc(LParenLoc), Evt(Evt) {}
 
   /// Build an empty clause.
   OMPDetachClause()
-      : OMPClause(OMPC_detach, SourceLocation(), SourceLocation()) {}
+      : OMPClause(llvm::omp::OMPC_detach, SourceLocation(), SourceLocation()) {}
 
   /// Returns the location of '('.
   SourceLocation getLParenLoc() const { return LParenLoc; }
@@ -6935,7 +6975,7 @@ class OMPDetachClause final : public OMPClause {
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_detach;
+    return T->getClauseKind() == llvm::omp::OMPC_detach;
   }
 };
 
@@ -6961,16 +7001,16 @@ class OMPInclusiveClause final
   /// \param N Number of the variables in the clause.
   OMPInclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                      SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPInclusiveClause>(OMPC_inclusive, StartLoc,
-                                             LParenLoc, EndLoc, N) {}
+      : OMPVarListClause<OMPInclusiveClause>(llvm::omp::OMPC_inclusive,
+                                             StartLoc, LParenLoc, EndLoc, N) {}
 
   /// Build an empty clause.
   ///
   /// \param N Number of variables.
   explicit OMPInclusiveClause(unsigned N)
-      : OMPVarListClause<OMPInclusiveClause>(OMPC_inclusive, SourceLocation(),
+      : OMPVarListClause<OMPInclusiveClause>(llvm::omp::OMPC_inclusive,
                                              SourceLocation(), SourceLocation(),
-                                             N) {}
+                                             SourceLocation(), N) {}
 
 public:
   /// Creates clause with a list of variables \a VL.
@@ -7009,7 +7049,7 @@ class OMPInclusiveClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_inclusive;
+    return T->getClauseKind() == llvm::omp::OMPC_inclusive;
   }
 };
 
@@ -7035,16 +7075,16 @@ class OMPExclusiveClause final
   /// \param N Number of the variables in the clause.
   OMPExclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
                      SourceLocation EndLoc, unsigned N)
-      : OMPVarListClause<OMPExclusiveClause>(OMPC_exclusive, StartLoc,
-                                             LParenLoc, EndLoc, N) {}
+      : OMPVarListClause<OMPExclusiveClause>(llvm::omp::OMPC_exclusive,
+                                             StartLoc, LParenLoc, EndLoc, N) {}
 
   /// Build an empty clause.
   ///
   /// \param N Number of variables.
   explicit OMPExclusiveClause(unsigned N)
-      : OMPVarListClause<OMPExclusiveClause>(OMPC_exclusive, SourceLocation(),
+      : OMPVarListClause<OMPExclusiveClause>(llvm::omp::OMPC_exclusive,
                                              SourceLocation(), SourceLocation(),
-                                             N) {}
+                                             SourceLocation(), N) {}
 
 public:
   /// Creates clause with a list of variables \a VL.
@@ -7083,7 +7123,7 @@ class OMPExclusiveClause final
   }
 
   static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == OMPC_exclusive;
+    return T->getClauseKind() == llvm::omp::OMPC_exclusive;
   }
 };
 
@@ -7096,17 +7136,20 @@ class OMPClauseVisitorBase {
 #define DISPATCH(CLASS) \
   return static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<PTR(CLASS)>(S))
 
-#define OPENMP_CLAUSE(Name, Class)                              \
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) \
   RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); }
-#include "clang/Basic/OpenMPKinds.def"
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
 
   RetTy Visit(PTR(OMPClause) S) {
     // Top switch clause: visit each OMPClause.
     switch (S->getClauseKind()) {
-    default: llvm_unreachable("Unknown clause kind!");
-#define OPENMP_CLAUSE(Name, Class)                              \
-    case OMPC_ ## Name : return Visit ## Class(static_cast<PTR(Class)>(S));
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class)                                     \
+  case llvm::omp::Clause::Enum:                                                \
+    return Visit##Class(static_cast<PTR(Class)>(S));
+#define OMP_CLAUSE_NO_CLASS(Enum, Str)                                         \
+  case llvm::omp::Clause::Enum:                                                \
+    break;
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
     }
   }
   // Base case, ignore it. :)
@@ -7135,8 +7178,9 @@ class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
   OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy)
       : OS(OS), Policy(Policy) {}
 
-#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S);
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class)                                     \
+  void Visit##Class(Class *S);
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
 };
 
 struct OMPTraitProperty {

diff  --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 345333849659..b19b566294b7 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -534,8 +534,8 @@ template <typename Derived> class RecursiveASTVisitor {
   bool TraverseOMPExecutableDirective(OMPExecutableDirective *S);
   bool TraverseOMPLoopDirective(OMPLoopDirective *S);
   bool TraverseOMPClause(OMPClause *C);
-#define OPENMP_CLAUSE(Name, Class) bool Visit##Class(Class *C);
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C);
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   /// Process clauses with list of variables.
   template <typename T> bool VisitOMPClauseList(T *Node);
   /// Process clauses with pre-initis.
@@ -2957,17 +2957,14 @@ bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
   if (!C)
     return true;
   switch (C->getClauseKind()) {
-#define OPENMP_CLAUSE(Name, Class)                                             \
-  case OMPC_##Name:                                                            \
+#define OMP_CLAUSE_CLASS(Enum, Str, Class)                                     \
+  case llvm::omp::Clause::Enum:                                                \
     TRY_TO(Visit##Class(static_cast<Class *>(C)));                             \
     break;
-#include "clang/Basic/OpenMPKinds.def"
-  case OMPC_threadprivate:
-  case OMPC_uniform:
-  case OMPC_device_type:
-  case OMPC_match:
-  case OMPC_unknown:
+#define OMP_CLAUSE_NO_CLASS(Enum, Str)                                         \
+  case llvm::omp::Clause::Enum:                                                \
     break;
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   }
   return true;
 }

diff  --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index 96bfdd313f47..f55ce2cc84dd 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -3242,8 +3242,13 @@ def OMPCaptureKind : Attr {
   // This attribute has no spellings as it is only ever created implicitly.
   let Spellings = [];
   let SemaHandler = 0;
-  let Args = [UnsignedArgument<"CaptureKind">];
+  let Args = [UnsignedArgument<"CaptureKindVal">];
   let Documentation = [Undocumented];
+  let AdditionalMembers = [{
+    llvm::omp::Clause getCaptureKind() const {
+      return static_cast<llvm::omp::Clause>(getCaptureKindVal());
+    }
+  }];
 }
 
 def OMPReferencedVar : Attr {

diff  --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def
index 3cf92ead9560..4a4e6c6cb4c3 100644
--- a/clang/include/clang/Basic/OpenMPKinds.def
+++ b/clang/include/clang/Basic/OpenMPKinds.def
@@ -222,74 +222,6 @@
 #define OPENMP_REDUCTION_MODIFIER(Name)
 #endif
 
-// OpenMP clauses.
-OPENMP_CLAUSE(allocator, OMPAllocatorClause)
-OPENMP_CLAUSE(if, OMPIfClause)
-OPENMP_CLAUSE(final, OMPFinalClause)
-OPENMP_CLAUSE(num_threads, OMPNumThreadsClause)
-OPENMP_CLAUSE(safelen, OMPSafelenClause)
-OPENMP_CLAUSE(simdlen, OMPSimdlenClause)
-OPENMP_CLAUSE(collapse, OMPCollapseClause)
-OPENMP_CLAUSE(default, OMPDefaultClause)
-OPENMP_CLAUSE(private, OMPPrivateClause)
-OPENMP_CLAUSE(firstprivate, OMPFirstprivateClause)
-OPENMP_CLAUSE(lastprivate, OMPLastprivateClause)
-OPENMP_CLAUSE(shared,  OMPSharedClause)
-OPENMP_CLAUSE(reduction,  OMPReductionClause)
-OPENMP_CLAUSE(linear,  OMPLinearClause)
-OPENMP_CLAUSE(aligned, OMPAlignedClause)
-OPENMP_CLAUSE(copyin,  OMPCopyinClause)
-OPENMP_CLAUSE(copyprivate,  OMPCopyprivateClause)
-OPENMP_CLAUSE(proc_bind, OMPProcBindClause)
-OPENMP_CLAUSE(schedule, OMPScheduleClause)
-OPENMP_CLAUSE(ordered, OMPOrderedClause)
-OPENMP_CLAUSE(nowait, OMPNowaitClause)
-OPENMP_CLAUSE(untied, OMPUntiedClause)
-OPENMP_CLAUSE(mergeable, OMPMergeableClause)
-OPENMP_CLAUSE(flush, OMPFlushClause)
-OPENMP_CLAUSE(read, OMPReadClause)
-OPENMP_CLAUSE(write, OMPWriteClause)
-OPENMP_CLAUSE(update, OMPUpdateClause)
-OPENMP_CLAUSE(capture, OMPCaptureClause)
-OPENMP_CLAUSE(seq_cst, OMPSeqCstClause)
-OPENMP_CLAUSE(acq_rel, OMPAcqRelClause)
-OPENMP_CLAUSE(acquire, OMPAcquireClause)
-OPENMP_CLAUSE(release, OMPReleaseClause)
-OPENMP_CLAUSE(relaxed, OMPRelaxedClause)
-OPENMP_CLAUSE(depend, OMPDependClause)
-OPENMP_CLAUSE(device, OMPDeviceClause)
-OPENMP_CLAUSE(threads, OMPThreadsClause)
-OPENMP_CLAUSE(simd, OMPSIMDClause)
-OPENMP_CLAUSE(map, OMPMapClause)
-OPENMP_CLAUSE(num_teams, OMPNumTeamsClause)
-OPENMP_CLAUSE(thread_limit, OMPThreadLimitClause)
-OPENMP_CLAUSE(priority, OMPPriorityClause)
-OPENMP_CLAUSE(grainsize, OMPGrainsizeClause)
-OPENMP_CLAUSE(nogroup, OMPNogroupClause)
-OPENMP_CLAUSE(num_tasks, OMPNumTasksClause)
-OPENMP_CLAUSE(hint, OMPHintClause)
-OPENMP_CLAUSE(dist_schedule, OMPDistScheduleClause)
-OPENMP_CLAUSE(defaultmap, OMPDefaultmapClause)
-OPENMP_CLAUSE(to, OMPToClause)
-OPENMP_CLAUSE(from, OMPFromClause)
-OPENMP_CLAUSE(use_device_ptr, OMPUseDevicePtrClause)
-OPENMP_CLAUSE(is_device_ptr, OMPIsDevicePtrClause)
-OPENMP_CLAUSE(task_reduction,  OMPTaskReductionClause)
-OPENMP_CLAUSE(in_reduction,  OMPInReductionClause)
-OPENMP_CLAUSE(unified_address, OMPUnifiedAddressClause)
-OPENMP_CLAUSE(unified_shared_memory, OMPUnifiedSharedMemoryClause)
-OPENMP_CLAUSE(reverse_offload, OMPReverseOffloadClause)
-OPENMP_CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause)
-OPENMP_CLAUSE(atomic_default_mem_order, OMPAtomicDefaultMemOrderClause)
-OPENMP_CLAUSE(allocate, OMPAllocateClause)
-OPENMP_CLAUSE(nontemporal, OMPNontemporalClause)
-OPENMP_CLAUSE(order, OMPOrderClause)
-OPENMP_CLAUSE(depobj, OMPDepobjClause)
-OPENMP_CLAUSE(destroy, OMPDestroyClause)
-OPENMP_CLAUSE(detach, OMPDetachClause)
-OPENMP_CLAUSE(inclusive, OMPInclusiveClause)
-OPENMP_CLAUSE(exclusive, OMPExclusiveClause)
-
 // Clauses allowed for OpenMP directive 'scan'.
 OPENMP_SCAN_CLAUSE(inclusive)
 OPENMP_SCAN_CLAUSE(exclusive)

diff  --git a/clang/include/clang/Basic/OpenMPKinds.h b/clang/include/clang/Basic/OpenMPKinds.h
index f12b5545d0c1..9a6a2050a165 100644
--- a/clang/include/clang/Basic/OpenMPKinds.h
+++ b/clang/include/clang/Basic/OpenMPKinds.h
@@ -23,16 +23,7 @@ namespace clang {
 using OpenMPDirectiveKind = llvm::omp::Directive;
 
 /// OpenMP clauses.
-enum OpenMPClauseKind {
-#define OPENMP_CLAUSE(Name, Class) \
-  OMPC_##Name,
-#include "clang/Basic/OpenMPKinds.def"
-  OMPC_threadprivate,
-  OMPC_uniform,
-  OMPC_device_type,
-  OMPC_match,
-  OMPC_unknown
-};
+using OpenMPClauseKind = llvm::omp::Clause;
 
 /// OpenMP attributes for 'schedule' clause.
 enum OpenMPScheduleClauseKind {
@@ -179,9 +170,6 @@ enum OpenMPReductionClauseModifier {
   OMPC_REDUCTION_unknown,
 };
 
-OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str);
-const char *getOpenMPClauseName(OpenMPClauseKind Kind);
-
 unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str);
 const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
 

diff  --git a/clang/lib/AST/ASTTypeTraits.cpp b/clang/lib/AST/ASTTypeTraits.cpp
index e4ea3f41af36..6404edd79679 100644
--- a/clang/lib/AST/ASTTypeTraits.cpp
+++ b/clang/lib/AST/ASTTypeTraits.cpp
@@ -39,8 +39,8 @@ const ASTNodeKind::KindInfo ASTNodeKind::AllKindInfo[] = {
 #define TYPE(DERIVED, BASE) { NKI_##BASE, #DERIVED "Type" },
 #include "clang/AST/TypeNodes.inc"
   { NKI_None, "OMPClause" },
-#define OPENMP_CLAUSE(TextualSpelling, Class) {NKI_OMPClause, #Class},
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) {NKI_OMPClause, #Class},
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
 };
 
 bool ASTNodeKind::isBaseOf(ASTNodeKind Other, unsigned *Distance) const {
@@ -111,15 +111,13 @@ ASTNodeKind ASTNodeKind::getFromNode(const Type &T) {
 
 ASTNodeKind ASTNodeKind::getFromNode(const OMPClause &C) {
   switch (C.getClauseKind()) {
-#define OPENMP_CLAUSE(Name, Class)                                             \
-    case OMPC_##Name: return ASTNodeKind(NKI_##Class);
-#include "clang/Basic/OpenMPKinds.def"
-  case OMPC_threadprivate:
-  case OMPC_uniform:
-  case OMPC_device_type:
-  case OMPC_match:
-  case OMPC_unknown:
+#define OMP_CLAUSE_CLASS(Enum, Str, Class)                                     \
+  case llvm::omp::Clause::Enum:                                                \
+    return ASTNodeKind(NKI_##Class);
+#define OMP_CLAUSE_NO_CLASS(Enum, Str)                                         \
+  case llvm::omp::Clause::Enum:                                                \
     llvm_unreachable("unexpected OpenMP clause kind");
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   }
   llvm_unreachable("invalid stmt kind");
 }

diff  --git a/clang/lib/AST/AttrImpl.cpp b/clang/lib/AST/AttrImpl.cpp
index bc0db1ba10a2..7818fbb1918b 100644
--- a/clang/lib/AST/AttrImpl.cpp
+++ b/clang/lib/AST/AttrImpl.cpp
@@ -108,7 +108,8 @@ void OMPDeclareSimdDeclAttr::printPrettyPragma(
   for (auto *E : linears()) {
     OS << " linear(";
     if (*MI != OMPC_LINEAR_unknown)
-      OS << getOpenMPSimpleClauseTypeName(OMPC_linear, *MI) << "(";
+      OS << getOpenMPSimpleClauseTypeName(llvm::omp::Clause::OMPC_linear, *MI)
+         << "(";
     E->printPretty(OS, nullptr, Policy);
     if (*MI != OMPC_LINEAR_unknown)
       OS << ")";

diff  --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp
index a205a1bca1b9..0fdbec634103 100644
--- a/clang/lib/AST/OpenMPClause.cpp
+++ b/clang/lib/AST/OpenMPClause.cpp
@@ -31,20 +31,20 @@ OMPClause::child_range OMPClause::children() {
   switch (getClauseKind()) {
   default:
     break;
-#define OPENMP_CLAUSE(Name, Class)                                             \
-  case OMPC_##Name:                                                            \
+#define OMP_CLAUSE_CLASS(Enum, Str, Class)                                           \
+  case Enum:                                                                   \
     return static_cast<Class *>(this)->children();
-#include "clang/Basic/OpenMPKinds.def"
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   }
   llvm_unreachable("unknown OMPClause");
 }
 
 OMPClause::child_range OMPClause::used_children() {
   switch (getClauseKind()) {
-#define OPENMP_CLAUSE(Name, Class)                                             \
-  case OMPC_##Name:                                                            \
+#define OMP_CLAUSE_CLASS(Enum, Str, Class)                                           \
+  case Enum:                                                                   \
     return static_cast<Class *>(this)->used_children();
-#include "clang/Basic/OpenMPKinds.def"
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   case OMPC_threadprivate:
   case OMPC_uniform:
   case OMPC_device_type:

diff  --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index fec12ac98b4e..be0bc13ccb4d 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -414,9 +414,8 @@ class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> {
 
 public:
   OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
-#define OPENMP_CLAUSE(Name, Class)                                             \
-  void Visit##Class(const Class *C);
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C);
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C);
   void VistOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C);
 };

diff  --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index dc0dd92f09df..2933457b5711 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -314,7 +314,7 @@ void TextNodeDumper::Visit(const OMPClause *C) {
   }
   {
     ColorScope Color(OS, ShowColors, AttrColor);
-    StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
+    StringRef ClauseName(llvm::omp::getOpenMPClauseName(C->getClauseKind()));
     OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
        << ClauseName.drop_front() << "Clause";
   }
@@ -1534,7 +1534,8 @@ void TextNodeDumper::VisitOMPRequiresDecl(const OMPRequiresDecl *D) {
       }
       {
         ColorScope Color(OS, ShowColors, AttrColor);
-        StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
+        StringRef ClauseName(
+            llvm::omp::getOpenMPClauseName(C->getClauseKind()));
         OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
            << ClauseName.drop_front() << "Clause";
       }

diff  --git a/clang/lib/ASTMatchers/CMakeLists.txt b/clang/lib/ASTMatchers/CMakeLists.txt
index 8f700ca3226b..cde871cd31ca 100644
--- a/clang/lib/ASTMatchers/CMakeLists.txt
+++ b/clang/lib/ASTMatchers/CMakeLists.txt
@@ -1,6 +1,9 @@
 add_subdirectory(Dynamic)
 
-set(LLVM_LINK_COMPONENTS support)
+set(LLVM_LINK_COMPONENTS
+  FrontendOpenMP
+  Support
+)
 
 add_clang_library(clangASTMatchers
   ASTMatchFinder.cpp

diff  --git a/clang/lib/ASTMatchers/Dynamic/Marshallers.h b/clang/lib/ASTMatchers/Dynamic/Marshallers.h
index 48a454e3397e..db9122acede7 100644
--- a/clang/lib/ASTMatchers/Dynamic/Marshallers.h
+++ b/clang/lib/ASTMatchers/Dynamic/Marshallers.h
@@ -170,9 +170,8 @@ template <> struct ArgTypeTraits<OpenMPClauseKind> {
 private:
   static Optional<OpenMPClauseKind> getClauseKind(llvm::StringRef ClauseKind) {
     return llvm::StringSwitch<Optional<OpenMPClauseKind>>(ClauseKind)
-#define OPENMP_CLAUSE(TextualSpelling, Class)                                  \
-  .Case("OMPC_" #TextualSpelling, OMPC_##TextualSpelling)
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) .Case(#Enum, llvm::omp::Clause::Enum)
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
         .Default(llvm::None);
   }
 

diff  --git a/clang/lib/Analysis/CMakeLists.txt b/clang/lib/Analysis/CMakeLists.txt
index c1d0d6ed62c5..3333eab3b96d 100644
--- a/clang/lib/Analysis/CMakeLists.txt
+++ b/clang/lib/Analysis/CMakeLists.txt
@@ -1,4 +1,5 @@
 set(LLVM_LINK_COMPONENTS
+  FrontendOpenMP
   Support
   )
 

diff  --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp
index 7a7c66c8e587..981bd7adbe9b 100644
--- a/clang/lib/Basic/OpenMPKinds.cpp
+++ b/clang/lib/Basic/OpenMPKinds.cpp
@@ -20,50 +20,6 @@
 using namespace clang;
 using namespace llvm::omp;
 
-OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) {
-  // 'flush' clause cannot be specified explicitly, because this is an implicit
-  // clause for 'flush' directive. If the 'flush' clause is explicitly specified
-  // the Parser should generate a warning about extra tokens at the end of the
-  // directive.
-  // 'depobj' clause cannot be specified explicitly, because this is an implicit
-  // clause for 'depobj' directive. If the 'depobj' clause is explicitly
-  // specified the Parser should generate a warning about extra tokens at the
-  // end of the directive.
-  if (llvm::StringSwitch<bool>(Str)
-          .Case("flush", true)
-          .Case("depobj", true)
-          .Default(false))
-    return OMPC_unknown;
-  return llvm::StringSwitch<OpenMPClauseKind>(Str)
-#define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name)
-#include "clang/Basic/OpenMPKinds.def"
-      .Case("uniform", OMPC_uniform)
-      .Case("device_type", OMPC_device_type)
-      .Case("match", OMPC_match)
-      .Default(OMPC_unknown);
-}
-
-const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) {
-  assert(Kind <= OMPC_unknown);
-  switch (Kind) {
-  case OMPC_unknown:
-    return "unknown";
-#define OPENMP_CLAUSE(Name, Class)                                             \
-  case OMPC_##Name:                                                            \
-    return #Name;
-#include "clang/Basic/OpenMPKinds.def"
-  case OMPC_uniform:
-    return "uniform";
-  case OMPC_threadprivate:
-    return "threadprivate or thread local";
-  case OMPC_device_type:
-    return "device_type";
-  case OMPC_match:
-    return "match";
-  }
-  llvm_unreachable("Invalid OpenMP clause kind");
-}
-
 unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
                                           StringRef Str) {
   switch (Kind) {

diff  --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
index aa6b6bc64c32..b6db63545c2c 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
@@ -341,8 +341,7 @@ class CheckVarsEscapingDeclContext final
           if (!Attr)
             return;
           if (((Attr->getCaptureKind() != OMPC_map) &&
-               !isOpenMPPrivate(
-                   static_cast<OpenMPClauseKind>(Attr->getCaptureKind()))) ||
+               !isOpenMPPrivate(Attr->getCaptureKind())) ||
               ((Attr->getCaptureKind() == OMPC_map) &&
                !FD->getType()->isAnyPointerType()))
             return;

diff  --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 4bec5f557ab8..4da1b4146af3 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -1389,7 +1389,7 @@ bool Parser::parseOMPDeclareVariantMatchClause(SourceLocation Loc,
   // Parse '('.
   BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
   if (T.expectAndConsume(diag::err_expected_lparen_after,
-                         getOpenMPClauseName(OMPC_match))) {
+                         getOpenMPClauseName(OMPC_match).data())) {
     while (!SkipUntil(tok::annot_pragma_openmp_end, StopBeforeMatch))
       ;
     // Skip the last annot_pragma_openmp_end.
@@ -1436,7 +1436,7 @@ parseOpenMPSimpleClause(Parser &P, OpenMPClauseKind Kind) {
   // Parse '('.
   BalancedDelimiterTracker T(P, tok::l_paren, tok::annot_pragma_openmp_end);
   if (T.expectAndConsume(diag::err_expected_lparen_after,
-                         getOpenMPClauseName(Kind)))
+                         getOpenMPClauseName(Kind).data()))
     return llvm::None;
 
   unsigned Type = getOpenMPSimpleClauseType(
@@ -1675,18 +1675,18 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
       SmallVector<OMPClause *, 1> Clauses;
       if (Tok.isNot(tok::annot_pragma_openmp_end)) {
         SmallVector<llvm::PointerIntPair<OMPClause *, 1, bool>,
-                    OMPC_unknown + 1>
-            FirstClauses(OMPC_unknown + 1);
+                    unsigned(OMPC_unknown) + 1>
+          FirstClauses(unsigned(OMPC_unknown) + 1);
         while (Tok.isNot(tok::annot_pragma_openmp_end)) {
           OpenMPClauseKind CKind =
               Tok.isAnnotation() ? OMPC_unknown
                                  : getOpenMPClauseKind(PP.getSpelling(Tok));
           Actions.StartOpenMPClause(CKind);
-          OMPClause *Clause = ParseOpenMPClause(OMPD_allocate, CKind,
-                                                !FirstClauses[CKind].getInt());
+          OMPClause *Clause = ParseOpenMPClause(
+              OMPD_allocate, CKind, !FirstClauses[unsigned(CKind)].getInt());
           SkipUntil(tok::comma, tok::identifier, tok::annot_pragma_openmp_end,
                     StopBeforeMatch);
-          FirstClauses[CKind].setInt(true);
+          FirstClauses[unsigned(CKind)].setInt(true);
           if (Clause != nullptr)
             Clauses.push_back(Clause);
           if (Tok.is(tok::annot_pragma_openmp_end)) {
@@ -1710,8 +1710,9 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
   case OMPD_requires: {
     SourceLocation StartLoc = ConsumeToken();
     SmallVector<OMPClause *, 5> Clauses;
-    SmallVector<llvm::PointerIntPair<OMPClause *, 1, bool>, OMPC_unknown + 1>
-    FirstClauses(OMPC_unknown + 1);
+    SmallVector<llvm::PointerIntPair<OMPClause *, 1, bool>,
+                unsigned(OMPC_unknown) + 1>
+    FirstClauses(unsigned(OMPC_unknown) + 1);
     if (Tok.is(tok::annot_pragma_openmp_end)) {
       Diag(Tok, diag::err_omp_expected_clause)
           << getOpenMPDirectiveName(OMPD_requires);
@@ -1722,11 +1723,11 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
                                    ? OMPC_unknown
                                    : getOpenMPClauseKind(PP.getSpelling(Tok));
       Actions.StartOpenMPClause(CKind);
-      OMPClause *Clause = ParseOpenMPClause(OMPD_requires, CKind,
-                                            !FirstClauses[CKind].getInt());
+      OMPClause *Clause = ParseOpenMPClause(
+          OMPD_requires, CKind, !FirstClauses[unsigned(CKind)].getInt());
       SkipUntil(tok::comma, tok::identifier, tok::annot_pragma_openmp_end,
                 StopBeforeMatch);
-      FirstClauses[CKind].setInt(true);
+      FirstClauses[unsigned(CKind)].setInt(true);
       if (Clause != nullptr)
         Clauses.push_back(Clause);
       if (Tok.is(tok::annot_pragma_openmp_end)) {
@@ -2025,8 +2026,9 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
   ParsingOpenMPDirectiveRAII DirScope(*this);
   ParenBraceBracketBalancer BalancerRAIIObj(*this);
   SmallVector<OMPClause *, 5> Clauses;
-  SmallVector<llvm::PointerIntPair<OMPClause *, 1, bool>, OMPC_unknown + 1>
-  FirstClauses(OMPC_unknown + 1);
+  SmallVector<llvm::PointerIntPair<OMPClause *, 1, bool>,
+              unsigned(OMPC_unknown) + 1>
+  FirstClauses(unsigned(OMPC_unknown) + 1);
   unsigned ScopeFlags = Scope::FnScope | Scope::DeclScope |
                         Scope::CompoundStmtScope | Scope::OpenMPDirectiveScope;
   SourceLocation Loc = ConsumeAnnotationToken(), EndLoc;
@@ -2071,18 +2073,18 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
       SmallVector<OMPClause *, 1> Clauses;
       if (Tok.isNot(tok::annot_pragma_openmp_end)) {
         SmallVector<llvm::PointerIntPair<OMPClause *, 1, bool>,
-                    OMPC_unknown + 1>
-            FirstClauses(OMPC_unknown + 1);
+                    unsigned(OMPC_unknown) + 1>
+            FirstClauses(unsigned(OMPC_unknown) + 1);
         while (Tok.isNot(tok::annot_pragma_openmp_end)) {
           OpenMPClauseKind CKind =
               Tok.isAnnotation() ? OMPC_unknown
                                  : getOpenMPClauseKind(PP.getSpelling(Tok));
           Actions.StartOpenMPClause(CKind);
-          OMPClause *Clause = ParseOpenMPClause(OMPD_allocate, CKind,
-                                                !FirstClauses[CKind].getInt());
+          OMPClause *Clause = ParseOpenMPClause(
+              OMPD_allocate, CKind, !FirstClauses[unsigned(CKind)].getInt());
           SkipUntil(tok::comma, tok::identifier, tok::annot_pragma_openmp_end,
                     StopBeforeMatch);
-          FirstClauses[CKind].setInt(true);
+          FirstClauses[unsigned(CKind)].setInt(true);
           if (Clause != nullptr)
             Clauses.push_back(Clause);
           if (Tok.is(tok::annot_pragma_openmp_end)) {
@@ -2250,11 +2252,11 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
       ImplicitClauseAllowed = false;
       Actions.StartOpenMPClause(CKind);
       HasImplicitClause = false;
-      OMPClause *Clause =
-          ParseOpenMPClause(DKind, CKind, !FirstClauses[CKind].getInt());
-      FirstClauses[CKind].setInt(true);
+      OMPClause *Clause = ParseOpenMPClause(
+          DKind, CKind, !FirstClauses[unsigned(CKind)].getInt());
+      FirstClauses[unsigned(CKind)].setInt(true);
       if (Clause) {
-        FirstClauses[CKind].setPointer(Clause);
+        FirstClauses[unsigned(CKind)].setPointer(Clause);
         Clauses.push_back(Clause);
       }
 
@@ -2271,7 +2273,7 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
     // OpenMP [2.13.8, ordered Construct, Syntax]
     // If the depend clause is specified, the ordered construct is a stand-alone
     // directive.
-    if (DKind == OMPD_ordered && FirstClauses[OMPC_depend].getInt()) {
+    if (DKind == OMPD_ordered && FirstClauses[unsigned(OMPC_depend)].getInt()) {
       if ((StmtCtx & ParsedStmtContext::AllowStandaloneOpenMPDirectives) ==
           ParsedStmtContext()) {
         Diag(Loc, diag::err_omp_immediate_directive)
@@ -2756,7 +2758,7 @@ OMPClause *Parser::ParseOpenMPSingleExprWithArgClause(OpenMPDirectiveKind DKind,
   // Parse '('.
   BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
   if (T.expectAndConsume(diag::err_expected_lparen_after,
-                         getOpenMPClauseName(Kind)))
+                         getOpenMPClauseName(Kind).data()))
     return nullptr;
 
   ExprResult Val;
@@ -3176,7 +3178,7 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
   // Parse '('.
   BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
   if (T.expectAndConsume(diag::err_expected_lparen_after,
-                         getOpenMPClauseName(Kind)))
+                         getOpenMPClauseName(Kind).data()))
     return true;
 
   bool DependWithIterator = false;

diff  --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index cfaf981983c1..dfb809e0aaa1 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -2233,7 +2233,7 @@ void Sema::setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D,
     }
   }
   if (OMPC != OMPC_unknown)
-    FD->addAttr(OMPCaptureKindAttr::CreateImplicit(Context, OMPC));
+    FD->addAttr(OMPCaptureKindAttr::CreateImplicit(Context, unsigned(OMPC)));
 }
 
 bool Sema::isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level,

diff  --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index de05d436d3b9..1f88f9c57465 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -730,10 +730,10 @@ class TreeTransform {
 #define ABSTRACT_STMT(Stmt)
 #include "clang/AST/StmtNodes.inc"
 
-#define OPENMP_CLAUSE(Name, Class)                        \
+#define OMP_CLAUSE_CLASS(Enum, Str, Class)                                           \
   LLVM_ATTRIBUTE_NOINLINE \
   OMPClause *Transform ## Class(Class *S);
-#include "clang/Basic/OpenMPKinds.def"
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
 
   /// Build a new qualified type given its unqualified type and type location.
   ///
@@ -3597,10 +3597,10 @@ OMPClause *TreeTransform<Derived>::TransformOMPClause(OMPClause *S) {
   switch (S->getClauseKind()) {
   default: break;
   // Transform individual clause nodes
-#define OPENMP_CLAUSE(Name, Class)                                             \
-  case OMPC_ ## Name :                                                         \
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) \
+  case Enum:                                                                   \
     return getDerived().Transform ## Class(cast<Class>(S));
-#include "clang/Basic/OpenMPKinds.def"
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   }
 
   return S;

diff  --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 7d84f1108c85..22a3771e4b85 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -11616,8 +11616,8 @@ class OMPClauseReader : public OMPClauseVisitor<OMPClauseReader> {
   OMPClauseReader(ASTRecordReader &Record)
       : Record(Record), Context(Record.getContext()) {}
 
-#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C);
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *C);
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   OMPClause *readClause();
   void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C);
   void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C);
@@ -11631,149 +11631,149 @@ OMPClause *ASTRecordReader::readOMPClause() {
 
 OMPClause *OMPClauseReader::readClause() {
   OMPClause *C = nullptr;
-  switch (Record.readInt()) {
-  case OMPC_if:
+  switch (llvm::omp::Clause(Record.readInt())) {
+  case llvm::omp::OMPC_if:
     C = new (Context) OMPIfClause();
     break;
-  case OMPC_final:
+  case llvm::omp::OMPC_final:
     C = new (Context) OMPFinalClause();
     break;
-  case OMPC_num_threads:
+  case llvm::omp::OMPC_num_threads:
     C = new (Context) OMPNumThreadsClause();
     break;
-  case OMPC_safelen:
+  case llvm::omp::OMPC_safelen:
     C = new (Context) OMPSafelenClause();
     break;
-  case OMPC_simdlen:
+  case llvm::omp::OMPC_simdlen:
     C = new (Context) OMPSimdlenClause();
     break;
-  case OMPC_allocator:
+  case llvm::omp::OMPC_allocator:
     C = new (Context) OMPAllocatorClause();
     break;
-  case OMPC_collapse:
+  case llvm::omp::OMPC_collapse:
     C = new (Context) OMPCollapseClause();
     break;
-  case OMPC_default:
+  case llvm::omp::OMPC_default:
     C = new (Context) OMPDefaultClause();
     break;
-  case OMPC_proc_bind:
+  case llvm::omp::OMPC_proc_bind:
     C = new (Context) OMPProcBindClause();
     break;
-  case OMPC_schedule:
+  case llvm::omp::OMPC_schedule:
     C = new (Context) OMPScheduleClause();
     break;
-  case OMPC_ordered:
+  case llvm::omp::OMPC_ordered:
     C = OMPOrderedClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_nowait:
+  case llvm::omp::OMPC_nowait:
     C = new (Context) OMPNowaitClause();
     break;
-  case OMPC_untied:
+  case llvm::omp::OMPC_untied:
     C = new (Context) OMPUntiedClause();
     break;
-  case OMPC_mergeable:
+  case llvm::omp::OMPC_mergeable:
     C = new (Context) OMPMergeableClause();
     break;
-  case OMPC_read:
+  case llvm::omp::OMPC_read:
     C = new (Context) OMPReadClause();
     break;
-  case OMPC_write:
+  case llvm::omp::OMPC_write:
     C = new (Context) OMPWriteClause();
     break;
-  case OMPC_update:
+  case llvm::omp::OMPC_update:
     C = OMPUpdateClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_capture:
+  case llvm::omp::OMPC_capture:
     C = new (Context) OMPCaptureClause();
     break;
-  case OMPC_seq_cst:
+  case llvm::omp::OMPC_seq_cst:
     C = new (Context) OMPSeqCstClause();
     break;
-  case OMPC_acq_rel:
+  case llvm::omp::OMPC_acq_rel:
     C = new (Context) OMPAcqRelClause();
     break;
-  case OMPC_acquire:
+  case llvm::omp::OMPC_acquire:
     C = new (Context) OMPAcquireClause();
     break;
-  case OMPC_release:
+  case llvm::omp::OMPC_release:
     C = new (Context) OMPReleaseClause();
     break;
-  case OMPC_relaxed:
+  case llvm::omp::OMPC_relaxed:
     C = new (Context) OMPRelaxedClause();
     break;
-  case OMPC_threads:
+  case llvm::omp::OMPC_threads:
     C = new (Context) OMPThreadsClause();
     break;
-  case OMPC_simd:
+  case llvm::omp::OMPC_simd:
     C = new (Context) OMPSIMDClause();
     break;
-  case OMPC_nogroup:
+  case llvm::omp::OMPC_nogroup:
     C = new (Context) OMPNogroupClause();
     break;
-  case OMPC_unified_address:
+  case llvm::omp::OMPC_unified_address:
     C = new (Context) OMPUnifiedAddressClause();
     break;
-  case OMPC_unified_shared_memory:
+  case llvm::omp::OMPC_unified_shared_memory:
     C = new (Context) OMPUnifiedSharedMemoryClause();
     break;
-  case OMPC_reverse_offload:
+  case llvm::omp::OMPC_reverse_offload:
     C = new (Context) OMPReverseOffloadClause();
     break;
-  case OMPC_dynamic_allocators:
+  case llvm::omp::OMPC_dynamic_allocators:
     C = new (Context) OMPDynamicAllocatorsClause();
     break;
-  case OMPC_atomic_default_mem_order:
+  case llvm::omp::OMPC_atomic_default_mem_order:
     C = new (Context) OMPAtomicDefaultMemOrderClause();
     break;
- case OMPC_private:
+ case llvm::omp::OMPC_private:
     C = OMPPrivateClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_firstprivate:
+  case llvm::omp::OMPC_firstprivate:
     C = OMPFirstprivateClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_lastprivate:
+  case llvm::omp::OMPC_lastprivate:
     C = OMPLastprivateClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_shared:
+  case llvm::omp::OMPC_shared:
     C = OMPSharedClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_reduction:
+  case llvm::omp::OMPC_reduction:
     C = OMPReductionClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_task_reduction:
+  case llvm::omp::OMPC_task_reduction:
     C = OMPTaskReductionClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_in_reduction:
+  case llvm::omp::OMPC_in_reduction:
     C = OMPInReductionClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_linear:
+  case llvm::omp::OMPC_linear:
     C = OMPLinearClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_aligned:
+  case llvm::omp::OMPC_aligned:
     C = OMPAlignedClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_copyin:
+  case llvm::omp::OMPC_copyin:
     C = OMPCopyinClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_copyprivate:
+  case llvm::omp::OMPC_copyprivate:
     C = OMPCopyprivateClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_flush:
+  case llvm::omp::OMPC_flush:
     C = OMPFlushClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_depobj:
+  case llvm::omp::OMPC_depobj:
     C = OMPDepobjClause::CreateEmpty(Context);
     break;
-  case OMPC_depend: {
+  case llvm::omp::OMPC_depend: {
     unsigned NumVars = Record.readInt();
     unsigned NumLoops = Record.readInt();
     C = OMPDependClause::CreateEmpty(Context, NumVars, NumLoops);
     break;
   }
-  case OMPC_device:
+  case llvm::omp::OMPC_device:
     C = new (Context) OMPDeviceClause();
     break;
-  case OMPC_map: {
+  case llvm::omp::OMPC_map: {
     OMPMappableExprListSizeTy Sizes;
     Sizes.NumVars = Record.readInt();
     Sizes.NumUniqueDeclarations = Record.readInt();
@@ -11782,31 +11782,31 @@ OMPClause *OMPClauseReader::readClause() {
     C = OMPMapClause::CreateEmpty(Context, Sizes);
     break;
   }
-  case OMPC_num_teams:
+  case llvm::omp::OMPC_num_teams:
     C = new (Context) OMPNumTeamsClause();
     break;
-  case OMPC_thread_limit:
+  case llvm::omp::OMPC_thread_limit:
     C = new (Context) OMPThreadLimitClause();
     break;
-  case OMPC_priority:
+  case llvm::omp::OMPC_priority:
     C = new (Context) OMPPriorityClause();
     break;
-  case OMPC_grainsize:
+  case llvm::omp::OMPC_grainsize:
     C = new (Context) OMPGrainsizeClause();
     break;
-  case OMPC_num_tasks:
+  case llvm::omp::OMPC_num_tasks:
     C = new (Context) OMPNumTasksClause();
     break;
-  case OMPC_hint:
+  case llvm::omp::OMPC_hint:
     C = new (Context) OMPHintClause();
     break;
-  case OMPC_dist_schedule:
+  case llvm::omp::OMPC_dist_schedule:
     C = new (Context) OMPDistScheduleClause();
     break;
-  case OMPC_defaultmap:
+  case llvm::omp::OMPC_defaultmap:
     C = new (Context) OMPDefaultmapClause();
     break;
-  case OMPC_to: {
+  case llvm::omp::OMPC_to: {
     OMPMappableExprListSizeTy Sizes;
     Sizes.NumVars = Record.readInt();
     Sizes.NumUniqueDeclarations = Record.readInt();
@@ -11815,7 +11815,7 @@ OMPClause *OMPClauseReader::readClause() {
     C = OMPToClause::CreateEmpty(Context, Sizes);
     break;
   }
-  case OMPC_from: {
+  case llvm::omp::OMPC_from: {
     OMPMappableExprListSizeTy Sizes;
     Sizes.NumVars = Record.readInt();
     Sizes.NumUniqueDeclarations = Record.readInt();
@@ -11824,7 +11824,7 @@ OMPClause *OMPClauseReader::readClause() {
     C = OMPFromClause::CreateEmpty(Context, Sizes);
     break;
   }
-  case OMPC_use_device_ptr: {
+  case llvm::omp::OMPC_use_device_ptr: {
     OMPMappableExprListSizeTy Sizes;
     Sizes.NumVars = Record.readInt();
     Sizes.NumUniqueDeclarations = Record.readInt();
@@ -11833,7 +11833,7 @@ OMPClause *OMPClauseReader::readClause() {
     C = OMPUseDevicePtrClause::CreateEmpty(Context, Sizes);
     break;
   }
-  case OMPC_is_device_ptr: {
+  case llvm::omp::OMPC_is_device_ptr: {
     OMPMappableExprListSizeTy Sizes;
     Sizes.NumVars = Record.readInt();
     Sizes.NumUniqueDeclarations = Record.readInt();
@@ -11842,27 +11842,31 @@ OMPClause *OMPClauseReader::readClause() {
     C = OMPIsDevicePtrClause::CreateEmpty(Context, Sizes);
     break;
   }
-  case OMPC_allocate:
+  case llvm::omp::OMPC_allocate:
     C = OMPAllocateClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_nontemporal:
+  case llvm::omp::OMPC_nontemporal:
     C = OMPNontemporalClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_inclusive:
+  case llvm::omp::OMPC_inclusive:
     C = OMPInclusiveClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_exclusive:
+  case llvm::omp::OMPC_exclusive:
     C = OMPExclusiveClause::CreateEmpty(Context, Record.readInt());
     break;
-  case OMPC_order:
+  case llvm::omp::OMPC_order:
     C = new (Context) OMPOrderClause();
     break;
-  case OMPC_destroy:
+  case llvm::omp::OMPC_destroy:
     C = new (Context) OMPDestroyClause();
     break;
-  case OMPC_detach:
+  case llvm::omp::OMPC_detach:
     C = new (Context) OMPDetachClause();
     break;
+#define OMP_CLAUSE_NO_CLASS(Enum, Str)                                         \
+  case llvm::omp::Enum:                                                        \
+    break;
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   }
   assert(C && "Unknown OMPClause type");
 

diff  --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 89ba7e623965..3b72f0f1cef2 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -6037,8 +6037,8 @@ class OMPClauseWriter : public OMPClauseVisitor<OMPClauseWriter> {
 
 public:
   OMPClauseWriter(ASTRecordWriter &Record) : Record(Record) {}
-#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S);
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *S);
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   void writeClause(OMPClause *C);
   void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C);
   void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C);
@@ -6051,7 +6051,7 @@ void ASTRecordWriter::writeOMPClause(OMPClause *C) {
 }
 
 void OMPClauseWriter::writeClause(OMPClause *C) {
-  Record.push_back(C->getClauseKind());
+  Record.push_back(unsigned(C->getClauseKind()));
   Visit(C);
   Record.AddSourceLocation(C->getBeginLoc());
   Record.AddSourceLocation(C->getEndLoc());

diff  --git a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
index b7fb0d90c980..bcf2dfdb8326 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
+++ b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
@@ -1,4 +1,5 @@
 set(LLVM_LINK_COMPONENTS
+  FrontendOpenMP
   Support
   )
 

diff  --git a/clang/lib/StaticAnalyzer/Core/CMakeLists.txt b/clang/lib/StaticAnalyzer/Core/CMakeLists.txt
index dc2a6279b737..057cdd4bb18a 100644
--- a/clang/lib/StaticAnalyzer/Core/CMakeLists.txt
+++ b/clang/lib/StaticAnalyzer/Core/CMakeLists.txt
@@ -1,4 +1,7 @@
-set(LLVM_LINK_COMPONENTS support)
+set(LLVM_LINK_COMPONENTS
+  FrontendOpenMP
+  Support
+)
 
 add_clang_library(clangStaticAnalyzerCore
   APSIntType.cpp

diff  --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 14814f89d97d..50c088606538 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -2153,8 +2153,8 @@ class OMPClauseEnqueue : public ConstOMPClauseVisitor<OMPClauseEnqueue> {
 
 public:
   OMPClauseEnqueue(EnqueueVisitor *Visitor) : Visitor(Visitor) {}
-#define OPENMP_CLAUSE(Name, Class) void Visit##Class(const Class *C);
-#include "clang/Basic/OpenMPKinds.def"
+#define OMP_CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C);
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
   void VisitOMPClauseWithPreInit(const OMPClauseWithPreInit *C);
   void VisitOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C);
 };

diff  --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
index fbf2ff130785..428879d0695c 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -2612,7 +2612,7 @@ TEST(HasExternalFormalLinkage, Basic) {
 }
 
 TEST(HasDefaultArgument, Basic) {
-  EXPECT_TRUE(matches("void x(int val = 0) {}", 
+  EXPECT_TRUE(matches("void x(int val = 0) {}",
                       parmVarDecl(hasDefaultArgument())));
   EXPECT_TRUE(notMatches("void x(int val) {}",
                       parmVarDecl(hasDefaultArgument())));
@@ -2665,7 +2665,7 @@ TEST(HasTrailingReturn, MatchesTrailingReturn) {
   EXPECT_TRUE(matches("auto Y() -> int { return 0; }",
                       functionDecl(hasTrailingReturn())));
   EXPECT_TRUE(matches("auto X() -> int;", functionDecl(hasTrailingReturn())));
-  EXPECT_TRUE(notMatches("int X() { return 0; }", 
+  EXPECT_TRUE(notMatches("int X() { return 0; }",
                       functionDecl(hasTrailingReturn())));
   EXPECT_TRUE(notMatches("int X();", functionDecl(hasTrailingReturn())));
   EXPECT_TRUE(notMatchesC("void X();", functionDecl(hasTrailingReturn())));
@@ -2891,8 +2891,8 @@ void x(int x) {
 }
 
 TEST(OMPExecutableDirective, isAllowedToContainClauseKind) {
-  auto Matcher =
-      ompExecutableDirective(isAllowedToContainClauseKind(OMPC_default));
+  auto Matcher = ompExecutableDirective(
+      isAllowedToContainClauseKind(llvm::omp::OMPC_default));
 
   const std::string Source0 = R"(
 void x() {

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h b/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
index 7cda3197473f..d32fa8dc98ef 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
@@ -34,11 +34,18 @@ enum class Directive {
 #include "llvm/Frontend/OpenMP/OMPKinds.def"
 };
 
+/// IDs for all OpenMP clauses.
+enum class Clause {
+#define OMP_CLAUSE(Enum, ...) Enum,
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
+};
+
 /// Make the enum values available in the llvm::omp namespace. This allows us to
 /// write something like OMPD_parallel if we have a `using namespace omp`. At
 /// the same time we do not loose the strong type guarantees of the enum class,
 /// that is we cannot pass an unsigned as Directive without an explicit cast.
 #define OMP_DIRECTIVE(Enum, ...) constexpr auto Enum = omp::Directive::Enum;
+#define OMP_CLAUSE(Enum, ...) constexpr auto Enum = omp::Clause::Enum;
 #include "llvm/Frontend/OpenMP/OMPKinds.def"
 
 /// IDs for all omp runtime library (RTL) functions.
@@ -87,6 +94,12 @@ Directive getOpenMPDirectiveKind(StringRef Str);
 /// Return a textual representation of the directive \p D.
 StringRef getOpenMPDirectiveName(Directive D);
 
+/// Parse \p Str and return the clause it matches or OMPC_unknown if none.
+Clause getOpenMPClauseKind(StringRef Str);
+
+/// Return a textual representation of the clause \p C.
+StringRef getOpenMPClauseName(Clause C);
+
 /// Forward declarations for LLVM-IR types (simple, function and structure) are
 /// generated below. Their names are defined and used in OpenMP/OMPKinds.def.
 /// Here we provide the forward declarations, the initializeTypes function will

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
index c80ecc7cbf77..09468358415f 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -105,6 +105,117 @@ __OMP_DIRECTIVE(unknown)
 
 ///}
 
+/// OpenMP Clauses
+///
+///{
+
+#ifndef OMP_CLAUSE
+#define OMP_CLAUSE(Enum, Str, Implicit)
+#endif
+#ifndef OMP_CLAUSE_CLASS
+#define OMP_CLAUSE_CLASS(Enum, Str, Class)
+#endif
+#ifndef OMP_CLAUSE_NO_CLASS
+#define OMP_CLAUSE_NO_CLASS(Enum, Str)
+#endif
+
+#define __OMP_CLAUSE(Name, Class)                                              \
+  OMP_CLAUSE(OMPC_##Name, #Name, /* Implicit */ false)                         \
+  OMP_CLAUSE_CLASS(OMPC_##Name, #Name, Class)
+#define __OMP_CLAUSE_NO_CLASS(Name)                                            \
+  OMP_CLAUSE(OMPC_##Name, #Name, /* Implicit */ false)                         \
+  OMP_CLAUSE_NO_CLASS(OMPC_##Name, #Name)
+#define __OMP_IMPLICIT_CLAUSE_CLASS(Name, Str, Class)                          \
+  OMP_CLAUSE(OMPC_##Name, Str, /* Implicit */ true)                            \
+  OMP_CLAUSE_CLASS(OMPC_##Name, Str, Class)
+#define __OMP_IMPLICIT_CLAUSE_NO_CLASS(Name, Str)                              \
+  OMP_CLAUSE(OMPC_##Name, Str, /* Implicit */ true)                            \
+  OMP_CLAUSE_NO_CLASS(OMPC_##Name, Str)
+
+__OMP_CLAUSE(allocator, OMPAllocatorClause)
+__OMP_CLAUSE(if, OMPIfClause)
+__OMP_CLAUSE(final, OMPFinalClause)
+__OMP_CLAUSE(num_threads, OMPNumThreadsClause)
+__OMP_CLAUSE(safelen, OMPSafelenClause)
+__OMP_CLAUSE(simdlen, OMPSimdlenClause)
+__OMP_CLAUSE(collapse, OMPCollapseClause)
+__OMP_CLAUSE(default, OMPDefaultClause)
+__OMP_CLAUSE(private, OMPPrivateClause)
+__OMP_CLAUSE(firstprivate, OMPFirstprivateClause)
+__OMP_CLAUSE(lastprivate, OMPLastprivateClause)
+__OMP_CLAUSE(shared, OMPSharedClause)
+__OMP_CLAUSE(reduction, OMPReductionClause)
+__OMP_CLAUSE(linear, OMPLinearClause)
+__OMP_CLAUSE(aligned, OMPAlignedClause)
+__OMP_CLAUSE(copyin, OMPCopyinClause)
+__OMP_CLAUSE(copyprivate, OMPCopyprivateClause)
+__OMP_CLAUSE(proc_bind, OMPProcBindClause)
+__OMP_CLAUSE(schedule, OMPScheduleClause)
+__OMP_CLAUSE(ordered, OMPOrderedClause)
+__OMP_CLAUSE(nowait, OMPNowaitClause)
+__OMP_CLAUSE(untied, OMPUntiedClause)
+__OMP_CLAUSE(mergeable, OMPMergeableClause)
+__OMP_CLAUSE(read, OMPReadClause)
+__OMP_CLAUSE(write, OMPWriteClause)
+__OMP_CLAUSE(update, OMPUpdateClause)
+__OMP_CLAUSE(capture, OMPCaptureClause)
+__OMP_CLAUSE(seq_cst, OMPSeqCstClause)
+__OMP_CLAUSE(acq_rel, OMPAcqRelClause)
+__OMP_CLAUSE(acquire, OMPAcquireClause)
+__OMP_CLAUSE(release, OMPReleaseClause)
+__OMP_CLAUSE(relaxed, OMPRelaxedClause)
+__OMP_CLAUSE(depend, OMPDependClause)
+__OMP_CLAUSE(device, OMPDeviceClause)
+__OMP_CLAUSE(threads, OMPThreadsClause)
+__OMP_CLAUSE(simd, OMPSIMDClause)
+__OMP_CLAUSE(map, OMPMapClause)
+__OMP_CLAUSE(num_teams, OMPNumTeamsClause)
+__OMP_CLAUSE(thread_limit, OMPThreadLimitClause)
+__OMP_CLAUSE(priority, OMPPriorityClause)
+__OMP_CLAUSE(grainsize, OMPGrainsizeClause)
+__OMP_CLAUSE(nogroup, OMPNogroupClause)
+__OMP_CLAUSE(num_tasks, OMPNumTasksClause)
+__OMP_CLAUSE(hint, OMPHintClause)
+__OMP_CLAUSE(dist_schedule, OMPDistScheduleClause)
+__OMP_CLAUSE(defaultmap, OMPDefaultmapClause)
+__OMP_CLAUSE(to, OMPToClause)
+__OMP_CLAUSE(from, OMPFromClause)
+__OMP_CLAUSE(use_device_ptr, OMPUseDevicePtrClause)
+__OMP_CLAUSE(is_device_ptr, OMPIsDevicePtrClause)
+__OMP_CLAUSE(task_reduction, OMPTaskReductionClause)
+__OMP_CLAUSE(in_reduction, OMPInReductionClause)
+__OMP_CLAUSE(unified_address, OMPUnifiedAddressClause)
+__OMP_CLAUSE(unified_shared_memory, OMPUnifiedSharedMemoryClause)
+__OMP_CLAUSE(reverse_offload, OMPReverseOffloadClause)
+__OMP_CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause)
+__OMP_CLAUSE(atomic_default_mem_order, OMPAtomicDefaultMemOrderClause)
+__OMP_CLAUSE(allocate, OMPAllocateClause)
+__OMP_CLAUSE(nontemporal, OMPNontemporalClause)
+__OMP_CLAUSE(order, OMPOrderClause)
+__OMP_CLAUSE(destroy, OMPDestroyClause)
+__OMP_CLAUSE(detach, OMPDetachClause)
+__OMP_CLAUSE(inclusive, OMPInclusiveClause)
+__OMP_CLAUSE(exclusive, OMPExclusiveClause)
+
+__OMP_CLAUSE_NO_CLASS(uniform)
+__OMP_CLAUSE_NO_CLASS(device_type)
+__OMP_CLAUSE_NO_CLASS(match)
+
+__OMP_IMPLICIT_CLAUSE_CLASS(depobj, "depobj", OMPDepobjClause)
+__OMP_IMPLICIT_CLAUSE_CLASS(flush, "flush", OMPFlushClause)
+
+__OMP_IMPLICIT_CLAUSE_NO_CLASS(threadprivate, "threadprivate or thread local")
+__OMP_IMPLICIT_CLAUSE_NO_CLASS(unknown, "unknown")
+
+#undef __OMP_IMPLICIT_CLAUSE_NO_CLASS
+#undef __OMP_IMPLICIT_CLAUSE_CLASS
+#undef __OMP_CLAUSE
+#undef OMP_CLAUSE_NO_CLASS
+#undef OMP_CLAUSE_CLASS
+#undef OMP_CLAUSE
+
+///}
+
 /// Types used in runtime structs or runtime functions
 ///
 ///{
@@ -232,8 +343,10 @@ __OMP_RTL(omp_set_max_active_levels, false, Void, Int32)
 __OMP_RTL(__kmpc_master, false, Int32, IdentPtr, Int32)
 __OMP_RTL(__kmpc_end_master, false, Void, IdentPtr, Int32)
 __OMP_RTL(__kmpc_critical, false, Void, IdentPtr, Int32, KmpCriticalNamePtrTy)
-__OMP_RTL(__kmpc_critical_with_hint, false, Void, IdentPtr, Int32, KmpCriticalNamePtrTy, Int32)
-__OMP_RTL(__kmpc_end_critical, false, Void, IdentPtr, Int32, KmpCriticalNamePtrTy)
+__OMP_RTL(__kmpc_critical_with_hint, false, Void, IdentPtr, Int32,
+          KmpCriticalNamePtrTy, Int32)
+__OMP_RTL(__kmpc_end_critical, false, Void, IdentPtr, Int32,
+          KmpCriticalNamePtrTy)
 
 __OMP_RTL(__last, false, Void, )
 

diff  --git a/llvm/lib/Frontend/OpenMP/OMPConstants.cpp b/llvm/lib/Frontend/OpenMP/OMPConstants.cpp
index 6ee44958d1c7..edd857d7b250 100644
--- a/llvm/lib/Frontend/OpenMP/OMPConstants.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPConstants.cpp
@@ -36,6 +36,24 @@ StringRef llvm::omp::getOpenMPDirectiveName(Directive Kind) {
   llvm_unreachable("Invalid OpenMP directive kind");
 }
 
+Clause llvm::omp::getOpenMPClauseKind(StringRef Str) {
+  return llvm::StringSwitch<Clause>(Str)
+#define OMP_CLAUSE(Enum, Str, Implicit)                                        \
+  .Case(Str, Implicit ? OMPC_unknown : Enum)
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
+      .Default(OMPC_unknown);
+}
+
+StringRef llvm::omp::getOpenMPClauseName(Clause C) {
+  switch (C) {
+#define OMP_CLAUSE(Enum, Str, ...)                                             \
+  case Enum:                                                                   \
+    return Str;
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
+  }
+  llvm_unreachable("Invalid OpenMP clause kind");
+}
+
 /// Declarations for LLVM-IR types (simple, array, function and structure) are
 /// generated below. Their names are defined and used in OpenMPKinds.def. Here
 /// we provide the declarations, the initializeTypes function will provide the


        


More information about the llvm-branch-commits mailing list