aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-30 22:23:08 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-30 22:23:08 +0000
commitbd6c76fd53e3674d5bbfefe471e2ae657ce69d0c (patch)
treed3ade1225866531dca7104675d56fdb90aef2245 /lib/Parse/ParseExpr.cpp
parentc2b9b367b9fd9ca200de4cacf3c3539bc7fafede (diff)
Improve parser recovery when we try to parse a call expression but the
called function itself is invalid (e.g., because of a semantic error referring to that declaration). Fixes <rdar://problem/8044142>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105175 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExpr.cpp')
-rw-r--r--lib/Parse/ParseExpr.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 7be1a1994e..8fb71c3ff6 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -580,7 +580,8 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
Res = ParseParenExpression(ParenExprType, false/*stopIfCastExr*/,
TypeOfCast, CastTy, RParenLoc);
- if (Res.isInvalid()) return move(Res);
+ if (Res.isInvalid())
+ return move(Res);
}
switch (ParenExprType) {
@@ -672,6 +673,7 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
Name.setIdentifier(&II, ILoc);
Res = Actions.ActOnIdExpression(CurScope, ScopeSpec, Name,
Tok.is(tok::l_paren), false);
+
// These can be followed by postfix-expr pieces.
return ParsePostfixExpressionSuffix(move(Res));
}
@@ -981,6 +983,11 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
Loc = ConsumeParen();
+ if (LHS.isInvalid()) {
+ SkipUntil(tok::r_paren);
+ return ExprError();
+ }
+
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteCall(CurScope, LHS.get(), 0, 0);
ConsumeCodeCompletionToken();