diff options
author | Kaelyn Takata <rikka@google.com> | 2015-05-05 19:17:03 +0000 |
---|---|---|
committer | Kaelyn Takata <rikka@google.com> | 2015-05-05 19:17:03 +0000 |
commit | b8499f09faa1cf1e0a941f089974b86c345025ac (patch) | |
tree | 980304ad7d402887735bd4bb60dcc0a7764cfe5a /clang/lib/Parse/ParseExpr.cpp | |
parent | 336d90b61bcc3862ac1fc016834340b6ef79cc4b (diff) | |
download | bcm5719-llvm-b8499f09faa1cf1e0a941f089974b86c345025ac.tar.gz bcm5719-llvm-b8499f09faa1cf1e0a941f089974b86c345025ac.zip |
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
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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<CastExpressionIdValidator>( 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), |