From b8499f09faa1cf1e0a941f089974b86c345025ac Mon Sep 17 00:00:00 2001 From: Kaelyn Takata Date: Tue, 5 May 2015 19:17:03 +0000 Subject: Allow TransformTypos to ignore corrections to a specified VarDecl. This is needed to prevent a TypoExpr from being corrected to a variable when the TypoExpr is a subexpression of that variable's initializer. Also exclude more keywords from the correction candidate pool when the subsequent token is .* or ->* since keywords like "new" or "return" aren't valid on the left side of those operators. Fixes PR23140. llvm-svn: 236519 --- clang/lib/Parse/ParseExpr.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'clang/lib/Parse/ParseExpr.cpp') diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 527351012d9..95a28a8d5a1 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -931,7 +931,12 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, auto Validator = llvm::make_unique( Tok, isTypeCast != NotTypeCast, isTypeCast != IsTypeCast); Validator->IsAddressOfOperand = isAddressOfOperand; - Validator->WantRemainingKeywords = Tok.isNot(tok::r_paren); + if (Tok.is(tok::periodstar) || Tok.is(tok::arrowstar)) { + Validator->WantExpressionKeywords = false; + Validator->WantRemainingKeywords = false; + } else { + Validator->WantRemainingKeywords = Tok.isNot(tok::r_paren); + } Name.setIdentifier(&II, ILoc); Res = Actions.ActOnIdExpression( getCurScope(), ScopeSpec, TemplateKWLoc, Name, Tok.is(tok::l_paren), -- cgit v1.2.3