diff options
author | Kaelyn Takata <rikka@google.com> | 2015-05-01 20:59:18 +0000 |
---|---|---|
committer | Kaelyn Takata <rikka@google.com> | 2015-05-01 20:59:18 +0000 |
commit | a8dfd33611f978e3b78e5175ee4b55618ec00c1e (patch) | |
tree | 8393b8f36fa7f0d7189505d12fad9a66743cfafb /clang/lib | |
parent | 9df2fa261b66933cf0f3f8882e5ea0eee9fbc075 (diff) | |
download | bcm5719-llvm-a8dfd33611f978e3b78e5175ee4b55618ec00c1e.tar.gz bcm5719-llvm-a8dfd33611f978e3b78e5175ee4b55618ec00c1e.zip |
Also correct typos in the middle of a ternary expression when the RHS is invalid.
The LHS was already being corrected before being set to ExprError when
the RHS is invalid, but when it was present the middle of a ternary
expression would be dropped in the error paths.
Fixes PR23350.
llvm-svn: 236347
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 5116991c0f7..9e0060be57e 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -347,7 +347,11 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { RHS = ParseCastExpression(false); if (RHS.isInvalid()) { + // FIXME: Errors generated by the delayed typo correction should be + // printed before errors from parsing the RHS, not after. Actions.CorrectDelayedTyposInExpr(LHS); + if (TernaryMiddle.isUsable()) + TernaryMiddle = Actions.CorrectDelayedTyposInExpr(TernaryMiddle); LHS = ExprError(); } @@ -380,7 +384,11 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { RHSIsInitList = false; if (RHS.isInvalid()) { + // FIXME: Errors generated by the delayed typo correction should be + // printed before errors from ParseRHSOfBinaryExpression, not after. Actions.CorrectDelayedTyposInExpr(LHS); + if (TernaryMiddle.isUsable()) + TernaryMiddle = Actions.CorrectDelayedTyposInExpr(TernaryMiddle); LHS = ExprError(); } |