User Details
- User Since
- Sun, Dec 27, 1:50 PM (3 w, 1 d)
Thu, Jan 14
Improved default style tests.
Wed, Jan 13
Renamed DontModify enum to Leave.
Rebased changes on master.
Sat, Jan 9
Diff updated. Previous diff was generated after rebase, and Phabricator change preview did not show any unrelated changes, so I thought that everything is fine.
Wed, Jan 6
Switched EmptyLineBeforeAccessModifierStyle option from bool to enum.
EmptyLineBeforeAccessModifierStyle option can now have one of four values: Never, DontModify, LogicalBlock, Always.
Never removes all empty lines before access modifiers.
DontModify keeps existing empty lines.
LogicalBlock adds empty line only when access modifier starts a new logical block (current clang-format behavior).
Always adds empty line before all access modifiers except when access modifier is at the start of class/struct definition.
Tue, Jan 5
Mon, Jan 4
Fri, Jan 1
When access modifier is in the same line with previous tokens, UnwrappedLineFormatter::formatFirstToken is called with RootToken.NewlinesBefore == 0, but empty line is only inserted if RootToken.NewlinesBefore == 1. The following change fixes this and passes all tests except the ones with comment:
if (PreviousLine && RootToken.isAccessSpecifier()) { if (Style.EmptyLineBeforeAccessModifier && PreviousLine->Last->isOneOf(tok::semi, tok::r_brace) && - RootToken.NewlinesBefore == 1) - ++Newlines; + RootToken.NewlinesBefore <= 1) + Newlines = 2; else if (!Style.EmptyLineBeforeAccessModifier && RootToken.NewlinesBefore > 1) Newlines = 1; }
Thu, Dec 31
After some updating, rebuilding and searching for differences in Objective-C++ formatting, I managed to find where the problem with these failing tests is. In _verifyFormat function C++ code formatting is tested for stability like this:
EXPECT_EQ(Expected.str(), format(Expected, Style)); EXPECT_EQ(Expected.str(), format(Code, Style));
, but Objective-C++ test, in the same function, looks like this:
EXPECT_EQ(Expected.str(), format(test::messUp(Code), ObjCStyle));
test::messUp function removes all newlines and indentation, so test code:
struct foo { int i;
Wed, Dec 30
Added missing full stop.
Executed clang/doc/tools/dump_style.py to update ClangFormatStyleOptions.rst.
Tue, Dec 29
Switched to verifyFormat in most of the tests.
Rerun clang-format.
Mon, Dec 28
Option renamed to EmptyLineBeforeAccessModifier.
Placed new configuration member in correct place alphabetically.
Last token in previous line is no longer checked when EmptyLineBeforeAccessModifier is false.
Executed clang/doc/tools/dump_style.py to update ClangFormatsStyleOptions.rst.
Unit tests added to clang/unittests/Format/FormatTests.cpp.