[PATCH] D58934: [clang-format] Fix lambdas returning template specialization that contains operator in parameter

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 23:51:48 PST 2019


MyDeveloperDay accepted this revision.
MyDeveloperDay added a comment.
This revision is now accepted and ready to land.

I'm not sure I personally would ever write code like that ;-) , but if its legal C++ and it compiles we should handle it the same as foo<1>,foo<true>,foo<!true>

As there are a number of reviews out there for formatting Lambdas I think its a good idea for us to add corner cases like this to the unit tests, but it does get me thinking if this shouldn't be handled by a piece of code which knows about trailing return types (template or otherwise) and not be in the general Lambda parsing code

I suspect that given that the switch statement handles

  tok::identifier, tok::less, tok::numeric_constant, tok::greater
  foo            <                          1              >

We are effectively just consuming the return type tokens.

But to handle what you have here it LGTM and handles more use cases that https://bugs.llvm.org/show_bug.cgi?id=40910 would throw up.

Thanks for helping out


Repository:
  rC Clang

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

https://reviews.llvm.org/D58934





More information about the cfe-commits mailing list