[PATCH] D140339: [clang-format] Remove special logic for parsing concept definitions.

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 19 13:32:05 PST 2022


HazardyKnusperkeks added a comment.

I'm shocked and impressed, that it just works.



================
Comment at: clang/lib/Format/TokenAnnotator.cpp:1683
 
-        if (Tok->isOneOf(tok::kw_class, tok::kw_enum, tok::kw_concept,
-                         tok::kw_struct, tok::kw_using)) {
+        if (Tok->isOneOf(tok::kw_class, tok::kw_enum, tok::kw_struct,
+                         tok::kw_using)) {
----------------
Does this change anything, besides the penalties and by that the wrapping?

While I can live with both, I think we should not format code differently, if it's not by a bugfix.


================
Comment at: clang/unittests/Format/FormatTest.cpp:23940
   // assert.
-  verifyFormat("template <typename T>\n"
-               "concept C = requires C2<T>;");
-
-  verifyFormat("template <typename T>\n"
-               "concept C = 5 + 4;");
-
   verifyFormat("template <typename T>\n"
                "concept C =\n"
----------------
As I have learned in other changes, we have `verifyNoCrash` (or similar), this is what should be used. Didn't know about it back then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140339



More information about the cfe-commits mailing list