Index: include/clang/Basic/OpenMP.h
===================================================================
--- include/clang/Basic/OpenMP.h	(revision 0)
+++ include/clang/Basic/OpenMP.h	(revision 0)
@@ -0,0 +1,114 @@
+//===----------------------- 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 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,139 @@
+//===----------------- 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 string map tables and support functions. 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 string map tables to parse these OpenMP
+// names.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Basic/OpenMP.h"
+#include "llvm/ADT/OwningPtr.h"
+#include <cassert>
+using namespace clang;
+
+/// \brief ClauseMapTable - A string map table which holds enum kinds
+/// associated with different OpenMP *clause* names.
+/// Note that we *initialize* string map table in a *sorted* order so that
+/// *binary search* algorithm can be performed on it.
+static const struct Clause {
+  const char* Name;
+  enum omp::ClauseKind Kind;
+} ClauseMapTable[omp::c_end] = {
+                    { "capture", omp::c_capture },
+                    { "collapse", omp::c_collapse }, 
+                    { "copyin", omp::c_copyin }, 
+                    { "copyprivate", omp::c_copyprivate }, 
+                    { "default", omp::c_default }, 
+                    { "final", omp::c_final },
+                    { "firstprivate", omp::c_firstprivate }, 
+                    { "if", omp::c_if }, 
+                    { "lastprivate", omp::c_lastprivate },
+                    { "mergeable", omp::c_mergeable },
+                    { "nowait", omp::c_nowait }, 
+                    { "num_threads", omp::c_numthreads },
+                    { "ordered", omp::c_ordered },
+                    { "priavte", omp::c_private },
+                    { "read", omp::c_read },
+                    { "reduction", omp::c_reduction },
+                    { "schedule", omp::c_schedule },
+                    { "shared", omp::c_shared }, 
+                    { "untied", omp::c_untied }, 
+                    { "update", omp::c_update },
+                    { "write", omp::c_write }
+                  };
+
+/// \brief DefaultMapTable - A string map table which holds enum kinds
+/// associated with different OpenMP *default clause kind* names.
+/// Note that we *initialize* string map table in a *sorted* order so that
+/// *binary search* algorithm can be performed on it.
+static const struct Default {
+  const char* Name;
+  enum omp::DefaultKind Kind;
+} DefaultMapTable[omp::d_end] = {
+                    { "none", omp::d_none },
+                    { "shared", omp::d_shared }
+                  };
+
+/// \brief ScheduleMapTable - A string map table which holds enum kinds
+/// associated with different OpenMP *schedule clause kind* names.
+/// Note that we *initialize* string map table in a *sorted* order so that
+/// *binary search* algorithm can be performed on it.
+static const struct Schedule {
+  const char* Name;
+  enum omp::ScheduleKind Kind;
+} ScheduleMapTable[omp::s_end] = {
+                    { "auto", omp::s_auto },
+                    { "dynamic", omp::s_dynamic },
+                    { "guided", omp::s_guided },
+                    { "runtime", omp::s_runtime },
+                    { "static", omp::s_static },
+                  };
+
+/// BinarySearch - An internal parameterized *binary* serach routine which
+/// searches for a given key string name in the string map table. On a
+/// successful search, it returns an OpenMP enum value kind which is
+/// associated with the search string name. Note that we implement a simple
+/// binary search algorithm as the string tables to be searched are smaller
+/// in size.
+template<class TableType, class EnumType>
+void BinarySearch(TableType Table, const unsigned TableSize, StringRef Name,
+                  EnumType &EnumVal) {
+  assert((TableSize > 0) && "Invalid search table size");
+
+  unsigned First = 0;
+  unsigned Last = TableSize - 1;
+  unsigned Middle;
+
+  while (First <= Last) {
+    Middle = (First+Last)/2;
+    int Res = Name.compare(Table[Middle].Name);
+    if (Res == 0) {
+      EnumVal = Table[Middle].Kind;
+      return;
+    } else if(Res < 0) {
+      Last = Middle - 1;
+    } else {
+      First = Middle + 1;
+    }
+  }
+} 
+
+/// \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;
+  BinarySearch(ClauseMapTable, omp::c_end, Name, EnumVal);
+  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;
+  BinarySearch(DefaultMapTable, omp::d_end, Name, EnumVal);
+  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;
+  BinarySearch(ScheduleMapTable, omp::s_end, Name, EnumVal);
+  return EnumVal;
+}
