Index: include/clang/Basic/OpenMP.h
===================================================================
--- include/clang/Basic/OpenMP.h	(revision 0)
+++ include/clang/Basic/OpenMP.h	(revision 0)
@@ -0,0 +1,133 @@
+//===----------------------- OpenMP.h - OpenMP enums ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// \brief Defines some OpenMP specific enums.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_BASIC_OPENMP_H
+#define LLVM_CLANG_BASIC_OPENMP_H
+
+#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include <cassert>
+
+namespace clang {
+
+namespace omp {
+
+/// \brief Enum values which represent different OpenMP clause kinds.
+///
+/// Parse, Sema and AST classes are the *clients* of these enum values.
+enum ClauseKind {
+  c_private = 0, 
+  c_firstprivate = 1, 
+  c_lastprivate = 2, 
+  c_shared = 3, 
+  c_copyin = 4, 
+  c_copyprivate = 5,
+  c_if = 6, 
+  c_numthreads = 7, 
+  c_final = 8, 
+  c_collapse = 9,
+  c_reduction = 10, 
+  c_schedule = 11,
+  c_default = 12, 
+  c_ordered = 13, 
+  c_nowait = 14, 
+  c_untied = 15, 
+  c_mergeable = 16, 
+  c_read = 17, 
+  c_write = 18, 
+  c_update = 19, 
+  c_capture = 20,
+  c_end = 21
+};
+
+/// \brief Enum values which represent different default clause kinds.
+///
+/// Parse, Sema and AST classes are the *clients* of these enum values.
+enum DefaultKind { 
+  d_shared = 0, 
+  d_none = 1, 
+  d_end = 2
+};
+
+/// \brief Enum values which represent different reduction clause operator
+/// kinds.
+///
+/// Parse, Sema and AST classes are the *clients* of these enum values.
+enum ReductionOpKind { 
+  r_plus = 0,
+  r_minus = 1,
+  r_prod = 2,
+  r_div = 3,
+  r_bitand = 4,
+  r_bitor = 5,
+  r_and = 6,
+  r_or = 7,
+  r_xor = 8,
+  r_end = 9
+};
+
+/// \brief Enum valuese which represent different schedule clause kinds.
+///
+/// Parse, Sema and AST classes are the *clients* of these enum values.
+enum ScheduleKind {
+  s_static = 0, 
+  s_dynamic = 1, 
+  s_guided = 2, 
+  s_auto = 3, 
+  s_runtime = 4,
+  s_end = 5
+};
+
+/// \brief Initializes different StringMaps like StringMap for OpenMP clause
+/// kind, for OpenMP default clause kind, etc.
+///
+/// Note that we won't introduce new *tokens* for openMP clause names, default
+/// clause kind names, etc, as these names will get conflict with *identifier*
+/// token, and it requires modifications to Lexer internals, and is not very
+/// neat. Instead, we reference associated StringMaps to parse these OpenMP
+/// names.
+///
+/// This routine is called during the construction of parser.
+void Initialize();
+
+/// \brief Erases different StringMaps like StringMap for OpenMP clause
+/// kind, for OpenMP default clause kind, etc which are created during
+/// initialization.
+
+/// This routine is called during the destruction of parser.
+void CleanUp();
+
+/// \brief Helper routine to get an enum kind associated with an OpenMP clause,
+/// given its name.
+///
+/// Parser is the main *client* of this routine.
+ClauseKind getClauseKind(StringRef Name);
+
+/// \brief Helper routine to get an enum kind associated with an OpenMP default
+/// clause kind, given its name.
+///
+/// Parser is the main *client* of this routine.
+DefaultKind getDefaultKind(StringRef Name);
+
+/// \brief Helper routine to get an enum kind associated with an OpenMP
+/// schedule clause kind, given its name.
+///
+/// Parser is the main *client* of this routine.
+ScheduleKind getScheduleKind(StringRef Name);
+
+} // end of namespace omp 
+} // end of namespace clang
+
+#endif
Index: lib/Basic/OpenMP.cpp
===================================================================
--- lib/Basic/OpenMP.cpp	(revision 0)
+++ lib/Basic/OpenMP.cpp	(revision 0)
@@ -0,0 +1,199 @@
+//===----------------- OpenMP.cpp - OpenMP enums Support ------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file implements the OpenMP enums and support functions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Basic/OpenMP.h"
+#include "llvm/ADT/OwningPtr.h"
+#include <cassert>
+using namespace clang;
+
+namespace {
+
+/// \brief Typedefs for different OpenMP specific StringMap data structure
+/// types.
+typedef llvm::StringMap<enum omp::ClauseKind> ClauseMapType;
+typedef llvm::StringMap<enum omp::DefaultKind> DefaultMapType;
+typedef llvm::StringMap<enum omp::ScheduleKind> ScheduleMapType;
+typedef OwningPtr<ClauseMapType> ClauseOwningPtr;
+typedef OwningPtr<DefaultMapType> DefaultOwningPtr;
+typedef OwningPtr<ScheduleMapType> ScheduleOwningPtr;
+
+/// \brief ClauseMap - A StringMap which holds enum kinds associated
+/// with different OpenMP *clause* names.
+ClauseOwningPtr ClauseMap;
+
+/// \brief DefaultMap - A StringMap which holds enum kinds associated
+/// with different OpenMP *default clause kind* names.
+DefaultOwningPtr DefaultMap;
+
+/// \brief ScheduleMap - A StringMap which holds enum kinds associated
+/// with different OpenMP *schedule clause kind* names.
+ScheduleOwningPtr ScheduleMap;
+
+/// \brief ConstructStringMap - An internal parameterized routine which
+/// constructs different OpenMP specific StringMap data structures.
+template<class OwningPtr, class MapType>
+void ConstructStringMap(OwningPtr &MapOwner) {
+  MapOwner.reset(new MapType());
+}
+
+/// \brief ContructStringMap - Constructs new OpenMP specific StringMap data
+/// structures. 
+void ContructStringMap() {
+  ConstructStringMap<ClauseOwningPtr, ClauseMapType>(ClauseMap);
+  ConstructStringMap<DefaultOwningPtr, DefaultMapType>(DefaultMap);
+  ConstructStringMap<ScheduleOwningPtr, ScheduleMapType>(ScheduleMap);
+}
+
+/// \brief RemoveStringMap - An internal parameterized routine which
+/// destroys different OpenMP specific StringMap data structures which
+/// were constructed during the initialization.
+template<class OwningPtr>
+void RemoveStringMap(OwningPtr &MapOwner) {
+  MapOwner.reset();
+}
+
+/// \brief RemoveStringMap - Destroys OpenMP specific StringMap data
+/// structures which were created during initialization. 
+void RemoveStringMap() {
+  RemoveStringMap(ClauseMap);
+  RemoveStringMap(DefaultMap);
+  RemoveStringMap(ScheduleMap);
+}
+
+/// \brief AddStringMapEntry - An internal parameterized routine which creates
+/// new entries within a given OpenMP specific StringMap data structure.
+template<class MapType, class EnumType>
+void AddStringMapEntry(MapType* Map, EnumType EnumVal, StringRef Name) {
+  typename MapType::const_iterator Iter = Map->find(Name);
+  assert((Iter==Map->end()) &&
+         "An enum value already exists for this OpenMP name");
+  typename MapType::MapEntryTy &Entry = Map->GetOrCreateValue(Name, EnumVal);
+  Map->insert(&Entry);
+}
+
+/// \brief AddClauseNameEntry - Adds new StringMap entries for different OpenMP
+/// clause names.
+void AddClauseNameEntry() {
+  AddStringMapEntry(ClauseMap.get(), omp::c_private, "private");
+  AddStringMapEntry(ClauseMap.get(), omp::c_firstprivate, "firstprivate");
+  AddStringMapEntry(ClauseMap.get(), omp::c_lastprivate, "lastprivate");
+  AddStringMapEntry(ClauseMap.get(), omp::c_shared, "shared");
+  AddStringMapEntry(ClauseMap.get(), omp::c_copyin, "copyin");
+  AddStringMapEntry(ClauseMap.get(), omp::c_copyprivate, "copyprivate");
+  AddStringMapEntry(ClauseMap.get(), omp::c_if, "if");
+  AddStringMapEntry(ClauseMap.get(), omp::c_numthreads, "num_threads");
+  AddStringMapEntry(ClauseMap.get(), omp::c_final, "final");
+  AddStringMapEntry(ClauseMap.get(), omp::c_final, "collapse");
+  AddStringMapEntry(ClauseMap.get(), omp::c_reduction, "reduction");
+  AddStringMapEntry(ClauseMap.get(), omp::c_schedule, "schedule");
+  AddStringMapEntry(ClauseMap.get(), omp::c_default, "default");
+  AddStringMapEntry(ClauseMap.get(), omp::c_ordered, "ordered");
+  AddStringMapEntry(ClauseMap.get(), omp::c_nowait, "nowait");
+  AddStringMapEntry(ClauseMap.get(), omp::c_untied, "untied");
+  AddStringMapEntry(ClauseMap.get(), omp::c_mergeable, "mergeable");
+  AddStringMapEntry(ClauseMap.get(), omp::c_read, "read");
+  AddStringMapEntry(ClauseMap.get(), omp::c_write, "write");
+  AddStringMapEntry(ClauseMap.get(), omp::c_update, "update");
+  AddStringMapEntry(ClauseMap.get(), omp::c_capture, "capture");
+}
+
+/// \brief AddDefaultNameEntry - Adds new StringMap entries for different OpenMP
+/// default clause kinds.
+void AddDefaultNameEntry() {
+  AddStringMapEntry(DefaultMap.get(), omp::d_shared, "shared");
+  AddStringMapEntry(DefaultMap.get(), omp::d_none, "none");
+}
+
+/// \brief AddScheduleNameEntry - Adds new StringMap entries for different OpenMP
+/// schedule clause kinds.
+void AddScheduleNameEntry() {
+  AddStringMapEntry(ScheduleMap.get(), omp::s_static, "static");
+  AddStringMapEntry(ScheduleMap.get(), omp::s_dynamic, "dynamic");
+  AddStringMapEntry(ScheduleMap.get(), omp::s_guided, "guided");
+  AddStringMapEntry(ScheduleMap.get(), omp::s_auto, "auto");
+  AddStringMapEntry(ScheduleMap.get(), omp::s_runtime, "runtime");
+}
+
+/// \brief AddStringMapEntry - Adds new entries for different OpenMP specific
+/// StringMaps.
+void AddStringMapEntry() {
+  AddClauseNameEntry();
+  AddDefaultNameEntry();
+  AddScheduleNameEntry();
+}
+
+/// \brief FindStringMapEntry - An internal parameterized routine which gets an
+/// existing entry, if any, from an OpenMP specific StringMap data structure.
+template<class MapType, class EnumType>
+void FindStringMapEntry(MapType* Map, EnumType &EnumVal, StringRef Name) {
+  typename MapType::const_iterator Iter = Map->find(Name);
+  if (Iter != Map->end())
+    EnumVal= Iter->second;
+}
+
+} // end of anonymous namespace
+
+
+/// \brief Initialize - Initializes different StringMaps like StringMap for
+/// OpenMP clause kind, for OpenMP default clause kind, etc.
+///
+/// Note that we won't introduce new *tokens* for openMP clause names, default
+/// clause kind names, etc, as these names will get conflict with *identifier*
+/// token, and it requires modifications to Lexer internals, and is not very
+/// neat. Instead, we reference associated StringMaps to parse these OpenMP
+/// names.
+///
+/// This routine is called during the construction of parser.
+void omp::Initialize() {
+  ContructStringMap();
+  AddStringMapEntry();
+}
+
+/// \brief CleanUp - Empties out different StringMaps like StringMap for OpenMP
+/// clause kind, for OpenMP default clause kind, etc which are created during
+/// initialization.
+
+/// This routine is called during the destruction of parser.
+void omp::CleanUp() {
+  RemoveStringMap();
+}
+
+/// \brief getClauseKind - Helper routine to get an enum kind associated with
+/// an OpenMP clause, given its name.
+///
+/// Parser is the main *client* of this routine.
+enum omp::ClauseKind omp::getClauseKind(StringRef Name) {
+  enum omp::ClauseKind EnumVal = omp::c_end;
+  FindStringMapEntry(ClauseMap.get(), EnumVal, Name);
+  return EnumVal;
+}
+
+/// \brief getDefaultKind - Helper routine to get an enum kind associated with
+/// an OpenMP default clause kind, given its name.
+///
+/// Parser is the main *client* of this routine.
+enum omp::DefaultKind omp::getDefaultKind(StringRef Name) {
+  enum omp::DefaultKind EnumVal = omp::d_end;
+  FindStringMapEntry(DefaultMap.get(), EnumVal, Name);
+  return EnumVal;
+}
+
+/// \brief getScheduleKind - Helper routine to get an enum kind associated with
+/// an OpenMP schedule clause kind, given its name.
+///
+/// Parser is the main *client* of this routine.
+enum omp::ScheduleKind omp::getScheduleKind(StringRef Name) {
+  enum omp::ScheduleKind EnumVal = omp::s_end;
+  FindStringMapEntry(ScheduleMap.get(), EnumVal, Name);
+  return EnumVal;
+}
