summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-02-19 07:15:33 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-02-19 07:15:33 +0000
commitc919f5f96459f5ca9ec3a8e902e3451eeae9648a (patch)
tree48258da2aa500354b4627d4f67863c486ff43156 /clang/lib/Parse/ParseExpr.cpp
parent5eeb41c173738cbde5b2b9df3301b558207b9271 (diff)
downloadbcm5719-llvm-c919f5f96459f5ca9ec3a8e902e3451eeae9648a.tar.gz
bcm5719-llvm-c919f5f96459f5ca9ec3a8e902e3451eeae9648a.zip
Correct typos after acting on invalid subscript expressions
llvm-svn: 261312
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r--clang/lib/Parse/ParseExpr.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 32262f433d1..07f750550ea 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -1434,8 +1434,10 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
// Reject array indices starting with a lambda-expression. '[[' is
// reserved for attributes.
- if (CheckProhibitedCXX11Attribute())
+ if (CheckProhibitedCXX11Attribute()) {
+ (void)Actions.CorrectDelayedTyposInExpr(LHS);
return ExprError();
+ }
BalancedDelimiterTracker T(*this, tok::l_square);
T.consumeOpen();
@@ -1463,6 +1465,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
SourceLocation RLoc = Tok.getLocation();
+ ExprResult OrigLHS = LHS;
if (!LHS.isInvalid() && !Idx.isInvalid() && !Length.isInvalid() &&
Tok.is(tok::r_square)) {
if (ColonLoc.isValid()) {
@@ -1473,7 +1476,10 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
Idx.get(), RLoc);
}
} else {
- (void)Actions.CorrectDelayedTyposInExpr(LHS);
+ LHS = ExprError();
+ }
+ if (LHS.isInvalid()) {
+ (void)Actions.CorrectDelayedTyposInExpr(OrigLHS);
(void)Actions.CorrectDelayedTyposInExpr(Idx);
(void)Actions.CorrectDelayedTyposInExpr(Length);
LHS = ExprError();
OpenPOWER on IntegriCloud