Page MenuHomePhabricator

thezbyg (Albertas Vyšniauskas)
User

Projects

User does not belong to any projects.

User Details

User Since
Sun, Dec 27, 1:50 PM (3 w, 1 d)

Recent Activity

Thu, Jan 14

thezbyg updated the diff for D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

Improved default style tests.

Thu, Jan 14, 7:48 AM · Restricted Project, Restricted Project

Wed, Jan 13

thezbyg updated the diff for D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

Renamed DontModify enum to Leave.

Wed, Jan 13, 2:03 PM · Restricted Project, Restricted Project
thezbyg updated the diff for D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

Rebased changes on master.

Wed, Jan 13, 10:24 AM · Restricted Project, Restricted Project

Sat, Jan 9

thezbyg updated the diff for D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

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.

Sat, Jan 9, 1:20 AM · Restricted Project, Restricted Project

Wed, Jan 6

thezbyg updated the diff for D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

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.

Wed, Jan 6, 1:01 PM · Restricted Project, Restricted Project

Tue, Jan 5

thezbyg added inline comments to D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.
Tue, Jan 5, 12:10 PM · Restricted Project, Restricted Project

Mon, Jan 4

thezbyg added inline comments to D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.
Mon, Jan 4, 9:31 AM · Restricted Project, Restricted Project

Fri, Jan 1

thezbyg added a comment to D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

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;
   }
Fri, Jan 1, 1:41 AM · Restricted Project, Restricted Project

Thu, Dec 31

thezbyg added a comment to D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

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;
Thu, Dec 31, 12:07 PM · Restricted Project, Restricted Project

Wed, Dec 30

thezbyg updated the diff for D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

Added missing full stop.
Executed clang/doc/tools/dump_style.py to update ClangFormatStyleOptions.rst.

Wed, Dec 30, 10:04 AM · Restricted Project, Restricted Project

Tue, Dec 29

thezbyg updated the diff for D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

Switched to verifyFormat in most of the tests.
Rerun clang-format.

Tue, Dec 29, 9:05 AM · Restricted Project, Restricted Project

Mon, Dec 28

thezbyg added inline comments to D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.
Mon, Dec 28, 10:14 AM · Restricted Project, Restricted Project
thezbyg added inline comments to D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.
Mon, Dec 28, 9:32 AM · Restricted Project, Restricted Project
thezbyg updated the diff for D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.

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.

Mon, Dec 28, 9:14 AM · Restricted Project, Restricted Project

Sun, Dec 27

thezbyg requested review of D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier.
Sun, Dec 27, 2:12 PM · Restricted Project, Restricted Project