[PATCH] D117398: [clang-format] Fix bug in parsing `operator<` with template
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 18 01:23:34 PST 2022
owenpan added inline comments.
================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:433-446
bool FourthTokenIsLess = false;
- if (Tokens.size() > 3)
- FourthTokenIsLess = (Tokens.end() - 4)[0]->is(tok::less);
- auto First = Tokens.end() - 3;
+ if (Tokens.size() > 3) {
+ auto Fourth = (Tokens.end() - 4)[0];
+ FourthTokenIsLess = Fourth->is(tok::less);
+
+ // Do not remove a whitespace between the two "<" e.g. "operator< <>".
----------------
curdeius wrote:
> I hate the naming here.
> Unless I'm mistaken we have: Fourth, First + 0, First + 1, First + 2.
> But I'll clean it up at some time.
Me too. Maybe changing `First` to point at `Fourth` and get rid of `Fourth`, which has a different level of indirection than `First` now. I would probably get rid of `FourthTokenIsLess` as well.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117398/new/
https://reviews.llvm.org/D117398
More information about the cfe-commits
mailing list