[PATCH] D79773: [clang-format] Improve clang-formats handling of concepts

Michael Schellenberger Costa via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 19 23:02:43 PDT 2020


miscco added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2314
+      nextToken();
+      if (FormatTok->Tok.is(tok::less)) {
+        while (!FormatTok->Tok.is(tok::greater)) {
----------------
miscco wrote:
> I guess you could use `parseBracedList(/*ContinueOnSemicolons=*/false, /*IsEnum=*/false,/*ClosingBraceKind=*/tok::greater);` here?
To be more specific, I am concerned what happens if you have multiple template arguments where a linebreak should occur. Is this still happening here?


```
template <typename someLongTypename1, typename someLongTypename2>
concept someVeryLongConceptName = someVeryLongConstraintName1<someLongTypename1 && someLongTypename2>;
```


================
Comment at: clang/unittests/Format/FormatTest.cpp:16319
+  verifyFormat("template <typename T>\n"
+               "concept bool EqualityComparable = requires(T a, T b) {\n"
+               "  { a == b } -> bool;\n"
----------------
I think `concept bool` should just be `concept` occurs below 


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

https://reviews.llvm.org/D79773





More information about the cfe-commits mailing list