diff options
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 8a0dcce31c..65f1124e63 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -519,7 +519,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) { 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 @@ bool Parser::ParseTag(DeclTy *&Decl, unsigned TagType, SourceLocation StartLoc){ 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 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, // 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)); |