This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] regressed default behavior for operator parentheses
ClosedPublic

Authored by MyDeveloperDay on Nov 29 2021, 1:57 AM.

Details

Summary

D110833: [clang-format] Refactor SpaceBeforeParens to add options regressed behavior of spaces before parentheses for operators, this revision reverts that so that operators are handled as they were before.

I think in hindsight it was a mistake to try and consume operator behaviour in with the function behaviour, I think Operators can be considered a special style. Its seems the code is getting confused as to if this is a function declaration or definition.

I think latterly we can consider adding an operator parentheses specific custom option but this should have been explicitly called out as it can impact projects.

Diff Detail

Event Timeline

MyDeveloperDay requested review of this revision.Nov 29 2021, 1:57 AM
MyDeveloperDay created this revision.
This revision is now accepted and ready to land.Nov 29 2021, 4:27 AM

@crayroud I'm going to commit this change to get past the regression, but we can continue to discuss here how you'd like to proceed.

crayroud added inline comments.Nov 29 2021, 8:38 AM
clang/unittests/Format/FormatTest.cpp
14126–14127

Why did you comment these lines? When SpaceBeforeParens is set to always it is not correct to have a space before the opening parenthesis, for operators ?