[PATCH] D145642: [clang-format] Annotate lambdas with requires clauses.
Emilia Dreamer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 23 10:27:31 PDT 2023
rymiel added a comment.
So, it took me a while but I finally found where the logic is that makes the lambda braces stay on one line, but, now I'm not so sure if I should change it:
The thing I wanted to avoid was cases like
[&]<typename T>(T&& t)
requires T
{ t; };
Simply because "those braces don't really look nice", but it turns out there's a sort of "prior precedent" for this:
For example, FormatTest.cpp line 22046, LambdaWithLineComments:
verifyFormat("auto k = []() // X\n"
"{ return; }",
LLVMWithBeforeLambdaBody);
verifyFormat(
"auto k = []() // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n"
"{ return; }",
LLVMWithBeforeLambdaBody);
(this is with combination of BraceWrapping.BeforeLambdaBody = true and AllowShortLambdaOnASingleLine)
(+ a change in C# which I would like to avoid touching since I exclusively do C++)
So, I guess I have the following choices:
1. do nothing! (allow those braces to stay on one line)
2. change the behavior of those existing tests, with whatever impact that has
3. make a //very specific// exception for just requires-clauses
(+ maybe other compromise options, i.e. making it configurable or something)
@owenpan do you perhaps have insight for this?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145642/new/
https://reviews.llvm.org/D145642
More information about the cfe-commits
mailing list