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 8797158..ff2af56 100644
--- a/Parse/ParseExpr.cpp
+++ b/Parse/ParseExpr.cpp
@@ -771,6 +771,8 @@
return ExprResult(true);
ParseTypeName();
+
+ MatchRHSPunctuation(tok::r_paren, LParenLoc);
break;
case tok::kw___builtin_offsetof: {
@@ -824,8 +826,9 @@
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 @@
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 @@
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);