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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 20 02:40:13 PDT 2020


MyDeveloperDay planned changes to this revision.
MyDeveloperDay marked 3 inline comments as done.
MyDeveloperDay added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:1566
       Current.Type = TT_TrailingReturnArrow;
-
+    } else if (Current.is(tok::arrow) && Current.Previous &&
+               Current.Previous->is(tok::r_brace)) {
----------------
miscco wrote:
> MyDeveloperDay wrote:
> > miscco wrote:
> > > Should that really be `tok::arrow` and not `tok::kw_requires`?
> > This is to prevent the breaking between } and -> in the following (which could be some way from the requires
> > 
> > `{ t.foo(u) } -> typename T::foo_type;`
> I believe this should carry some state that we are inside of an requires-expression. 
I'm not sure how possible that is as its dealt with in terms of normal parseBlock() handling so there might not be a possiblity to label the -> (which is actually what I'm just doing here) the other rules regarding TT_TrailingReturnArrow will ensure its doesn't get broken and there is spaces around it.


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

https://reviews.llvm.org/D79773





More information about the cfe-commits mailing list