From: Chris Lattner Date: Thu, 30 Aug 2007 15:52:49 +0000 (+0000) Subject: make sure to parse postfix expression suffixes after builtin X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6eb2109ba3f9e2d266f8aaa52846c24121298145;p=clang make sure to parse postfix expression suffixes after builtin primary expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41607 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Parse/ParseExpr.cpp b/Parse/ParseExpr.cpp index 87971588db..ff2af565fa 100644 --- a/Parse/ParseExpr.cpp +++ b/Parse/ParseExpr.cpp @@ -771,6 +771,8 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() { return ExprResult(true); ParseTypeName(); + + MatchRHSPunctuation(tok::r_paren, LParenLoc); break; case tok::kw___builtin_offsetof: { @@ -824,8 +826,9 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() { Comps.back().LocEnd = MatchRHSPunctuation(tok::r_square, Comps.back().LocStart); } else if (Tok.getKind() == tok::r_paren) { - return Actions.ParseBuiltinOffsetOf(StartLoc, Ty, &Comps[0], - Comps.size(), ConsumeParen()); + Res = Actions.ParseBuiltinOffsetOf(StartLoc, Ty, &Comps[0], + Comps.size(), ConsumeParen()); + break; } else { // Error occurred. return ExprResult(true); @@ -859,8 +862,9 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() { Diag(Tok, diag::err_expected_rparen); return ExprResult(true); } - return Actions.ParseChooseExpr(StartLoc, Cond.Val, Expr1.Val, Expr2.Val, - ConsumeParen()); + Res = Actions.ParseChooseExpr(StartLoc, Cond.Val, Expr1.Val, Expr2.Val, + ConsumeParen()); + break; } case tok::kw___builtin_types_compatible_p: TypeTy *Ty1 = ParseTypeName(); @@ -874,11 +878,10 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() { Diag(Tok, diag::err_expected_rparen); return ExprResult(true); } - return Actions.ParseTypesCompatibleExpr(StartLoc, Ty1, Ty2, ConsumeParen()); + Res = Actions.ParseTypesCompatibleExpr(StartLoc, Ty1, Ty2, ConsumeParen()); + break; } - MatchRHSPunctuation(tok::r_paren, LParenLoc); - // These can be followed by postfix-expr pieces because they are // primary-expressions. return ParsePostfixExpressionSuffix(Res);