@@ -1801,20 +1801,13 @@ auto Parser::parse_postfix_expression(ExpressionAST*& yyast,
18011801
18021802auto Parser::parse_start_of_postfix_expression (ExpressionAST*& yyast,
18031803 const ExprContext& ctx) -> bool {
1804- if (parse_va_arg_expression (yyast, ctx))
1805- return true ;
1806- else if (parse_cpp_cast_expression (yyast, ctx))
1807- return true ;
1808- else if (parse_typeid_expression (yyast, ctx))
1809- return true ;
1810- else if (parse_typename_expression (yyast, ctx))
1811- return true ;
1812- else if (parse_cpp_type_cast_expression (yyast, ctx))
1813- return true ;
1814- else if (parse_builtin_bit_cast_expression (yyast, ctx))
1815- return true ;
1816- else
1817- return parse_primary_expression (yyast, ctx);
1804+ if (parse_va_arg_expression (yyast, ctx)) return true ;
1805+ if (parse_cpp_cast_expression (yyast, ctx)) return true ;
1806+ if (parse_typeid_expression (yyast, ctx)) return true ;
1807+ if (parse_typename_expression (yyast, ctx)) return true ;
1808+ if (parse_cpp_type_cast_expression (yyast, ctx)) return true ;
1809+ if (parse_builtin_bit_cast_expression (yyast, ctx)) return true ;
1810+ return parse_primary_expression (yyast, ctx);
18181811}
18191812
18201813auto Parser::parse_member_expression (ExpressionAST*& yyast) -> bool {
@@ -1842,6 +1835,8 @@ auto Parser::parse_member_expression(ExpressionAST*& yyast) -> bool {
18421835 ast->splicer = splicer;
18431836 yyast = ast;
18441837
1838+ check (ast);
1839+
18451840 return true ;
18461841 };
18471842
@@ -2068,6 +2063,8 @@ auto Parser::parse_cpp_type_cast_expression(ExpressionAST*& yyast,
20682063 ast->typeSpecifier = typeSpecifier;
20692064 ast->bracedInitList = bracedInitList;
20702065
2066+ check (ast);
2067+
20712068 return true ;
20722069 };
20732070
@@ -2344,6 +2341,8 @@ auto Parser::parse_complex_expression(ExpressionAST*& yyast,
23442341 ast->op = unit->tokenKind (opLoc);
23452342 ast->expression = expression;
23462343
2344+ check (ast);
2345+
23472346 return true ;
23482347}
23492348
@@ -2353,9 +2352,8 @@ auto Parser::parse_sizeof_expression(ExpressionAST*& yyast,
23532352
23542353 if (!match (TokenKind::T_SIZEOF, sizeofLoc)) return false ;
23552354
2356- SourceLocation ellipsisLoc;
2357-
2358- if (match (TokenKind::T_DOT_DOT_DOT, ellipsisLoc)) {
2355+ if (SourceLocation ellipsisLoc;
2356+ match (TokenKind::T_DOT_DOT_DOT, ellipsisLoc)) {
23592357 auto ast = make_node<SizeofPackExpressionAST>(pool_);
23602358 yyast = ast;
23612359
@@ -2369,7 +2367,7 @@ auto Parser::parse_sizeof_expression(ExpressionAST*& yyast,
23692367
23702368 expect (TokenKind::T_RPAREN, ast->rparenLoc );
23712369
2372- ast-> type = control_-> getSizeType ( );
2370+ check (ast );
23732371
23742372 return true ;
23752373 }
@@ -2395,7 +2393,8 @@ auto Parser::parse_sizeof_expression(ExpressionAST*& yyast,
23952393 ast->lparenLoc = lparenLoc;
23962394 ast->typeId = typeId;
23972395 ast->rparenLoc = rparenLoc;
2398- ast->type = control_->getSizeType ();
2396+
2397+ check (ast);
23992398
24002399 return true ;
24012400 };
@@ -2860,29 +2859,28 @@ auto Parser::parse_conditional_expression(ExpressionAST*& yyast,
28602859 if (!parse_logical_or_expression (yyast, exprContext)) return false ;
28612860
28622861 SourceLocation questionLoc;
2862+ if (!match (TokenKind::T_QUESTION, questionLoc)) return true ;
28632863
2864- if (match (TokenKind::T_QUESTION, questionLoc)) {
2865- auto ast = make_node<ConditionalExpressionAST>(pool_);
2866- ast->condition = yyast;
2867- ast->questionLoc = questionLoc;
2864+ auto ast = make_node<ConditionalExpressionAST>(pool_);
2865+ ast->condition = yyast;
2866+ ast->questionLoc = questionLoc;
28682867
2869- yyast = ast;
2868+ yyast = ast;
28702869
2871- parse_expression (ast->iftrueExpression , exprContext);
2870+ parse_expression (ast->iftrueExpression , exprContext);
28722871
2873- expect (TokenKind::T_COLON, ast->colonLoc );
2872+ expect (TokenKind::T_COLON, ast->colonLoc );
28742873
2875- if (exprContext.templArg || exprContext.templParam ) {
2876- if (!parse_conditional_expression (ast->iffalseExpression , exprContext)) {
2877- parse_error (" expected an expression" );
2878- }
2879- } else {
2880- parse_assignment_expression (ast->iffalseExpression , exprContext);
2874+ if (exprContext.templArg || exprContext.templParam ) {
2875+ if (!parse_conditional_expression (ast->iffalseExpression , exprContext)) {
2876+ parse_error (" expected an expression" );
28812877 }
2882-
2883- check (ast);
2878+ } else {
2879+ parse_assignment_expression (ast-> iffalseExpression , exprContext );
28842880 }
28852881
2882+ check (ast);
2883+
28862884 return true ;
28872885}
28882886
@@ -3147,6 +3145,7 @@ void Parser::parse_condition(ExpressionAST*& yyast, const ExprContext& ctx) {
31473145
31483146 DeclaratorAST* declarator = nullptr ;
31493147 Decl decl{specs};
3148+
31503149 if (!parse_declarator (declarator, decl)) return false ;
31513150
31523151 auto symbol = binder_.declareVariable (declarator, decl);
0 commit comments