Before:
auto x = (X) this;
After:
auto x = (X)this;
This fixes llvm.org/PR27198.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265385
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!LeftOfParens)
return false;
- // If the following token is an identifier, this is a cast. All cases where
- // this can be something else are handled above.
- if (Tok.Next->is(tok::identifier))
+ // If the following token is an identifier or 'this', this is a cast. All
+ // cases where this can be something else are handled above.
+ if (Tok.Next->isOneOf(tok::identifier, tok::kw_this))
return true;
if (!Tok.Next->Next)
verifyFormat("my_int a = (my_int)(my_int)-1;");
verifyFormat("my_int a = (ns::my_int)-2;");
verifyFormat("case (my_int)ONE:");
+ verifyFormat("auto x = (X)this;");
// FIXME: single value wrapped with paren will be treated as cast.
verifyFormat("void f(int i = (kValue)*kMask) {}");