[PATCH] D117759: [clang-format][NFC] Clean up tryMergeLessLess()
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 20 03:17:15 PST 2022
owenpan requested review of this revision.
owenpan marked an inline comment as done.
owenpan added inline comments.
================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:440-441
- if (First[2]->is(tok::less) || First[1]->isNot(tok::less) ||
- First[0]->isNot(tok::less) || FourthTokenIsLess)
+ if (Y->is(tok::less) || First[1]->isNot(tok::less) ||
+ First[0]->isNot(tok::less) || (X && X->is(tok::less)))
return false;
----------------
curdeius wrote:
> To go a bit further, could we move `First[1]->isNot(tok::less) || First[0]->isNot(tok::less)` into its own `if` around the top of the function?
> Sth like:
> ```
> if (Tokens.size() < 3)
> return false;
>
> auto First = Tokens.end() - 3;
> if (First[0]->isNot(tok::less) || First[1]->isNot(tok::less))
> return false;
> ```
> ?
Good idea.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117759/new/
https://reviews.llvm.org/D117759
More information about the cfe-commits
mailing list