summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Frontend/OpenMP/OMPConstants.cpp
blob: 994fb4e2fa84448ef58731e12d21b3d978f0c207 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//===- 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");
}
OpenPOWER on IntegriCloud