r223162 - Diagnose TypoExprs in a couple of error cases in ParsePostfixExpressionSuffix.
Kaelyn Takata
rikka at google.com
Tue Dec 2 14:05:35 PST 2014
Author: rikka
Date: Tue Dec 2 16:05:35 2014
New Revision: 223162
URL: http://llvm.org/viewvc/llvm-project?rev=223162&view=rev
Log:
Diagnose TypoExprs in a couple of error cases in ParsePostfixExpressionSuffix.
Also have CorrectDelayedTyposInExpr check that the Expr* isn't null
before trying to access its members. Fixes PR21679.
Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=223162&r1=223161&r2=223162&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Tue Dec 2 16:05:35 2014
@@ -1364,8 +1364,10 @@ Parser::ParsePostfixExpressionSuffix(Exp
if (!LHS.isInvalid() && !Idx.isInvalid() && Tok.is(tok::r_square)) {
LHS = Actions.ActOnArraySubscriptExpr(getCurScope(), LHS.get(), Loc,
Idx.get(), RLoc);
- } else
+ } else {
+ (void)Actions.CorrectDelayedTyposInExpr(LHS);
LHS = ExprError();
+ }
// Match the ']'.
T.consumeClose();
@@ -1536,8 +1538,10 @@ Parser::ParsePostfixExpressionSuffix(Exp
/*AllowDestructorName=*/true,
/*AllowConstructorName=*/
getLangOpts().MicrosoftExt,
- ObjectType, TemplateKWLoc, Name))
+ ObjectType, TemplateKWLoc, Name)) {
+ (void)Actions.CorrectDelayedTyposInExpr(LHS);
LHS = ExprError();
+ }
if (!LHS.isInvalid())
LHS = Actions.ActOnMemberAccessExpr(getCurScope(), LHS.get(), OpLoc,
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=223162&r1=223161&r2=223162&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Dec 2 16:05:35 2014
@@ -6196,7 +6196,7 @@ ExprResult Sema::CorrectDelayedTyposInEx
// If the current evaluation context indicates there are uncorrected typos
// and the current expression isn't guaranteed to not have typos, try to
// resolve any TypoExpr nodes that might be in the expression.
- if (!ExprEvalContexts.empty() && ExprEvalContexts.back().NumTypos &&
+ if (E && !ExprEvalContexts.empty() && ExprEvalContexts.back().NumTypos &&
(E->isTypeDependent() || E->isValueDependent() ||
E->isInstantiationDependent())) {
auto TyposResolved = DelayedTypos.size();
More information about the cfe-commits
mailing list