This patch adds very basic support for parsing and type-checking class
inheritance in C++. It'll parse the base-specifier list, e.g.,

 class D : public B1, virtual public B2 { };

and do some of the simpler semantic checks (B1 and B2 are classes;
they aren't unions or incomplete types, etc).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49623 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 8a0dcce..65f1124 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -519,7 +519,7 @@
     case tok::kw_class:
     case tok::kw_struct:
     case tok::kw_union:
-      ParseStructUnionSpecifier(DS);
+      ParseClassSpecifier(DS);
       continue;
     case tok::kw_enum:
       ParseEnumSpecifier(DS);
@@ -608,42 +608,6 @@
   return false;
 }
 
-
-/// ParseStructUnionSpecifier
-///       struct-or-union-specifier: [C99 6.7.2.1]
-///         struct-or-union identifier[opt] '{' struct-contents '}'
-///         struct-or-union identifier
-/// [GNU]   struct-or-union attributes[opt] identifier[opt] '{' struct-contents
-///                                                         '}' attributes[opt]
-/// [GNU]   struct-or-union attributes[opt] identifier
-///       struct-or-union:
-///         'struct'
-///         'union'
-///
-void Parser::ParseStructUnionSpecifier(DeclSpec &DS) {
-  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();
-
-  // Parse the tag portion of this.
-  DeclTy *TagDecl;
-  if (ParseTag(TagDecl, TagType, StartLoc))
-    return;
-  
-  // If there is a body, parse it and inform the actions module.
-  if (Tok.is(tok::l_brace))
-    ParseStructUnionBody(StartLoc, TagType, TagDecl);
-
-  const char *PrevSpec = 0;
-  if (DS.SetTypeSpecType(TagType, StartLoc, PrevSpec, TagDecl))
-    Diag(StartLoc, diag::err_invalid_decl_spec_combination, PrevSpec);
-}
-
 /// ParseStructDeclaration - Parse a struct declaration without the terminating
 /// semicolon.
 ///
@@ -736,7 +700,7 @@
   
   // Empty structs are an extension in C (C99 6.7.2.1p7), but are allowed in
   // C++.
-  if (Tok.is(tok::r_brace))
+  if (Tok.is(tok::r_brace) && !getLang().CPlusPlus)
     Diag(Tok, diag::ext_empty_struct_union_enum, 
          DeclSpec::getSpecifierName((DeclSpec::TST)TagType));