summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-28 08:10:48 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-28 08:10:48 +0000
commitf4ebe9ea4f613557f8080873c3001e49b7aac8c4 (patch)
treef99dc16065e202a9b21bfa7ce3af60e99430138a /clang/lib
parent3cffa471d95042045c6180d39340ec597bbc7747 (diff)
downloadbcm5719-llvm-f4ebe9ea4f613557f8080873c3001e49b7aac8c4.tar.gz
bcm5719-llvm-f4ebe9ea4f613557f8080873c3001e49b7aac8c4.zip
Handle unnamed bitfields when parsing C++ classes.
llvm-svn: 52855
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp56
1 files changed, 30 insertions, 26 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 718cea95864..c84b5e7de6e 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -412,38 +412,41 @@ Parser::DeclTy *Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) {
}
}
- // Parse the first declarator.
Declarator DeclaratorInfo(DS, Declarator::MemberContext);
- ParseDeclarator(DeclaratorInfo);
- // Error parsing the declarator?
- if (DeclaratorInfo.getIdentifier() == 0) {
- // If so, skip until the semi-colon or a }.
- SkipUntil(tok::r_brace, true);
- if (Tok.is(tok::semi))
- ConsumeToken();
- return 0;
- }
- // function-definition:
- if (Tok.is(tok::l_brace)) {
- if (!DeclaratorInfo.isFunctionDeclarator()) {
- Diag(Tok, diag::err_func_def_no_params);
- ConsumeBrace();
+ if (Tok.isNot(tok::colon)) {
+ // Parse the first declarator.
+ ParseDeclarator(DeclaratorInfo);
+ // Error parsing the declarator?
+ if (DeclaratorInfo.getIdentifier() == 0) {
+ // If so, skip until the semi-colon or a }.
SkipUntil(tok::r_brace, true);
+ if (Tok.is(tok::semi))
+ ConsumeToken();
return 0;
}
- if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
- Diag(Tok, diag::err_function_declared_typedef);
- // This recovery skips the entire function body. It would be nice
- // to simply call ParseCXXInlineMethodDef() below, however Sema
- // assumes the declarator represents a function, not a typedef.
- ConsumeBrace();
- SkipUntil(tok::r_brace, true);
- return 0;
- }
+ // function-definition:
+ if (Tok.is(tok::l_brace)) {
+ if (!DeclaratorInfo.isFunctionDeclarator()) {
+ Diag(Tok, diag::err_func_def_no_params);
+ ConsumeBrace();
+ SkipUntil(tok::r_brace, true);
+ return 0;
+ }
+
+ if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
+ Diag(Tok, diag::err_function_declared_typedef);
+ // This recovery skips the entire function body. It would be nice
+ // to simply call ParseCXXInlineMethodDef() below, however Sema
+ // assumes the declarator represents a function, not a typedef.
+ ConsumeBrace();
+ SkipUntil(tok::r_brace, true);
+ return 0;
+ }
- return ParseCXXInlineMethodDef(AS, DeclaratorInfo);
+ return ParseCXXInlineMethodDef(AS, DeclaratorInfo);
+ }
}
// member-declarator-list:
@@ -510,7 +513,8 @@ Parser::DeclTy *Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) {
if (Tok.is(tok::kw___attribute))
DeclaratorInfo.AddAttributes(ParseAttributes());
- ParseDeclarator(DeclaratorInfo);
+ if (Tok.isNot(tok::colon))
+ ParseDeclarator(DeclaratorInfo);
}
if (Tok.is(tok::semi)) {
OpenPOWER on IntegriCloud