diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-02-18 06:37:44 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-02-18 06:37:44 +0000 |
commit | ad0288b56de419ec4c87618ce2f6d19c40d56b48 (patch) | |
tree | b237ebb70f97c8a1908e6129ed73749ef1df16e1 /lib/Parse/ParseExpr.cpp | |
parent | c6c456a2719077ef603f75fe1f180b88ca43735a (diff) | |
download | clang-ad0288b56de419ec4c87618ce2f6d19c40d56b48.tar.gz |
[Parse] Make sure we don't forget to diagnose typos in exprs
If ActOn*Op fails, we will forget to diagnose typos in the LHS of
expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261191 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExpr.cpp')
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 82f3685694..32262f433d 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -431,6 +431,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { } } + ExprResult OrigLHS = LHS; if (!LHS.isInvalid()) { // Combine the LHS and RHS into the LHS (e.g. build AST). if (TernaryMiddle.isInvalid()) { @@ -445,12 +446,15 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { LHS = Actions.ActOnBinOp(getCurScope(), OpToken.getLocation(), OpToken.getKind(), LHS.get(), RHS.get()); - } else + } else { LHS = Actions.ActOnConditionalOp(OpToken.getLocation(), ColonLoc, LHS.get(), TernaryMiddle.get(), RHS.get()); - } else { - // Ensure potential typos aren't left undiagnosed. + } + } + // Ensure potential typos aren't left undiagnosed. + if (LHS.isInvalid()) { + Actions.CorrectDelayedTyposInExpr(OrigLHS); Actions.CorrectDelayedTyposInExpr(TernaryMiddle); Actions.CorrectDelayedTyposInExpr(RHS); } |