Page MenuHomePhabricator

[clang-format] add back tests which didn't cause a regression
Needs ReviewPublic

Authored by MyDeveloperDay on Nov 29 2021, 10:23 AM.

Details

Diff Detail

Event Timeline

MyDeveloperDay requested review of this revision.Nov 29 2021, 10:23 AM
MyDeveloperDay created this revision.

bring back another 2 verifyFormats

crayroud added inline comments.Nov 29 2021, 11:04 AM
clang/unittests/Format/FormatTest.cpp
14124–14125

Remove the comment too.

14276

What do you think of enabling this test and to remove the space before the opening parenthesis ? As it is now the expected behaviour to have no space.

14351

As the the condition is to add a space before non empty parentheses, the test is valid.

MyDeveloperDay marked 3 inline comments as done.

Address review comments

Remove unrelated file

crayroud added inline comments.Nov 30 2021, 9:34 AM
clang/unittests/Format/FormatTest.cpp
14276

In https://reviews.llvm.org/D114696, you proposed to add an operator overloading option to SpaceBeforeParensOptions. This example: "T A::operator() () {}" should be configured from AfterFunctionDefinitionName or operator overloading ?

MyDeveloperDay marked an inline comment as done.Nov 30 2021, 10:43 AM
MyDeveloperDay added inline comments.
clang/unittests/Format/FormatTest.cpp
14276

in this circumstance can you explain why you want to treat differently? I can't tell what you intended here was it by design or as a consequence?

verifyFormat("T A::operator()();", SpaceFuncDef);
verifyFormat("T A::operator() () {}", SpaceFuncDef);
MyDeveloperDay marked an inline comment as done.Nov 30 2021, 10:45 AM

Its really this case that caused me issues, the behaviour for the foo {} cases was different from the ::operator cases. My feeling is that one is being detected as a function the other not.

verifyFormat("::operator delete(foo);");
verifyFormat("::operator new(n * sizeof(foo));");
verifyFormat("foo() { ::operator delete(foo); }");
verifyFormat("foo() { ::operator new(n * sizeof(foo)); }");
crayroud added inline comments.Nov 30 2021, 11:11 AM
clang/unittests/Format/FormatTest.cpp
14276

During the refactoring I treated operator overloading as a function definition. Is it correct or not ?