jdoerfert updated this revision to Diff 228788.
jdoerfert marked 2 inline comments as done.
jdoerfert added a comment.

Create llvm/libFrontend, move code there, make shared library builds work.

llvm/IR/ is an unfortunate location as we cannot use llvm utility functions
without introducing dependences between the libraries that are unwanted.

The new libFrontend should not only house the OpenMP-IR-Builder but other code
parts shared between different frontends later on.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69853/new/

https://reviews.llvm.org/D69853

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/StmtOpenMP.h
  clang/include/clang/Basic/OpenMPKinds.def
  clang/include/clang/Basic/OpenMPKinds.h
  clang/lib/AST/CMakeLists.txt
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtOpenMP.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Parse/CMakeLists.txt
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/CMakeLists.txt
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  llvm/include/llvm/Frontend/OpenMPConstants.h
  llvm/include/llvm/Frontend/OpenMPKinds.def
  llvm/lib/CMakeLists.txt
  llvm/lib/Frontend/CMakeLists.txt
  llvm/lib/Frontend/LLVMBuild.txt
  llvm/lib/Frontend/OpenMPConstants.cpp
  llvm/lib/LLVMBuild.txt

Index: llvm/lib/Frontend/OpenMPConstants.cpp
===================================================================
--- /dev/null
+++ llvm/lib/Frontend/OpenMPConstants.cpp
@@ -0,0 +1,34 @@
+//===- OpenMPConstants.cpp - Helpers related to OpenMP code generation ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Frontend/OpenMPConstants.h"
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
+
+using namespace llvm;
+using namespace omp;
+
+Directive llvm::omp::getOpenMPDirectiveKind(StringRef Str) {
+  return llvm::StringSwitch<Directive>(Str)
+#define OMP_DIRECTIVE(Enum, Str) .Case(Str, Enum)
+#include "llvm/Frontend/OpenMPKinds.def"
+      .Default(OMPD_unknown);
+}
+
+StringRef llvm::omp::getOpenMPDirectiveName(Directive Kind) {
+  switch (Kind) {
+#define OMP_DIRECTIVE(Enum, Str)                                               \
+  case Enum:                                                                   \
+    return Str;
+#include "llvm/Frontend/OpenMPKinds.def"
+  }
+  llvm_unreachable("Invalid OpenMP directive kind");
+}
Index: llvm/lib/LLVMBuild.txt
===================================================================
--- llvm/lib/LLVMBuild.txt
+++ llvm/lib/LLVMBuild.txt
@@ -24,6 +24,7 @@
  DebugInfo
  Demangle
  ExecutionEngine
+ Frontend
  FuzzMutate
  LineEditor
  Linker
Index: llvm/lib/Frontend/LLVMBuild.txt
===================================================================
--- llvm/lib/Frontend/LLVMBuild.txt
+++ llvm/lib/Frontend/LLVMBuild.txt
@@ -1,4 +1,4 @@
-;===- ./lib/LLVMBuild.txt --------------------------------------*- Conf -*--===;
+;===- ./lib/Frontend/LLVMBuild.txt -----------------------------*- Conf -*--===;
 ;
 ; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 ; See https://llvm.org/LICENSE.txt for license information.
@@ -14,42 +14,8 @@
 ;
 ;===------------------------------------------------------------------------===;
 
-[common]
-subdirectories =
- Analysis
- AsmParser
- Bitcode
- Bitstream
- CodeGen
- DebugInfo
- Demangle
- ExecutionEngine
- FuzzMutate
- LineEditor
- Linker
- IR
- IRReader
- LTO
- MC
- MCA
- Object
- BinaryFormat
- ObjectYAML
- Option
- Remarks
- Passes
- ProfileData
- Support
- TableGen
- TextAPI
- Target
- Testing
- ToolDrivers
- Transforms
- WindowsManifest
- XRay
-
 [component_0]
-type = Group
-name = Libraries
-parent = $ROOT
+type = Library
+name = Frontend
+parent = Libraries
+required_libraries = Core Support TransformUtils
Index: llvm/lib/Frontend/CMakeLists.txt
===================================================================
--- /dev/null
+++ llvm/lib/Frontend/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_llvm_library(LLVMFrontend
+  OpenMPConstants.cpp
+
+  ADDITIONAL_HEADER_DIRS
+  ${LLVM_MAIN_INCLUDE_DIR}/llvm/Frontend
+
+  DEPENDS
+  intrinsics_gen
+  )
Index: llvm/lib/CMakeLists.txt
===================================================================
--- llvm/lib/CMakeLists.txt
+++ llvm/lib/CMakeLists.txt
@@ -8,6 +8,7 @@
 add_subdirectory(BinaryFormat)
 add_subdirectory(Bitcode)
 add_subdirectory(Bitstream)
+add_subdirectory(Frontend)
 add_subdirectory(Transforms)
 add_subdirectory(Linker)
 add_subdirectory(Analysis)
Index: llvm/include/llvm/Frontend/OpenMPKinds.def
===================================================================
--- /dev/null
+++ llvm/include/llvm/Frontend/OpenMPKinds.def
@@ -0,0 +1,101 @@
+//===--- OpenMPKinds.def - OpenMP directives, clauses, rt-calls -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+/// \file
+///
+/// This file defines the list of supported OpenMP directives, clauses, runtime
+/// calls, and other things that need to be listed in enums.
+///
+//===----------------------------------------------------------------------===//
+
+/// OpenMP Directives and combined directives
+///
+///{
+
+#ifndef OMP_DIRECTIVE
+#define OMP_DIRECTIVE(Enum, Str)
+#endif
+
+#define __OMP_DIRECTIVE_EXT(Name, Str) OMP_DIRECTIVE(OMPD_##Name, Str)
+#define __OMP_DIRECTIVE(Name) __OMP_DIRECTIVE_EXT(Name, #Name)
+
+__OMP_DIRECTIVE(threadprivate)
+__OMP_DIRECTIVE(parallel)
+__OMP_DIRECTIVE(task)
+__OMP_DIRECTIVE(simd)
+__OMP_DIRECTIVE(for)
+__OMP_DIRECTIVE(sections)
+__OMP_DIRECTIVE(section)
+__OMP_DIRECTIVE(single)
+__OMP_DIRECTIVE(master)
+__OMP_DIRECTIVE(critical)
+__OMP_DIRECTIVE(taskyield)
+__OMP_DIRECTIVE(barrier)
+__OMP_DIRECTIVE(taskwait)
+__OMP_DIRECTIVE(taskgroup)
+__OMP_DIRECTIVE(flush)
+__OMP_DIRECTIVE(ordered)
+__OMP_DIRECTIVE(atomic)
+__OMP_DIRECTIVE(target)
+__OMP_DIRECTIVE(teams)
+__OMP_DIRECTIVE(cancel)
+__OMP_DIRECTIVE(requires)
+__OMP_DIRECTIVE_EXT(target_data, "target data")
+__OMP_DIRECTIVE_EXT(target_enter_data, "target enter data")
+__OMP_DIRECTIVE_EXT(target_exit_data, "target exit data")
+__OMP_DIRECTIVE_EXT(target_parallel, "target parallel")
+__OMP_DIRECTIVE_EXT(target_parallel_for, "target parallel for")
+__OMP_DIRECTIVE_EXT(target_update, "target update")
+__OMP_DIRECTIVE_EXT(parallel_for, "parallel for")
+__OMP_DIRECTIVE_EXT(parallel_for_simd, "parallel for simd")
+__OMP_DIRECTIVE_EXT(parallel_sections, "parallel sections")
+__OMP_DIRECTIVE_EXT(for_simd, "for simd")
+__OMP_DIRECTIVE_EXT(cancellation_point, "cancellation point")
+__OMP_DIRECTIVE_EXT(declare_reduction, "declare reduction")
+__OMP_DIRECTIVE_EXT(declare_mapper, "declare mapper")
+__OMP_DIRECTIVE_EXT(declare_simd, "declare simd")
+__OMP_DIRECTIVE(taskloop)
+__OMP_DIRECTIVE_EXT(taskloop_simd, "taskloop simd")
+__OMP_DIRECTIVE(distribute)
+__OMP_DIRECTIVE_EXT(declare_target, "declare target")
+__OMP_DIRECTIVE_EXT(end_declare_target, "end declare target")
+__OMP_DIRECTIVE_EXT(distribute_parallel_for, "distribute parallel for")
+__OMP_DIRECTIVE_EXT(distribute_parallel_for_simd,
+                    "distribute parallel for simd")
+__OMP_DIRECTIVE_EXT(distribute_simd, "distribute simd")
+__OMP_DIRECTIVE_EXT(target_parallel_for_simd, "target parallel for simd")
+__OMP_DIRECTIVE_EXT(target_simd, "target simd")
+__OMP_DIRECTIVE_EXT(teams_distribute, "teams distribute")
+__OMP_DIRECTIVE_EXT(teams_distribute_simd, "teams distribute simd")
+__OMP_DIRECTIVE_EXT(teams_distribute_parallel_for_simd,
+                    "teams distribute parallel for simd")
+__OMP_DIRECTIVE_EXT(teams_distribute_parallel_for,
+                    "teams distribute parallel for")
+__OMP_DIRECTIVE_EXT(target_teams, "target teams")
+__OMP_DIRECTIVE_EXT(target_teams_distribute, "target teams distribute")
+__OMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for,
+                    "target teams distribute parallel for")
+__OMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for_simd,
+                    "target teams distribute parallel for simd")
+__OMP_DIRECTIVE_EXT(target_teams_distribute_simd,
+                    "target teams distribute simd")
+__OMP_DIRECTIVE(allocate)
+__OMP_DIRECTIVE_EXT(declare_variant, "declare variant")
+__OMP_DIRECTIVE_EXT(master_taskloop, "master taskloop")
+__OMP_DIRECTIVE_EXT(parallel_master_taskloop, "parallel master taskloop")
+__OMP_DIRECTIVE_EXT(master_taskloop_simd, "master taskloop simd")
+__OMP_DIRECTIVE_EXT(parallel_master_taskloop_simd,
+                    "parallel master taskloop simd")
+
+// Has to be the last because Clang implicitly expects it to be.
+__OMP_DIRECTIVE(unknown)
+
+#undef __OMP_DIRECTIVE_EXT
+#undef __OMP_DIRECTIVE
+#undef OMP_DIRECTIVE
+
+///}
Index: llvm/include/llvm/Frontend/OpenMPConstants.h
===================================================================
--- /dev/null
+++ llvm/include/llvm/Frontend/OpenMPConstants.h
@@ -0,0 +1,46 @@
+//===- OpenMPConstants.h - OpenMP related constants and helpers --- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+/// \file
+///
+/// This file defines constans and helpers used when dealing with OpenMP.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_OPENMP_CONSTANTS_H
+#define LLVM_OPENMP_CONSTANTS_H
+
+#include "llvm/ADT/StringRef.h"
+
+namespace llvm {
+
+namespace omp {
+
+/// IDs for all OpenMP directives.
+enum class Directive {
+#define OMP_DIRECTIVE(Enum, ...) Enum,
+#include "llvm/Frontend/OpenMPKinds.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;
+#include "llvm/Frontend/OpenMPKinds.def"
+
+/// Parse \p Str and return the directive it matches or OMPD_unknown if none.
+Directive getOpenMPDirectiveKind(StringRef Str);
+
+/// Return a textual representation of the directive \p D.
+StringRef getOpenMPDirectiveName(Directive D);
+
+} // end namespace omp
+
+} // end namespace llvm
+
+#endif // LLVM_OPENMP_CONSTANTS_H
Index: clang/lib/Serialization/ASTWriterStmt.cpp
===================================================================
--- clang/lib/Serialization/ASTWriterStmt.cpp
+++ clang/lib/Serialization/ASTWriterStmt.cpp
@@ -2227,7 +2227,7 @@
     OMPCancellationPointDirective *D) {
   VisitStmt(D);
   VisitOMPExecutableDirective(D);
-  Record.push_back(D->getCancelRegion());
+  Record.push_back(uint64_t(D->getCancelRegion()));
   Code = serialization::STMT_OMP_CANCELLATION_POINT_DIRECTIVE;
 }
 
@@ -2235,7 +2235,7 @@
   VisitStmt(D);
   Record.push_back(D->getNumClauses());
   VisitOMPExecutableDirective(D);
-  Record.push_back(D->getCancelRegion());
+  Record.push_back(uint64_t(D->getCancelRegion()));
   Code = serialization::STMT_OMP_CANCEL_DIRECTIVE;
 }
 
Index: clang/lib/Serialization/ASTWriter.cpp
===================================================================
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6622,7 +6622,7 @@
 }
 
 void OMPClauseWriter::VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C) {
-  Record.push_back(C->getCaptureRegion());
+  Record.push_back(uint64_t(C->getCaptureRegion()));
   Record.AddStmt(C->getPreInitStmt());
 }
 
@@ -6633,7 +6633,7 @@
 
 void OMPClauseWriter::VisitOMPIfClause(OMPIfClause *C) {
   VisitOMPClauseWithPreInit(C);
-  Record.push_back(C->getNameModifier());
+  Record.push_back(uint64_t(C->getNameModifier()));
   Record.AddSourceLocation(C->getNameModifierLoc());
   Record.AddSourceLocation(C->getColonLoc());
   Record.AddStmt(C->getCondition());
Index: clang/lib/Sema/TreeTransform.h
===================================================================
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -37,6 +37,8 @@
 #include "llvm/Support/ErrorHandling.h"
 #include <algorithm>
 
+using namespace llvm::omp;
+
 namespace clang {
 using namespace sema;
 
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3167,7 +3167,8 @@
   } else {
     // Instantiate the mapper variable.
     DeclarationNameInfo DirName;
-    SemaRef.StartOpenMPDSABlock(OMPD_declare_mapper, DirName, /*S=*/nullptr,
+    SemaRef.StartOpenMPDSABlock(llvm::omp::OMPD_declare_mapper, DirName,
+                                /*S=*/nullptr,
                                 (*D->clauselist_begin())->getBeginLoc());
     SemaRef.ActOnOpenMPDeclareMapperDirectiveVarDecl(
         NewDMD, /*S=*/nullptr, SubstMapperTy, D->getLocation(), VN);
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -28,8 +28,11 @@
 #include "clang/Sema/Scope.h"
 #include "clang/Sema/ScopeInfo.h"
 #include "clang/Sema/SemaInternal.h"
+#include "llvm/ADT/IndexedMap.h"
 #include "llvm/ADT/PointerEmbeddedInt.h"
+#include "llvm/Frontend/OpenMPConstants.h"
 using namespace clang;
+using namespace llvm::omp;
 
 //===----------------------------------------------------------------------===//
 // Stack of data-sharing attributes for variables
@@ -4002,13 +4005,17 @@
   return false;
 }
 
+struct Kind2Unsigned {
+  using argument_type = OpenMPDirectiveKind;
+  unsigned operator()(argument_type DK) { return unsigned(DK); }
+};
 static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind,
                            ArrayRef<OMPClause *> Clauses,
                            ArrayRef<OpenMPDirectiveKind> AllowedNameModifiers) {
   bool ErrorFound = false;
   unsigned NamedModifiersNumber = 0;
-  SmallVector<const OMPIfClause *, OMPC_unknown + 1> FoundNameModifiers(
-      OMPD_unknown + 1);
+  llvm::IndexedMap<const OMPIfClause *, Kind2Unsigned> FoundNameModifiers;
+  FoundNameModifiers.resize(unsigned(OMPD_unknown) + 1);
   SmallVector<SourceLocation, 4> NameModifierLoc;
   for (const OMPClause *C : Clauses) {
     if (const auto *IC = dyn_cast_or_null<OMPIfClause>(C)) {
Index: clang/lib/Sema/CMakeLists.txt
===================================================================
--- clang/lib/Sema/CMakeLists.txt
+++ clang/lib/Sema/CMakeLists.txt
@@ -1,4 +1,5 @@
 set(LLVM_LINK_COMPONENTS
+  Frontend
   Support
   )
 
Index: clang/lib/Parse/ParseOpenMP.cpp
===================================================================
--- clang/lib/Parse/ParseOpenMP.cpp
+++ clang/lib/Parse/ParseOpenMP.cpp
@@ -20,6 +20,7 @@
 #include "llvm/ADT/UniqueVector.h"
 
 using namespace clang;
+using namespace llvm::omp;
 
 //===----------------------------------------------------------------------===//
 // OpenMP declarative directives.
@@ -27,7 +28,7 @@
 
 namespace {
 enum OpenMPDirectiveKindEx {
-  OMPD_cancellation = OMPD_unknown + 1,
+  OMPD_cancellation = unsigned(OMPD_unknown) + 1,
   OMPD_data,
   OMPD_declare,
   OMPD_end,
@@ -47,6 +48,20 @@
   OMPD_parallel_master,
 };
 
+// Helper to unify the enum class OpenMPDirectiveKind with its extension
+// the OpenMPDirectiveKindEx enum which allows to use them together as if they
+// are unsigned values.
+struct OpenMPDirectiveKindExWrapper {
+  OpenMPDirectiveKindExWrapper(unsigned Value) : Value(Value) {}
+  OpenMPDirectiveKindExWrapper(OpenMPDirectiveKind DK) : Value(unsigned(DK)) {}
+  bool operator==(OpenMPDirectiveKind V) const { return Value == unsigned(V); }
+  bool operator!=(OpenMPDirectiveKind V) const { return Value != unsigned(V); }
+  bool operator<(OpenMPDirectiveKind V) const { return Value < unsigned(V); }
+  operator unsigned() const { return Value; }
+  operator OpenMPDirectiveKind() const { return OpenMPDirectiveKind(Value); }
+  unsigned Value;
+};
+
 class DeclDirectiveListParserHelper final {
   SmallVector<Expr *, 4> Identifiers;
   Parser *P;
@@ -68,11 +83,11 @@
 // Map token string to extended OMP token kind that are
 // OpenMPDirectiveKind + OpenMPDirectiveKindEx.
 static unsigned getOpenMPDirectiveKindEx(StringRef S) {
-  auto DKind = getOpenMPDirectiveKind(S);
+  OpenMPDirectiveKindExWrapper DKind = getOpenMPDirectiveKind(S);
   if (DKind != OMPD_unknown)
     return DKind;
 
-  return llvm::StringSwitch<unsigned>(S)
+  return llvm::StringSwitch<OpenMPDirectiveKindExWrapper>(S)
       .Case("cancellation", OMPD_cancellation)
       .Case("data", OMPD_data)
       .Case("declare", OMPD_declare)
@@ -87,11 +102,11 @@
       .Default(OMPD_unknown);
 }
 
-static OpenMPDirectiveKind parseOpenMPDirectiveKind(Parser &P) {
+static OpenMPDirectiveKindExWrapper parseOpenMPDirectiveKind(Parser &P) {
   // Array of foldings: F[i][0] F[i][1] ===> F[i][2].
   // E.g.: OMPD_for OMPD_simd ===> OMPD_for_simd
   // TODO: add other combined directives in topological order.
-  static const unsigned F[][3] = {
+  static const OpenMPDirectiveKindExWrapper F[][3] = {
       {OMPD_cancellation, OMPD_point, OMPD_cancellation_point},
       {OMPD_declare, OMPD_reduction, OMPD_declare_reduction},
       {OMPD_declare, OMPD_mapper, OMPD_declare_mapper},
@@ -145,7 +160,7 @@
        OMPD_parallel_master_taskloop_simd}};
   enum { CancellationPoint = 0, DeclareReduction = 1, TargetData = 2 };
   Token Tok = P.getCurToken();
-  unsigned DKind =
+  OpenMPDirectiveKindExWrapper DKind =
       Tok.isAnnotation()
           ? static_cast<unsigned>(OMPD_unknown)
           : getOpenMPDirectiveKindEx(P.getPreprocessor().getSpelling(Tok));
@@ -157,7 +172,7 @@
       continue;
 
     Tok = P.getPreprocessor().LookAhead(0);
-    unsigned SDKind =
+    OpenMPDirectiveKindExWrapper SDKind =
         Tok.isAnnotation()
             ? static_cast<unsigned>(OMPD_unknown)
             : getOpenMPDirectiveKindEx(P.getPreprocessor().getSpelling(Tok));
@@ -239,8 +254,9 @@
 Parser::ParseOpenMPDeclareReductionDirective(AccessSpecifier AS) {
   // Parse '('.
   BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
-  if (T.expectAndConsume(diag::err_expected_lparen_after,
-                         getOpenMPDirectiveName(OMPD_declare_reduction))) {
+  if (T.expectAndConsume(
+          diag::err_expected_lparen_after,
+          getOpenMPDirectiveName(OMPD_declare_reduction).data())) {
     SkipUntil(tok::annot_pragma_openmp_end, StopBeforeMatch);
     return DeclGroupPtrTy();
   }
@@ -497,7 +513,7 @@
   // Parse '('
   BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
   if (T.expectAndConsume(diag::err_expected_lparen_after,
-                         getOpenMPDirectiveName(OMPD_declare_mapper))) {
+                         getOpenMPDirectiveName(OMPD_declare_mapper).data())) {
     SkipUntil(tok::annot_pragma_openmp_end, StopBeforeMatch);
     return DeclGroupPtrTy();
   }
@@ -1895,7 +1911,7 @@
   // Parse '('.
   BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
   if (T.expectAndConsume(diag::err_expected_lparen_after,
-                         getOpenMPDirectiveName(Kind)))
+                         getOpenMPDirectiveName(Kind).data()))
     return true;
   bool IsCorrect = true;
   bool NoIdentIsFound = true;
@@ -2361,15 +2377,16 @@
     assert(Kind == OMPC_if);
     KLoc.push_back(Tok.getLocation());
     TentativeParsingAction TPA(*this);
-    Arg.push_back(parseOpenMPDirectiveKind(*this));
-    if (Arg.back() != OMPD_unknown) {
+    auto DK = parseOpenMPDirectiveKind(*this);
+    Arg.push_back(DK);
+    if (DK != OMPD_unknown) {
       ConsumeToken();
       if (Tok.is(tok::colon) && getLangOpts().OpenMP > 40) {
         TPA.Commit();
         DelimLoc = ConsumeToken();
       } else {
         TPA.Revert();
-        Arg.back() = OMPD_unknown;
+        Arg.back() = unsigned(OMPD_unknown);
       }
     } else {
       TPA.Revert();
Index: clang/lib/Parse/CMakeLists.txt
===================================================================
--- clang/lib/Parse/CMakeLists.txt
+++ clang/lib/Parse/CMakeLists.txt
@@ -1,4 +1,5 @@
 set(LLVM_LINK_COMPONENTS
+  Frontend
   MC
   MCParser
   Support
Index: clang/lib/CodeGen/CodeGenFunction.h
===================================================================
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -1262,7 +1262,7 @@
       CancelExit(OpenMPDirectiveKind Kind, JumpDest ExitBlock,
                  JumpDest ContBlock)
           : Kind(Kind), ExitBlock(ExitBlock), ContBlock(ContBlock) {}
-      OpenMPDirectiveKind Kind = OMPD_unknown;
+      OpenMPDirectiveKind Kind = llvm::omp::OMPD_unknown;
       /// true if the exit block has been emitted already by the special
       /// emitExit() call, false if the default codegen is used.
       bool HasBeenEmitted = false;
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===================================================================
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -20,6 +20,7 @@
 #include "clang/AST/DeclOpenMP.h"
 using namespace clang;
 using namespace CodeGen;
+using namespace llvm::omp;
 
 namespace {
 /// Lexical scope for OpenMP executable constructs, that handles correct codegen
Index: clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
@@ -21,6 +21,7 @@
 
 using namespace clang;
 using namespace CodeGen;
+using namespace llvm::omp;
 
 namespace {
 enum OpenMPRTLFunctionNVPTX {
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -30,6 +30,7 @@
 
 using namespace clang;
 using namespace CodeGen;
+using namespace llvm::omp;
 
 namespace {
 /// Base class for handling code generation inside OpenMP regions.
Index: clang/lib/Basic/OpenMPKinds.cpp
===================================================================
--- clang/lib/Basic/OpenMPKinds.cpp
+++ clang/lib/Basic/OpenMPKinds.cpp
@@ -18,31 +18,7 @@
 #include <cassert>
 
 using namespace clang;
-
-OpenMPDirectiveKind clang::getOpenMPDirectiveKind(StringRef Str) {
-  return llvm::StringSwitch<OpenMPDirectiveKind>(Str)
-#define OPENMP_DIRECTIVE(Name) .Case(#Name, OMPD_##Name)
-#define OPENMP_DIRECTIVE_EXT(Name, Str) .Case(Str, OMPD_##Name)
-#include "clang/Basic/OpenMPKinds.def"
-      .Default(OMPD_unknown);
-}
-
-const char *clang::getOpenMPDirectiveName(OpenMPDirectiveKind Kind) {
-  assert(Kind <= OMPD_unknown);
-  switch (Kind) {
-  case OMPD_unknown:
-    return "unknown";
-#define OPENMP_DIRECTIVE(Name)                                                 \
-  case OMPD_##Name:                                                            \
-    return #Name;
-#define OPENMP_DIRECTIVE_EXT(Name, Str)                                        \
-  case OMPD_##Name:                                                            \
-    return Str;
-#include "clang/Basic/OpenMPKinds.def"
-    break;
-  }
-  llvm_unreachable("Invalid OpenMP directive kind");
-}
+using namespace llvm::omp;
 
 OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) {
   // 'flush' clause cannot be specified explicitly, because this is an implicit
@@ -405,7 +381,7 @@
 
 bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
                                         OpenMPClauseKind CKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) <= unsigned(OMPD_unknown));
   assert(CKind <= OMPC_unknown);
   switch (DKind) {
   case OMPD_parallel:
Index: clang/lib/AST/StmtOpenMP.cpp
===================================================================
--- clang/lib/AST/StmtOpenMP.cpp
+++ clang/lib/AST/StmtOpenMP.cpp
@@ -15,6 +15,7 @@
 #include "clang/AST/ASTContext.h"
 
 using namespace clang;
+using namespace llvm::omp;
 
 void OMPExecutableDirective::setClauses(ArrayRef<OMPClause *> Clauses) {
   assert(Clauses.size() == getNumClauses() &&
Index: clang/lib/AST/OpenMPClause.cpp
===================================================================
--- clang/lib/AST/OpenMPClause.cpp
+++ clang/lib/AST/OpenMPClause.cpp
@@ -1161,7 +1161,7 @@
 
 void OMPClausePrinter::VisitOMPIfClause(OMPIfClause *Node) {
   OS << "if(";
-  if (Node->getNameModifier() != OMPD_unknown)
+  if (Node->getNameModifier() != llvm::omp::OMPD_unknown)
     OS << getOpenMPDirectiveName(Node->getNameModifier()) << ": ";
   Node->getCondition()->printPretty(OS, nullptr, Policy, 0);
   OS << ")";
Index: clang/lib/AST/CMakeLists.txt
===================================================================
--- clang/lib/AST/CMakeLists.txt
+++ clang/lib/AST/CMakeLists.txt
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS
   BinaryFormat
   Core
+  Frontend
   Support
   )
 
Index: clang/include/clang/Basic/OpenMPKinds.h
===================================================================
--- clang/include/clang/Basic/OpenMPKinds.h
+++ clang/include/clang/Basic/OpenMPKinds.h
@@ -15,18 +15,12 @@
 #define LLVM_CLANG_BASIC_OPENMPKINDS_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Frontend/OpenMPConstants.h"
 
 namespace clang {
 
 /// OpenMP directives.
-enum OpenMPDirectiveKind {
-#define OPENMP_DIRECTIVE(Name) \
-  OMPD_##Name,
-#define OPENMP_DIRECTIVE_EXT(Name, Str) \
-  OMPD_##Name,
-#include "clang/Basic/OpenMPKinds.def"
-  OMPD_unknown
-};
+using OpenMPDirectiveKind = llvm::omp::Directive;
 
 /// OpenMP clauses.
 enum OpenMPClauseKind {
@@ -169,9 +163,6 @@
   OpenMPScheduleClauseModifier M2 = OMPC_SCHEDULE_MODIFIER_unknown;
 };
 
-OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str);
-const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind);
-
 OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str);
 const char *getOpenMPClauseName(OpenMPClauseKind Kind);
 
Index: clang/include/clang/Basic/OpenMPKinds.def
===================================================================
--- clang/include/clang/Basic/OpenMPKinds.def
+++ clang/include/clang/Basic/OpenMPKinds.def
@@ -11,12 +11,6 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#ifndef OPENMP_DIRECTIVE
-#  define OPENMP_DIRECTIVE(Name)
-#endif
-#ifndef OPENMP_DIRECTIVE_EXT
-#define OPENMP_DIRECTIVE_EXT(Name, Str)
-#endif
 #ifndef OPENMP_CLAUSE
 #  define OPENMP_CLAUSE(Name, Class)
 #endif
@@ -213,68 +207,6 @@
 #define OPENMP_MATCH_KIND(Name)
 #endif
 
-// OpenMP directives.
-OPENMP_DIRECTIVE(threadprivate)
-OPENMP_DIRECTIVE(parallel)
-OPENMP_DIRECTIVE(task)
-OPENMP_DIRECTIVE(simd)
-OPENMP_DIRECTIVE(for)
-OPENMP_DIRECTIVE(sections)
-OPENMP_DIRECTIVE(section)
-OPENMP_DIRECTIVE(single)
-OPENMP_DIRECTIVE(master)
-OPENMP_DIRECTIVE(critical)
-OPENMP_DIRECTIVE(taskyield)
-OPENMP_DIRECTIVE(barrier)
-OPENMP_DIRECTIVE(taskwait)
-OPENMP_DIRECTIVE(taskgroup)
-OPENMP_DIRECTIVE(flush)
-OPENMP_DIRECTIVE(ordered)
-OPENMP_DIRECTIVE(atomic)
-OPENMP_DIRECTIVE(target)
-OPENMP_DIRECTIVE(teams)
-OPENMP_DIRECTIVE(cancel)
-OPENMP_DIRECTIVE(requires)
-OPENMP_DIRECTIVE_EXT(target_data, "target data")
-OPENMP_DIRECTIVE_EXT(target_enter_data, "target enter data")
-OPENMP_DIRECTIVE_EXT(target_exit_data, "target exit data")
-OPENMP_DIRECTIVE_EXT(target_parallel, "target parallel")
-OPENMP_DIRECTIVE_EXT(target_parallel_for, "target parallel for")
-OPENMP_DIRECTIVE_EXT(target_update, "target update")
-OPENMP_DIRECTIVE_EXT(parallel_for, "parallel for")
-OPENMP_DIRECTIVE_EXT(parallel_for_simd, "parallel for simd")
-OPENMP_DIRECTIVE_EXT(parallel_sections, "parallel sections")
-OPENMP_DIRECTIVE_EXT(for_simd, "for simd")
-OPENMP_DIRECTIVE_EXT(cancellation_point, "cancellation point")
-OPENMP_DIRECTIVE_EXT(declare_reduction, "declare reduction")
-OPENMP_DIRECTIVE_EXT(declare_mapper, "declare mapper")
-OPENMP_DIRECTIVE_EXT(declare_simd, "declare simd")
-OPENMP_DIRECTIVE(taskloop)
-OPENMP_DIRECTIVE_EXT(taskloop_simd, "taskloop simd")
-OPENMP_DIRECTIVE(distribute)
-OPENMP_DIRECTIVE_EXT(declare_target, "declare target")
-OPENMP_DIRECTIVE_EXT(end_declare_target, "end declare target")
-OPENMP_DIRECTIVE_EXT(distribute_parallel_for, "distribute parallel for")
-OPENMP_DIRECTIVE_EXT(distribute_parallel_for_simd, "distribute parallel for simd")
-OPENMP_DIRECTIVE_EXT(distribute_simd, "distribute simd")
-OPENMP_DIRECTIVE_EXT(target_parallel_for_simd, "target parallel for simd")
-OPENMP_DIRECTIVE_EXT(target_simd, "target simd")
-OPENMP_DIRECTIVE_EXT(teams_distribute, "teams distribute")
-OPENMP_DIRECTIVE_EXT(teams_distribute_simd, "teams distribute simd")
-OPENMP_DIRECTIVE_EXT(teams_distribute_parallel_for_simd, "teams distribute parallel for simd")
-OPENMP_DIRECTIVE_EXT(teams_distribute_parallel_for, "teams distribute parallel for")
-OPENMP_DIRECTIVE_EXT(target_teams, "target teams")
-OPENMP_DIRECTIVE_EXT(target_teams_distribute, "target teams distribute")
-OPENMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for, "target teams distribute parallel for")
-OPENMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for_simd, "target teams distribute parallel for simd")
-OPENMP_DIRECTIVE_EXT(target_teams_distribute_simd, "target teams distribute simd")
-OPENMP_DIRECTIVE(allocate)
-OPENMP_DIRECTIVE_EXT(declare_variant, "declare variant")
-OPENMP_DIRECTIVE_EXT(master_taskloop, "master taskloop")
-OPENMP_DIRECTIVE_EXT(parallel_master_taskloop, "parallel master taskloop")
-OPENMP_DIRECTIVE_EXT(master_taskloop_simd, "master taskloop simd")
-OPENMP_DIRECTIVE_EXT(parallel_master_taskloop_simd, "parallel master taskloop simd")
-
 // OpenMP clauses.
 OPENMP_CLAUSE(allocator, OMPAllocatorClause)
 OPENMP_CLAUSE(if, OMPIfClause)
@@ -1094,8 +1026,6 @@
 #undef OPENMP_SCHEDULE_KIND
 #undef OPENMP_PROC_BIND_KIND
 #undef OPENMP_DEFAULT_KIND
-#undef OPENMP_DIRECTIVE
-#undef OPENMP_DIRECTIVE_EXT
 #undef OPENMP_CLAUSE
 #undef OPENMP_CRITICAL_CLAUSE
 #undef OPENMP_ORDERED_CLAUSE
Index: clang/include/clang/AST/StmtOpenMP.h
===================================================================
--- clang/include/clang/AST/StmtOpenMP.h
+++ clang/include/clang/AST/StmtOpenMP.h
@@ -366,8 +366,9 @@
   ///
   OMPParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                        unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
-                               StartLoc, EndLoc, NumClauses, 1),
+      : OMPExecutableDirective(this, OMPParallelDirectiveClass,
+                               llvm::omp::OMPD_parallel, StartLoc, EndLoc,
+                               NumClauses, 1),
         HasCancel(false) {}
 
   /// Build an empty directive.
@@ -375,9 +376,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPParallelDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               1),
+      : OMPExecutableDirective(this, OMPParallelDirectiveClass,
+                               llvm::omp::OMPD_parallel, SourceLocation(),
+                               SourceLocation(), NumClauses, 1),
         HasCancel(false) {}
 
   /// Set cancel state.
@@ -1209,8 +1210,8 @@
   ///
   OMPSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                    unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPSimdDirectiveClass, OMPD_simd, StartLoc,
-                         EndLoc, CollapsedNum, NumClauses) {}
+      : OMPLoopDirective(this, OMPSimdDirectiveClass, llvm::omp::OMPD_simd,
+                         StartLoc, EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -1218,7 +1219,7 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPSimdDirectiveClass, OMPD_simd,
+      : OMPLoopDirective(this, OMPSimdDirectiveClass, llvm::omp::OMPD_simd,
                          SourceLocation(), SourceLocation(), CollapsedNum,
                          NumClauses) {}
 
@@ -1278,8 +1279,8 @@
   ///
   OMPForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                   unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPForDirectiveClass, OMPD_for, StartLoc, EndLoc,
-                         CollapsedNum, NumClauses),
+      : OMPLoopDirective(this, OMPForDirectiveClass, llvm::omp::OMPD_for,
+                         StartLoc, EndLoc, CollapsedNum, NumClauses),
         HasCancel(false) {}
 
   /// Build an empty directive.
@@ -1288,8 +1289,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPForDirective(unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPForDirectiveClass, OMPD_for, SourceLocation(),
-                         SourceLocation(), CollapsedNum, NumClauses),
+      : OMPLoopDirective(this, OMPForDirectiveClass, llvm::omp::OMPD_for,
+                         SourceLocation(), SourceLocation(), CollapsedNum,
+                         NumClauses),
         HasCancel(false) {}
 
   /// Set cancel state.
@@ -1351,8 +1353,9 @@
   ///
   OMPForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                       unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPForSimdDirectiveClass, OMPD_for_simd,
-                         StartLoc, EndLoc, CollapsedNum, NumClauses) {}
+      : OMPLoopDirective(this, OMPForSimdDirectiveClass,
+                         llvm::omp::OMPD_for_simd, StartLoc, EndLoc,
+                         CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -1360,9 +1363,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPForSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPForSimdDirectiveClass, OMPD_for_simd,
-                         SourceLocation(), SourceLocation(), CollapsedNum,
-                         NumClauses) {}
+      : OMPLoopDirective(this, OMPForSimdDirectiveClass,
+                         llvm::omp::OMPD_for_simd, SourceLocation(),
+                         SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -1419,8 +1422,9 @@
   ///
   OMPSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                        unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPSectionsDirectiveClass, OMPD_sections,
-                               StartLoc, EndLoc, NumClauses, 1),
+      : OMPExecutableDirective(this, OMPSectionsDirectiveClass,
+                               llvm::omp::OMPD_sections, StartLoc, EndLoc,
+                               NumClauses, 1),
         HasCancel(false) {}
 
   /// Build an empty directive.
@@ -1428,9 +1432,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPSectionsDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPSectionsDirectiveClass, OMPD_sections,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               1),
+      : OMPExecutableDirective(this, OMPSectionsDirectiveClass,
+                               llvm::omp::OMPD_sections, SourceLocation(),
+                               SourceLocation(), NumClauses, 1),
         HasCancel(false) {}
 
   /// Set cancel state.
@@ -1485,15 +1489,16 @@
   /// \param EndLoc Ending location of the directive.
   ///
   OMPSectionDirective(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPExecutableDirective(this, OMPSectionDirectiveClass, OMPD_section,
-                               StartLoc, EndLoc, 0, 1),
+      : OMPExecutableDirective(this, OMPSectionDirectiveClass,
+                               llvm::omp::OMPD_section, StartLoc, EndLoc, 0, 1),
         HasCancel(false) {}
 
   /// Build an empty directive.
   ///
   explicit OMPSectionDirective()
-      : OMPExecutableDirective(this, OMPSectionDirectiveClass, OMPD_section,
-                               SourceLocation(), SourceLocation(), 0, 1),
+      : OMPExecutableDirective(this, OMPSectionDirectiveClass,
+                               llvm::omp::OMPD_section, SourceLocation(),
+                               SourceLocation(), 0, 1),
         HasCancel(false) {}
 
 public:
@@ -1545,17 +1550,18 @@
   ///
   OMPSingleDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                      unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPSingleDirectiveClass, OMPD_single,
-                               StartLoc, EndLoc, NumClauses, 1) {}
+      : OMPExecutableDirective(this, OMPSingleDirectiveClass,
+                               llvm::omp::OMPD_single, StartLoc, EndLoc,
+                               NumClauses, 1) {}
 
   /// Build an empty directive.
   ///
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPSingleDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPSingleDirectiveClass, OMPD_single,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               1) {}
+      : OMPExecutableDirective(this, OMPSingleDirectiveClass,
+                               llvm::omp::OMPD_single, SourceLocation(),
+                               SourceLocation(), NumClauses, 1) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -1598,14 +1604,16 @@
   /// \param EndLoc Ending location of the directive.
   ///
   OMPMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPExecutableDirective(this, OMPMasterDirectiveClass, OMPD_master,
-                               StartLoc, EndLoc, 0, 1) {}
+      : OMPExecutableDirective(this, OMPMasterDirectiveClass,
+                               llvm::omp::OMPD_master, StartLoc, EndLoc, 0, 1) {
+  }
 
   /// Build an empty directive.
   ///
   explicit OMPMasterDirective()
-      : OMPExecutableDirective(this, OMPMasterDirectiveClass, OMPD_master,
-                               SourceLocation(), SourceLocation(), 0, 1) {}
+      : OMPExecutableDirective(this, OMPMasterDirectiveClass,
+                               llvm::omp::OMPD_master, SourceLocation(),
+                               SourceLocation(), 0, 1) {}
 
 public:
   /// Creates directive.
@@ -1650,8 +1658,9 @@
   ///
   OMPCriticalDirective(const DeclarationNameInfo &Name, SourceLocation StartLoc,
                        SourceLocation EndLoc, unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPCriticalDirectiveClass, OMPD_critical,
-                               StartLoc, EndLoc, NumClauses, 1),
+      : OMPExecutableDirective(this, OMPCriticalDirectiveClass,
+                               llvm::omp::OMPD_critical, StartLoc, EndLoc,
+                               NumClauses, 1),
         DirName(Name) {}
 
   /// Build an empty directive.
@@ -1659,9 +1668,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPCriticalDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPCriticalDirectiveClass, OMPD_critical,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               1),
+      : OMPExecutableDirective(this, OMPCriticalDirectiveClass,
+                               llvm::omp::OMPD_critical, SourceLocation(),
+                               SourceLocation(), NumClauses, 1),
         DirName() {}
 
   /// Set name of the directive.
@@ -1726,8 +1735,9 @@
   ///
   OMPParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                           unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPParallelForDirectiveClass, OMPD_parallel_for,
-                         StartLoc, EndLoc, CollapsedNum, NumClauses),
+      : OMPLoopDirective(this, OMPParallelForDirectiveClass,
+                         llvm::omp::OMPD_parallel_for, StartLoc, EndLoc,
+                         CollapsedNum, NumClauses),
         HasCancel(false) {}
 
   /// Build an empty directive.
@@ -1736,9 +1746,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPParallelForDirective(unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPParallelForDirectiveClass, OMPD_parallel_for,
-                         SourceLocation(), SourceLocation(), CollapsedNum,
-                         NumClauses),
+      : OMPLoopDirective(this, OMPParallelForDirectiveClass,
+                         llvm::omp::OMPD_parallel_for, SourceLocation(),
+                         SourceLocation(), CollapsedNum, NumClauses),
         HasCancel(false) {}
 
   /// Set cancel state.
@@ -1803,8 +1813,8 @@
   OMPParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                               unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
-                         OMPD_parallel_for_simd, StartLoc, EndLoc, CollapsedNum,
-                         NumClauses) {}
+                         llvm::omp::OMPD_parallel_for_simd, StartLoc, EndLoc,
+                         CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -1814,7 +1824,7 @@
   explicit OMPParallelForSimdDirective(unsigned CollapsedNum,
                                        unsigned NumClauses)
       : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
-                         OMPD_parallel_for_simd, SourceLocation(),
+                         llvm::omp::OMPD_parallel_for_simd, SourceLocation(),
                          SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
@@ -1874,8 +1884,8 @@
   OMPParallelSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                                unsigned NumClauses)
       : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass,
-                               OMPD_parallel_sections, StartLoc, EndLoc,
-                               NumClauses, 1),
+                               llvm::omp::OMPD_parallel_sections, StartLoc,
+                               EndLoc, NumClauses, 1),
         HasCancel(false) {}
 
   /// Build an empty directive.
@@ -1884,8 +1894,9 @@
   ///
   explicit OMPParallelSectionsDirective(unsigned NumClauses)
       : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass,
-                               OMPD_parallel_sections, SourceLocation(),
-                               SourceLocation(), NumClauses, 1),
+                               llvm::omp::OMPD_parallel_sections,
+                               SourceLocation(), SourceLocation(), NumClauses,
+                               1),
         HasCancel(false) {}
 
   /// Set cancel state.
@@ -1943,8 +1954,9 @@
   ///
   OMPTaskDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                    unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPTaskDirectiveClass, OMPD_task, StartLoc,
-                               EndLoc, NumClauses, 1),
+      : OMPExecutableDirective(this, OMPTaskDirectiveClass,
+                               llvm::omp::OMPD_task, StartLoc, EndLoc,
+                               NumClauses, 1),
         HasCancel(false) {}
 
   /// Build an empty directive.
@@ -1952,9 +1964,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPTaskDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPTaskDirectiveClass, OMPD_task,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               1),
+      : OMPExecutableDirective(this, OMPTaskDirectiveClass,
+                               llvm::omp::OMPD_task, SourceLocation(),
+                               SourceLocation(), NumClauses, 1),
         HasCancel(false) {}
 
   /// Set cancel state.
@@ -2006,14 +2018,16 @@
   /// \param EndLoc Ending location of the directive.
   ///
   OMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, OMPD_taskyield,
-                               StartLoc, EndLoc, 0, 0) {}
+      : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass,
+                               llvm::omp::OMPD_taskyield, StartLoc, EndLoc, 0,
+                               0) {}
 
   /// Build an empty directive.
   ///
   explicit OMPTaskyieldDirective()
-      : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, OMPD_taskyield,
-                               SourceLocation(), SourceLocation(), 0, 0) {}
+      : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass,
+                               llvm::omp::OMPD_taskyield, SourceLocation(),
+                               SourceLocation(), 0, 0) {}
 
 public:
   /// Creates directive.
@@ -2050,14 +2064,16 @@
   /// \param EndLoc Ending location of the directive.
   ///
   OMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPExecutableDirective(this, OMPBarrierDirectiveClass, OMPD_barrier,
-                               StartLoc, EndLoc, 0, 0) {}
+      : OMPExecutableDirective(this, OMPBarrierDirectiveClass,
+                               llvm::omp::OMPD_barrier, StartLoc, EndLoc, 0,
+                               0) {}
 
   /// Build an empty directive.
   ///
   explicit OMPBarrierDirective()
-      : OMPExecutableDirective(this, OMPBarrierDirectiveClass, OMPD_barrier,
-                               SourceLocation(), SourceLocation(), 0, 0) {}
+      : OMPExecutableDirective(this, OMPBarrierDirectiveClass,
+                               llvm::omp::OMPD_barrier, SourceLocation(),
+                               SourceLocation(), 0, 0) {}
 
 public:
   /// Creates directive.
@@ -2094,14 +2110,16 @@
   /// \param EndLoc Ending location of the directive.
   ///
   OMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
-                               StartLoc, EndLoc, 0, 0) {}
+      : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass,
+                               llvm::omp::OMPD_taskwait, StartLoc, EndLoc, 0,
+                               0) {}
 
   /// Build an empty directive.
   ///
   explicit OMPTaskwaitDirective()
-      : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
-                               SourceLocation(), SourceLocation(), 0, 0) {}
+      : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass,
+                               llvm::omp::OMPD_taskwait, SourceLocation(),
+                               SourceLocation(), 0, 0) {}
 
 public:
   /// Creates directive.
@@ -2140,16 +2158,17 @@
   ///
   OMPTaskgroupDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                         unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, OMPD_taskgroup,
-                               StartLoc, EndLoc, NumClauses, 2) {}
+      : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass,
+                               llvm::omp::OMPD_taskgroup, StartLoc, EndLoc,
+                               NumClauses, 2) {}
 
   /// Build an empty directive.
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPTaskgroupDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, OMPD_taskgroup,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               2) {}
+      : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass,
+                               llvm::omp::OMPD_taskgroup, SourceLocation(),
+                               SourceLocation(), NumClauses, 2) {}
 
   /// Sets the task_reduction return variable.
   void setReductionRef(Expr *RR) {
@@ -2213,17 +2232,18 @@
   ///
   OMPFlushDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                     unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPFlushDirectiveClass, OMPD_flush,
-                               StartLoc, EndLoc, NumClauses, 0) {}
+      : OMPExecutableDirective(this, OMPFlushDirectiveClass,
+                               llvm::omp::OMPD_flush, StartLoc, EndLoc,
+                               NumClauses, 0) {}
 
   /// Build an empty directive.
   ///
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPFlushDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPFlushDirectiveClass, OMPD_flush,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               0) {}
+      : OMPExecutableDirective(this, OMPFlushDirectiveClass,
+                               llvm::omp::OMPD_flush, SourceLocation(),
+                               SourceLocation(), NumClauses, 0) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -2268,17 +2288,18 @@
   ///
   OMPOrderedDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                       unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPOrderedDirectiveClass, OMPD_ordered,
-                               StartLoc, EndLoc, NumClauses, 1) {}
+      : OMPExecutableDirective(this, OMPOrderedDirectiveClass,
+                               llvm::omp::OMPD_ordered, StartLoc, EndLoc,
+                               NumClauses, 1) {}
 
   /// Build an empty directive.
   ///
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPOrderedDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPOrderedDirectiveClass, OMPD_ordered,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               1) {}
+      : OMPExecutableDirective(this, OMPOrderedDirectiveClass,
+                               llvm::omp::OMPD_ordered, SourceLocation(),
+                               SourceLocation(), NumClauses, 1) {}
 
 public:
   /// Creates directive.
@@ -2343,8 +2364,9 @@
   ///
   OMPAtomicDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                      unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPAtomicDirectiveClass, OMPD_atomic,
-                               StartLoc, EndLoc, NumClauses, 5),
+      : OMPExecutableDirective(this, OMPAtomicDirectiveClass,
+                               llvm::omp::OMPD_atomic, StartLoc, EndLoc,
+                               NumClauses, 5),
         IsXLHSInRHSPart(false), IsPostfixUpdate(false) {}
 
   /// Build an empty directive.
@@ -2352,9 +2374,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPAtomicDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPAtomicDirectiveClass, OMPD_atomic,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               5),
+      : OMPExecutableDirective(this, OMPAtomicDirectiveClass,
+                               llvm::omp::OMPD_atomic, SourceLocation(),
+                               SourceLocation(), NumClauses, 5),
         IsXLHSInRHSPart(false), IsPostfixUpdate(false) {}
 
   /// Set 'x' part of the associated expression/statement.
@@ -2457,17 +2479,18 @@
   ///
   OMPTargetDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                      unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPTargetDirectiveClass, OMPD_target,
-                               StartLoc, EndLoc, NumClauses, 1) {}
+      : OMPExecutableDirective(this, OMPTargetDirectiveClass,
+                               llvm::omp::OMPD_target, StartLoc, EndLoc,
+                               NumClauses, 1) {}
 
   /// Build an empty directive.
   ///
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPTargetDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPTargetDirectiveClass, OMPD_target,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               1) {}
+      : OMPExecutableDirective(this, OMPTargetDirectiveClass,
+                               llvm::omp::OMPD_target, SourceLocation(),
+                               SourceLocation(), NumClauses, 1) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -2516,8 +2539,8 @@
   OMPTargetDataDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                          unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
-                               OMPD_target_data, StartLoc, EndLoc, NumClauses,
-                               1) {}
+                               llvm::omp::OMPD_target_data, StartLoc, EndLoc,
+                               NumClauses, 1) {}
 
   /// Build an empty directive.
   ///
@@ -2525,7 +2548,7 @@
   ///
   explicit OMPTargetDataDirective(unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
-                               OMPD_target_data, SourceLocation(),
+                               llvm::omp::OMPD_target_data, SourceLocation(),
                                SourceLocation(), NumClauses, 1) {}
 
 public:
@@ -2574,8 +2597,8 @@
   OMPTargetEnterDataDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                               unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass,
-                               OMPD_target_enter_data, StartLoc, EndLoc,
-                               NumClauses, /*NumChildren=*/1) {}
+                               llvm::omp::OMPD_target_enter_data, StartLoc,
+                               EndLoc, NumClauses, /*NumChildren=*/1) {}
 
   /// Build an empty directive.
   ///
@@ -2583,8 +2606,8 @@
   ///
   explicit OMPTargetEnterDataDirective(unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass,
-                               OMPD_target_enter_data, SourceLocation(),
-                               SourceLocation(), NumClauses,
+                               llvm::omp::OMPD_target_enter_data,
+                               SourceLocation(), SourceLocation(), NumClauses,
                                /*NumChildren=*/1) {}
 
 public:
@@ -2633,8 +2656,8 @@
   OMPTargetExitDataDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                              unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass,
-                               OMPD_target_exit_data, StartLoc, EndLoc,
-                               NumClauses, /*NumChildren=*/1) {}
+                               llvm::omp::OMPD_target_exit_data, StartLoc,
+                               EndLoc, NumClauses, /*NumChildren=*/1) {}
 
   /// Build an empty directive.
   ///
@@ -2642,8 +2665,8 @@
   ///
   explicit OMPTargetExitDataDirective(unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass,
-                               OMPD_target_exit_data, SourceLocation(),
-                               SourceLocation(), NumClauses,
+                               llvm::omp::OMPD_target_exit_data,
+                               SourceLocation(), SourceLocation(), NumClauses,
                                /*NumChildren=*/1) {}
 
 public:
@@ -2691,8 +2714,8 @@
   OMPTargetParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                              unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass,
-                               OMPD_target_parallel, StartLoc, EndLoc,
-                               NumClauses, /*NumChildren=*/1) {}
+                               llvm::omp::OMPD_target_parallel, StartLoc,
+                               EndLoc, NumClauses, /*NumChildren=*/1) {}
 
   /// Build an empty directive.
   ///
@@ -2700,8 +2723,8 @@
   ///
   explicit OMPTargetParallelDirective(unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass,
-                               OMPD_target_parallel, SourceLocation(),
-                               SourceLocation(), NumClauses,
+                               llvm::omp::OMPD_target_parallel,
+                               SourceLocation(), SourceLocation(), NumClauses,
                                /*NumChildren=*/1) {}
 
 public:
@@ -2756,7 +2779,7 @@
   OMPTargetParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                                 unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass,
-                         OMPD_target_parallel_for, StartLoc, EndLoc,
+                         llvm::omp::OMPD_target_parallel_for, StartLoc, EndLoc,
                          CollapsedNum, NumClauses),
         HasCancel(false) {}
 
@@ -2768,7 +2791,7 @@
   explicit OMPTargetParallelForDirective(unsigned CollapsedNum,
                                          unsigned NumClauses)
       : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass,
-                         OMPD_target_parallel_for, SourceLocation(),
+                         llvm::omp::OMPD_target_parallel_for, SourceLocation(),
                          SourceLocation(), CollapsedNum, NumClauses),
         HasCancel(false) {}
 
@@ -2830,17 +2853,18 @@
   ///
   OMPTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                     unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPTeamsDirectiveClass, OMPD_teams,
-                               StartLoc, EndLoc, NumClauses, 1) {}
+      : OMPExecutableDirective(this, OMPTeamsDirectiveClass,
+                               llvm::omp::OMPD_teams, StartLoc, EndLoc,
+                               NumClauses, 1) {}
 
   /// Build an empty directive.
   ///
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPTeamsDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPTeamsDirectiveClass, OMPD_teams,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               1) {}
+      : OMPExecutableDirective(this, OMPTeamsDirectiveClass,
+                               llvm::omp::OMPD_teams, SourceLocation(),
+                               SourceLocation(), NumClauses, 1) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -2887,16 +2911,17 @@
   ///
   OMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc)
       : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
-                               OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
-        CancelRegion(OMPD_unknown) {}
+                               llvm::omp::OMPD_cancellation_point, StartLoc,
+                               EndLoc, 0, 0),
+        CancelRegion(llvm::omp::OMPD_unknown) {}
 
   /// Build an empty directive.
   ///
   explicit OMPCancellationPointDirective()
       : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
-                               OMPD_cancellation_point, SourceLocation(),
-                               SourceLocation(), 0, 0),
-        CancelRegion(OMPD_unknown) {}
+                               llvm::omp::OMPD_cancellation_point,
+                               SourceLocation(), SourceLocation(), 0, 0),
+        CancelRegion(llvm::omp::OMPD_unknown) {}
 
   /// Set cancel region for current cancellation point.
   /// \param CR Cancellation region.
@@ -2946,18 +2971,19 @@
   ///
   OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                      unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
-                               StartLoc, EndLoc, NumClauses, 0),
-        CancelRegion(OMPD_unknown) {}
+      : OMPExecutableDirective(this, OMPCancelDirectiveClass,
+                               llvm::omp::OMPD_cancel, StartLoc, EndLoc,
+                               NumClauses, 0),
+        CancelRegion(llvm::omp::OMPD_unknown) {}
 
   /// Build an empty directive.
   ///
   /// \param NumClauses Number of clauses.
   explicit OMPCancelDirective(unsigned NumClauses)
-      : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
-                               SourceLocation(), SourceLocation(), NumClauses,
-                               0),
-        CancelRegion(OMPD_unknown) {}
+      : OMPExecutableDirective(this, OMPCancelDirectiveClass,
+                               llvm::omp::OMPD_cancel, SourceLocation(),
+                               SourceLocation(), NumClauses, 0),
+        CancelRegion(llvm::omp::OMPD_unknown) {}
 
   /// Set cancel region for current cancellation point.
   /// \param CR Cancellation region.
@@ -3011,8 +3037,9 @@
   ///
   OMPTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                        unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, OMPD_taskloop,
-                         StartLoc, EndLoc, CollapsedNum, NumClauses) {}
+      : OMPLoopDirective(this, OMPTaskLoopDirectiveClass,
+                         llvm::omp::OMPD_taskloop, StartLoc, EndLoc,
+                         CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3020,9 +3047,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPTaskLoopDirective(unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, OMPD_taskloop,
-                         SourceLocation(), SourceLocation(), CollapsedNum,
-                         NumClauses) {}
+      : OMPLoopDirective(this, OMPTaskLoopDirectiveClass,
+                         llvm::omp::OMPD_taskloop, SourceLocation(),
+                         SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -3077,8 +3104,8 @@
   OMPTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                            unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass,
-                         OMPD_taskloop_simd, StartLoc, EndLoc, CollapsedNum,
-                         NumClauses) {}
+                         llvm::omp::OMPD_taskloop_simd, StartLoc, EndLoc,
+                         CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3087,8 +3114,8 @@
   ///
   explicit OMPTaskLoopSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass,
-                         OMPD_taskloop_simd, SourceLocation(), SourceLocation(),
-                         CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_taskloop_simd, SourceLocation(),
+                         SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -3144,8 +3171,8 @@
   OMPMasterTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                              unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass,
-                         OMPD_master_taskloop, StartLoc, EndLoc, CollapsedNum,
-                         NumClauses) {}
+                         llvm::omp::OMPD_master_taskloop, StartLoc, EndLoc,
+                         CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3155,7 +3182,7 @@
   explicit OMPMasterTaskLoopDirective(unsigned CollapsedNum,
                                       unsigned NumClauses)
       : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass,
-                         OMPD_master_taskloop, SourceLocation(),
+                         llvm::omp::OMPD_master_taskloop, SourceLocation(),
                          SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
@@ -3212,7 +3239,7 @@
   OMPMasterTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                                  unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPMasterTaskLoopSimdDirectiveClass,
-                         OMPD_master_taskloop_simd, StartLoc, EndLoc,
+                         llvm::omp::OMPD_master_taskloop_simd, StartLoc, EndLoc,
                          CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
@@ -3223,7 +3250,7 @@
   explicit OMPMasterTaskLoopSimdDirective(unsigned CollapsedNum,
                                           unsigned NumClauses)
       : OMPLoopDirective(this, OMPMasterTaskLoopSimdDirectiveClass,
-                         OMPD_master_taskloop_simd, SourceLocation(),
+                         llvm::omp::OMPD_master_taskloop_simd, SourceLocation(),
                          SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
@@ -3281,8 +3308,8 @@
                                      SourceLocation EndLoc,
                                      unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass,
-                         OMPD_parallel_master_taskloop, StartLoc, EndLoc,
-                         CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_parallel_master_taskloop, StartLoc,
+                         EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3292,8 +3319,9 @@
   explicit OMPParallelMasterTaskLoopDirective(unsigned CollapsedNum,
                                               unsigned NumClauses)
       : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass,
-                         OMPD_parallel_master_taskloop, SourceLocation(),
-                         SourceLocation(), CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_parallel_master_taskloop,
+                         SourceLocation(), SourceLocation(), CollapsedNum,
+                         NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -3352,8 +3380,8 @@
                                          unsigned CollapsedNum,
                                          unsigned NumClauses)
       : OMPLoopDirective(this, OMPParallelMasterTaskLoopSimdDirectiveClass,
-                         OMPD_parallel_master_taskloop_simd, StartLoc, EndLoc,
-                         CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_parallel_master_taskloop_simd,
+                         StartLoc, EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3363,8 +3391,9 @@
   explicit OMPParallelMasterTaskLoopSimdDirective(unsigned CollapsedNum,
                                                   unsigned NumClauses)
       : OMPLoopDirective(this, OMPParallelMasterTaskLoopSimdDirectiveClass,
-                         OMPD_parallel_master_taskloop_simd, SourceLocation(),
-                         SourceLocation(), CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_parallel_master_taskloop_simd,
+                         SourceLocation(), SourceLocation(), CollapsedNum,
+                         NumClauses) {}
 
 public:
   /// Creates directive with a list of \p Clauses.
@@ -3418,9 +3447,9 @@
   ///
   OMPDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                          unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,
-                         StartLoc, EndLoc, CollapsedNum, NumClauses)
-        {}
+      : OMPLoopDirective(this, OMPDistributeDirectiveClass,
+                         llvm::omp::OMPD_distribute, StartLoc, EndLoc,
+                         CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3428,10 +3457,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPDistributeDirective(unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,
-                         SourceLocation(), SourceLocation(), CollapsedNum,
-                         NumClauses)
-        {}
+      : OMPLoopDirective(this, OMPDistributeDirectiveClass,
+                         llvm::omp::OMPD_distribute, SourceLocation(),
+                         SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -3485,8 +3513,8 @@
   OMPTargetUpdateDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                            unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass,
-                               OMPD_target_update, StartLoc, EndLoc, NumClauses,
-                               1) {}
+                               llvm::omp::OMPD_target_update, StartLoc, EndLoc,
+                               NumClauses, 1) {}
 
   /// Build an empty directive.
   ///
@@ -3494,7 +3522,7 @@
   ///
   explicit OMPTargetUpdateDirective(unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass,
-                               OMPD_target_update, SourceLocation(),
+                               llvm::omp::OMPD_target_update, SourceLocation(),
                                SourceLocation(), NumClauses, 1) {}
 
 public:
@@ -3549,8 +3577,9 @@
                                     SourceLocation EndLoc,
                                     unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass,
-                         OMPD_distribute_parallel_for, StartLoc, EndLoc,
-                         CollapsedNum, NumClauses), HasCancel(false) {}
+                         llvm::omp::OMPD_distribute_parallel_for, StartLoc,
+                         EndLoc, CollapsedNum, NumClauses),
+        HasCancel(false) {}
 
   /// Build an empty directive.
   ///
@@ -3560,8 +3589,9 @@
   explicit OMPDistributeParallelForDirective(unsigned CollapsedNum,
                                              unsigned NumClauses)
       : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass,
-                         OMPD_distribute_parallel_for, SourceLocation(),
-                         SourceLocation(), CollapsedNum, NumClauses),
+                         llvm::omp::OMPD_distribute_parallel_for,
+                         SourceLocation(), SourceLocation(), CollapsedNum,
+                         NumClauses),
         HasCancel(false) {}
 
   /// Set cancel state.
@@ -3628,7 +3658,7 @@
                                         unsigned CollapsedNum,
                                         unsigned NumClauses)
       : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass,
-                         OMPD_distribute_parallel_for_simd, StartLoc,
+                         llvm::omp::OMPD_distribute_parallel_for_simd, StartLoc,
                          EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
@@ -3639,7 +3669,7 @@
   explicit OMPDistributeParallelForSimdDirective(unsigned CollapsedNum,
                                                  unsigned NumClauses)
       : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass,
-                         OMPD_distribute_parallel_for_simd,
+                         llvm::omp::OMPD_distribute_parallel_for_simd,
                          SourceLocation(), SourceLocation(), CollapsedNum,
                          NumClauses) {}
 
@@ -3695,8 +3725,8 @@
   OMPDistributeSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                              unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass,
-                         OMPD_distribute_simd, StartLoc, EndLoc, CollapsedNum,
-                         NumClauses) {}
+                         llvm::omp::OMPD_distribute_simd, StartLoc, EndLoc,
+                         CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3706,7 +3736,7 @@
   explicit OMPDistributeSimdDirective(unsigned CollapsedNum,
                                       unsigned NumClauses)
       : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass,
-                         OMPD_distribute_simd, SourceLocation(),
+                         llvm::omp::OMPD_distribute_simd, SourceLocation(),
                          SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
@@ -3760,11 +3790,12 @@
   /// \param CollapsedNum Number of collapsed nested loops.
   /// \param NumClauses Number of clauses.
   ///
-  OMPTargetParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
-                                unsigned CollapsedNum, unsigned NumClauses)
+  OMPTargetParallelForSimdDirective(SourceLocation StartLoc,
+                                    SourceLocation EndLoc,
+                                    unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass,
-                         OMPD_target_parallel_for_simd, StartLoc, EndLoc,
-                         CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_target_parallel_for_simd, StartLoc,
+                         EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3774,8 +3805,9 @@
   explicit OMPTargetParallelForSimdDirective(unsigned CollapsedNum,
                                              unsigned NumClauses)
       : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass,
-                         OMPD_target_parallel_for_simd, SourceLocation(),
-                         SourceLocation(), CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_target_parallel_for_simd,
+                         SourceLocation(), SourceLocation(), CollapsedNum,
+                         NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -3831,8 +3863,8 @@
   OMPTargetSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                          unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPTargetSimdDirectiveClass,
-                         OMPD_target_simd, StartLoc, EndLoc, CollapsedNum,
-                         NumClauses) {}
+                         llvm::omp::OMPD_target_simd, StartLoc, EndLoc,
+                         CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3840,9 +3872,9 @@
   /// \param NumClauses Number of clauses.
   ///
   explicit OMPTargetSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
-      : OMPLoopDirective(this, OMPTargetSimdDirectiveClass, OMPD_target_simd,
-                         SourceLocation(),SourceLocation(), CollapsedNum,
-                         NumClauses) {}
+      : OMPLoopDirective(this, OMPTargetSimdDirectiveClass,
+                         llvm::omp::OMPD_target_simd, SourceLocation(),
+                         SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -3897,7 +3929,7 @@
   OMPTeamsDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                               unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass,
-                         OMPD_teams_distribute, StartLoc, EndLoc,
+                         llvm::omp::OMPD_teams_distribute, StartLoc, EndLoc,
                          CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
@@ -3908,7 +3940,7 @@
   explicit OMPTeamsDistributeDirective(unsigned CollapsedNum,
                                        unsigned NumClauses)
       : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass,
-                         OMPD_teams_distribute, SourceLocation(),
+                         llvm::omp::OMPD_teams_distribute, SourceLocation(),
                          SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
@@ -3966,8 +3998,8 @@
                                   SourceLocation EndLoc, unsigned CollapsedNum,
                                   unsigned NumClauses)
       : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass,
-                         OMPD_teams_distribute_simd, StartLoc, EndLoc,
-                         CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_teams_distribute_simd, StartLoc,
+                         EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -3977,8 +4009,9 @@
   explicit OMPTeamsDistributeSimdDirective(unsigned CollapsedNum,
                                            unsigned NumClauses)
       : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass,
-                         OMPD_teams_distribute_simd, SourceLocation(),
-                         SourceLocation(), CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_teams_distribute_simd,
+                         SourceLocation(), SourceLocation(), CollapsedNum,
+                         NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -4038,8 +4071,8 @@
                                              unsigned CollapsedNum,
                                              unsigned NumClauses)
       : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass,
-                         OMPD_teams_distribute_parallel_for_simd, StartLoc,
-                         EndLoc, CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_teams_distribute_parallel_for_simd,
+                         StartLoc, EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -4049,7 +4082,7 @@
   explicit OMPTeamsDistributeParallelForSimdDirective(unsigned CollapsedNum,
                                                       unsigned NumClauses)
       : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass,
-                         OMPD_teams_distribute_parallel_for_simd,
+                         llvm::omp::OMPD_teams_distribute_parallel_for_simd,
                          SourceLocation(), SourceLocation(), CollapsedNum,
                          NumClauses) {}
 
@@ -4110,8 +4143,9 @@
                                          unsigned CollapsedNum,
                                          unsigned NumClauses)
       : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass,
-                         OMPD_teams_distribute_parallel_for, StartLoc, EndLoc,
-                         CollapsedNum, NumClauses), HasCancel(false) {}
+                         llvm::omp::OMPD_teams_distribute_parallel_for,
+                         StartLoc, EndLoc, CollapsedNum, NumClauses),
+        HasCancel(false) {}
 
   /// Build an empty directive.
   ///
@@ -4121,8 +4155,9 @@
   explicit OMPTeamsDistributeParallelForDirective(unsigned CollapsedNum,
                                                   unsigned NumClauses)
       : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass,
-                         OMPD_teams_distribute_parallel_for, SourceLocation(),
-                         SourceLocation(), CollapsedNum, NumClauses),
+                         llvm::omp::OMPD_teams_distribute_parallel_for,
+                         SourceLocation(), SourceLocation(), CollapsedNum,
+                         NumClauses),
         HasCancel(false) {}
 
   /// Set cancel state.
@@ -4182,8 +4217,8 @@
   OMPTargetTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
                           unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass,
-                               OMPD_target_teams, StartLoc, EndLoc, NumClauses,
-                               1) {}
+                               llvm::omp::OMPD_target_teams, StartLoc, EndLoc,
+                               NumClauses, 1) {}
 
   /// Build an empty directive.
   ///
@@ -4191,7 +4226,7 @@
   ///
   explicit OMPTargetTeamsDirective(unsigned NumClauses)
       : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass,
-                               OMPD_target_teams, SourceLocation(),
+                               llvm::omp::OMPD_target_teams, SourceLocation(),
                                SourceLocation(), NumClauses, 1) {}
 
 public:
@@ -4244,8 +4279,8 @@
                                     SourceLocation EndLoc,
                                     unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass,
-                         OMPD_target_teams_distribute, StartLoc, EndLoc,
-                         CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_target_teams_distribute, StartLoc,
+                         EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -4255,8 +4290,9 @@
   explicit OMPTargetTeamsDistributeDirective(unsigned CollapsedNum,
                                              unsigned NumClauses)
       : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass,
-                         OMPD_target_teams_distribute, SourceLocation(),
-                         SourceLocation(), CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_target_teams_distribute,
+                         SourceLocation(), SourceLocation(), CollapsedNum,
+                         NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -4317,8 +4353,8 @@
                                                unsigned NumClauses)
       : OMPLoopDirective(this,
                          OMPTargetTeamsDistributeParallelForDirectiveClass,
-                         OMPD_target_teams_distribute_parallel_for, StartLoc,
-                         EndLoc, CollapsedNum, NumClauses),
+                         llvm::omp::OMPD_target_teams_distribute_parallel_for,
+                         StartLoc, EndLoc, CollapsedNum, NumClauses),
         HasCancel(false) {}
 
   /// Build an empty directive.
@@ -4330,8 +4366,8 @@
                                                         unsigned NumClauses)
       : OMPLoopDirective(
             this, OMPTargetTeamsDistributeParallelForDirectiveClass,
-            OMPD_target_teams_distribute_parallel_for, SourceLocation(),
-            SourceLocation(), CollapsedNum, NumClauses),
+            llvm::omp::OMPD_target_teams_distribute_parallel_for,
+            SourceLocation(), SourceLocation(), CollapsedNum, NumClauses),
         HasCancel(false) {}
 
   /// Set cancel state.
@@ -4397,10 +4433,10 @@
                                                    SourceLocation EndLoc,
                                                    unsigned CollapsedNum,
                                                    unsigned NumClauses)
-      : OMPLoopDirective(this,
-                         OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
-                         OMPD_target_teams_distribute_parallel_for_simd,
-                         StartLoc, EndLoc, CollapsedNum, NumClauses) {}
+      : OMPLoopDirective(
+            this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
+            llvm::omp::OMPD_target_teams_distribute_parallel_for_simd, StartLoc,
+            EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -4411,8 +4447,8 @@
       unsigned CollapsedNum, unsigned NumClauses)
       : OMPLoopDirective(
             this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
-            OMPD_target_teams_distribute_parallel_for_simd, SourceLocation(),
-            SourceLocation(), CollapsedNum, NumClauses) {}
+            llvm::omp::OMPD_target_teams_distribute_parallel_for_simd,
+            SourceLocation(), SourceLocation(), CollapsedNum, NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
@@ -4470,8 +4506,8 @@
                                         unsigned CollapsedNum,
                                         unsigned NumClauses)
       : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass,
-                         OMPD_target_teams_distribute_simd, StartLoc, EndLoc,
-                         CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_target_teams_distribute_simd, StartLoc,
+                         EndLoc, CollapsedNum, NumClauses) {}
 
   /// Build an empty directive.
   ///
@@ -4481,8 +4517,9 @@
   explicit OMPTargetTeamsDistributeSimdDirective(unsigned CollapsedNum,
                                                  unsigned NumClauses)
       : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass,
-                         OMPD_target_teams_distribute_simd, SourceLocation(),
-                         SourceLocation(), CollapsedNum, NumClauses) {}
+                         llvm::omp::OMPD_target_teams_distribute_simd,
+                         SourceLocation(), SourceLocation(), CollapsedNum,
+                         NumClauses) {}
 
 public:
   /// Creates directive with a list of \a Clauses.
Index: clang/include/clang/AST/OpenMPClause.h
===================================================================
--- clang/include/clang/AST/OpenMPClause.h
+++ clang/include/clang/AST/OpenMPClause.h
@@ -111,7 +111,7 @@
   Stmt *PreInit = nullptr;
 
   /// Region that captures the associated stmt.
-  OpenMPDirectiveKind CaptureRegion = OMPD_unknown;
+  OpenMPDirectiveKind CaptureRegion = llvm::omp::OMPD_unknown;
 
 protected:
   OMPClauseWithPreInit(const OMPClause *This) {
@@ -119,7 +119,9 @@
   }
 
   /// Set pre-initialization statement for the clause.
-  void setPreInitStmt(Stmt *S, OpenMPDirectiveKind ThisRegion = OMPD_unknown) {
+  void
+  setPreInitStmt(Stmt *S,
+                 OpenMPDirectiveKind ThisRegion = llvm::omp::OMPD_unknown) {
     PreInit = S;
     CaptureRegion = ThisRegion;
   }
@@ -432,7 +434,7 @@
   SourceLocation ColonLoc;
 
   /// Directive name modifier for the clause.
-  OpenMPDirectiveKind NameModifier = OMPD_unknown;
+  OpenMPDirectiveKind NameModifier = llvm::omp::OMPD_unknown;
 
   /// Name modifier location.
   SourceLocation NameModifierLoc;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to