2013-03-22 14:34:35 +08:00
|
|
|
//===--- 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"
|
2013-03-26 05:32:02 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2013-03-22 14:34:35 +08:00
|
|
|
#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:
|
2013-05-13 12:18:18 +08:00
|
|
|
return "unknown";
|
2013-03-22 14:34:35 +08:00
|
|
|
#define OPENMP_DIRECTIVE(Name) \
|
|
|
|
case OMPD_##Name : return #Name;
|
|
|
|
#include "clang/Basic/OpenMPKinds.def"
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid OpenMP directive kind");
|
|
|
|
}
|
2013-05-13 12:18:18 +08:00
|
|
|
|