Page MenuHomePhabricator

[clang-format] Fix a bug that joins template closer and =
ClosedPublic

Authored by owenpan on Aug 17 2019, 5:34 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

owenpan created this revision.Aug 17 2019, 5:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2019, 5:34 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision is now accepted and ready to land.Aug 18 2019, 2:18 AM
This comment was removed by Quuxplusone.

LGTM too, although I would still question whether Style.SpaceBeforeAssignmentOperators is providing anyone any benefit at all.

clang/unittests/Format/FormatTest.cpp
6631 ↗(On Diff #215763)

Actually, could you add a test case specifically for the troublesome enable_if_t pattern? Just in case any future option treats default-template-arguments any differently from assignment-statements, whitespace-wise.

verifyformat("template<enable_if_t<Foo, int> = 0>");

although I would still question whether Style.SpaceBeforeAssignmentOperators is providing anyone any benefit at all.

See here for the patch. I don't know why the option was added but think it's probably outdated and should be deprecated.

owenpan marked an inline comment as done.Aug 18 2019, 11:43 AM
owenpan added inline comments.
clang/unittests/Format/FormatTest.cpp
6631 ↗(On Diff #215763)

I think it duplicates a<int> = 1; on Line 6630 because they both test the insertion of a space between a template closer > and an assignment operator = that follows.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2019, 11:50 AM