This patch is just the easy part of the class names patch, which
allows the parsing of "class" in addition to "struct" and "union" to
declare a record.  So this patch allows:

 class C { };
 class C c1;

But it does not contain the lookup bits, so this won't work yet:

 C c2;

Patch by Doug Gregor!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49613 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/DeclSpec.cpp b/lib/Parse/DeclSpec.cpp
index 1cd3508..52c6a33 100644
--- a/lib/Parse/DeclSpec.cpp
+++ b/lib/Parse/DeclSpec.cpp
@@ -95,6 +95,7 @@
   case DeclSpec::TST_decimal64:   return "_Decimal64";
   case DeclSpec::TST_decimal128:  return "_Decimal128";
   case DeclSpec::TST_enum:        return "enum";
+  case DeclSpec::TST_class:       return "class";
   case DeclSpec::TST_union:       return "union";
   case DeclSpec::TST_struct:      return "struct";
   case DeclSpec::TST_typedef:     return "typedef";
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 7eeb64d..8a0dcce 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -515,7 +515,8 @@
     case tok::kw__Decimal128:
       isInvalid = DS.SetTypeSpecType(DeclSpec::TST_decimal128, Loc, PrevSpec);
       break;
-      
+
+    case tok::kw_class:
     case tok::kw_struct:
     case tok::kw_union:
       ParseStructUnionSpecifier(DS);
@@ -620,9 +621,12 @@
 ///         'union'
 ///
 void Parser::ParseStructUnionSpecifier(DeclSpec &DS) {
-  assert((Tok.is(tok::kw_struct) || Tok.is(tok::kw_union)) &&
-         "Not a struct/union specifier");
+  assert((Tok.is(tok::kw_class) || 
+          Tok.is(tok::kw_struct) || 
+          Tok.is(tok::kw_union)) &&
+         "Not a class/struct/union specifier");
   DeclSpec::TST TagType =
+    Tok.is(tok::kw_class) ? DeclSpec::TST_class :
     Tok.is(tok::kw_union) ? DeclSpec::TST_union : DeclSpec::TST_struct;
   SourceLocation StartLoc = ConsumeToken();
 
@@ -923,7 +927,8 @@
   case tok::kw__Decimal64:
   case tok::kw__Decimal128:
     
-    // struct-or-union-specifier
+    // struct-or-union-specifier (C99) or class-specifier (C++)
+  case tok::kw_class:
   case tok::kw_struct:
   case tok::kw_union:
     // enum-specifier
@@ -973,7 +978,8 @@
   case tok::kw__Decimal64:
   case tok::kw__Decimal128:
   
-    // struct-or-union-specifier
+    // struct-or-union-specifier (C99) or class-specifier (C++)
+  case tok::kw_class:
   case tok::kw_struct:
   case tok::kw_union:
     // enum-specifier