[PATCH] D119138: [clang-format] Further improve support for requires expressions

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 26 13:23:40 PST 2022


HazardyKnusperkeks added a comment.

In D119138#3951850 <https://reviews.llvm.org/D119138#3951850>, @klimek wrote:

> I changed it in 49aca00d63e14df8bc68fc4329e6cbc9c9805eb8 <https://reviews.llvm.org/rG49aca00d63e14df8bc68fc4329e6cbc9c9805eb8>.
>
> "We" is the people working on clang-format :) I hope that we have a common goal of making clang-format as easy to maintain as we can.
>
> FWIW, I once had the same opinion as you about best doing all parsing as early as possible, but djasper convinced me that the split was a good idea, and in the end, I think it turns out to be significantly less brittle to do more complex annotation in TokenAnnotator. E.g. we now have a lookahead limit of 50, which seems rather arbitrary, while in TokenAnnotator we could simply limit lookahead towards the current UnwrappedLine. Similarly, in TokenAnnotator, we already have all the parens connected, so we could simply look from requires l_paren to the corresponding r_paren and whether the next token is an l_brace. If I can find a bit of time I'll take an attempt at implementing it.

Your commit is in my view a an example of making that maintaining a bit harder, it didn't went through review, had you not posted it here I'd never seen it. LLVM receives to many commits to scan them for changes in clang-format. And as someone who isn't that long involved in clang-format I think there is an overview really missing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119138/new/

https://reviews.llvm.org/D119138



More information about the cfe-commits mailing list