[PATCH] D66332: [clang-format] Fix the bug that joins template closer and > or >>

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 16 16:46:52 PDT 2019

Quuxplusone added a comment.

In D66332#1633749 <https://reviews.llvm.org/D66332#1633749>, @owenpan wrote:

> Do you have `SpaceBeforeAssignmentOperators` off?

Yes; I mean, that's what I tested in order to produce the buggy behavior. I don't believe anyone should be using that option in production, though, and would totally support a patch to remove it completely because it can't possibly be doing anyone any good.  It feels like someone meant to implement `SpacesAroundAssignmentOperators` but then got the name wrong, and then someone fixed the behavior to match the name, and at this point it's just completely broken. :)

> The documentation <https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options> should be fixed.

Also agreed.

Are there any other clang-format options that might lead to a lack-of-space before `>`, `>=`, `==`, or `=`? I brought up `enable_if_t<Foo, int>=0` because that specifically is a construction I've run into in my own code, even though I've never tried to clang-format it, let alone have it formatted incorrectly.

(Clang-format probably does not promise to preserve the AST of pathological input like `i++ ++;` or C++03-specific input such as `A<B<int> >` or `A< ::B>`.)

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list