[PATCH] D113369: [clang-format] Extend SpaceBeforeParens for requires

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 4 08:20:35 PST 2021


Quuxplusone added inline comments.


================
Comment at: clang/docs/ClangFormatStyleOptions.rst:3756
+  * ``bool AfterRequiresClause`` If ``true``, put space between requires keyword in a requires clause and
+    opening parentheses, if is are one.
+
----------------
HazardyKnusperkeks wrote:
> Quuxplusone wrote:
> > HazardyKnusperkeks wrote:
> > > curdeius wrote:
> > > > You meant "if there is one", right?
> > > Yeah
> > IMO these options should be named `InRequiresClause` and `InRequiresExpression`: that's where the space is going. The space doesn't go //after// the requires-clause. The space doesn't go //after// the requires-expression.
> > It occurs to me that the name of this option could be analogous to the name of the option that controls `[]() {}` versus `[] () {}`... except that it looks like there is no such option (and I'm happy about that). :) Also, the name of that option would probably just be `AfterCaptureList`, which doesn't help us in this case.
> I get your point, but the space does not go anywhere in the clause/expression, so `AfterRequiresForClauses`?
(I'd avoid the word `For`, because of keyword `for`.)
A //requires-expression// is the whole expression, `requires + param-list + body`: https://eel.is/c++draft/expr.prim.req#nt:requires-expression
A //requires-clause// is the whole clause, `requires + logical-or-expr`: https://eel.is/c++draft/temp.pre#nt:requires-clause
Does that resolve your concern about the word `In`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113369



More information about the cfe-commits mailing list