mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-04 19:56:06 +00:00
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
![]() |
//===--- OpenMPKinds.cpp - Token Kinds Support ----------------------------===//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
/// \file
|
||
|
/// \brief This file implements the OpenMP enum and support functions.
|
||
|
///
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#include "clang/Basic/OpenMPKinds.h"
|
||
|
#include "clang/Basic/IdentifierTable.h"
|
||
|
#include "clang/Lex/Token.h"
|
||
|
#include "llvm/ADT/StringSwitch.h"
|
||
|
#include "llvm/Support/ErrorHandling.h"
|
||
|
#include <cassert>
|
||
|
|
||
|
using namespace clang;
|
||
|
|
||
|
OpenMPDirectiveKind clang::getOpenMPDirectiveKind(StringRef Str) {
|
||
|
return llvm::StringSwitch<OpenMPDirectiveKind>(Str)
|
||
|
#define OPENMP_DIRECTIVE(Name) \
|
||
|
.Case(#Name, OMPD_##Name)
|
||
|
#include "clang/Basic/OpenMPKinds.def"
|
||
|
.Default(OMPD_unknown);
|
||
|
}
|
||
|
|
||
|
const char *clang::getOpenMPDirectiveName(OpenMPDirectiveKind Kind) {
|
||
|
assert(Kind < NUM_OPENMP_DIRECTIVES);
|
||
|
switch (Kind) {
|
||
|
case OMPD_unknown:
|
||
|
return ("unknown");
|
||
|
#define OPENMP_DIRECTIVE(Name) \
|
||
|
case OMPD_##Name : return #Name;
|
||
|
#include "clang/Basic/OpenMPKinds.def"
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
llvm_unreachable("Invalid OpenMP directive kind");
|
||
|
}
|