From 007d76aadabe93d46394796dd2ad85aa667178b3 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen <erik.verbruggen@nokia.com> Date: Fri, 22 Jan 2010 09:44:40 +0100 Subject: [PATCH] Fixed bug in ObjC class field parsing which could result in an invalid pointer in the AST. --- src/shared/cplusplus/Parser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index c906a123f87..69ff99708f6 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -5142,8 +5142,6 @@ bool Parser::parseObjCPropertyDeclaration(DeclarationAST *&node, SpecifierListAS if (!parseObjCPropertyAttribute(last->value)) { _translationUnit->error(_tokenIndex, "expected token `%s' got `%s'", Token::name(T_IDENTIFIER), tok().spell()); - while (LA() != T_RPAREN) - consumeToken(); break; } } @@ -5152,9 +5150,11 @@ bool Parser::parseObjCPropertyDeclaration(DeclarationAST *&node, SpecifierListAS match(T_RPAREN, &(ast->rparen_token)); } - parseSimpleDeclaration(ast->simple_declaration, /*accept-struct-declarators = */ true); + if (parseSimpleDeclaration(ast->simple_declaration, /*accept-struct-declarators = */ true)) + node = ast; + else + _translationUnit->error(_tokenIndex, "expected a simple declaration"); - node = ast; return true; } -- GitLab