
Summary: The new OpenMPConstants.h is a location for all OpenMP related constants (and helpers) to live. This patch moves the directives there (the enum OpenMPDirectiveKind) and rewires Clang to use the new location. Initially part of D69785. Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim Subscribers: jholewinski, ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69853
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
//===- OMPConstants.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/OpenMP/OMPConstants.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/OpenMP/OMPKinds.def"
|
|
.Default(OMPD_unknown);
|
|
}
|
|
|
|
StringRef llvm::omp::getOpenMPDirectiveName(Directive Kind) {
|
|
switch (Kind) {
|
|
#define OMP_DIRECTIVE(Enum, Str) \
|
|
case Enum: \
|
|
return Str;
|
|
#include "llvm/Frontend/OpenMP/OMPKinds.def"
|
|
}
|
|
llvm_unreachable("Invalid OpenMP directive kind");
|
|
}
|