[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-25 Thread Björn Schäpers via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG60bf5826cfd3: [clang-format] PR16518 Add flag to suppress empty line insertion before access… (authored by thezbyg, committed by HazardyKnusperkeks). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-25 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg marked an inline comment as done. thezbyg added a comment. Yes, I do not have commit access and would like for someone to commit/push this change. My name and email is `Albertas Vyšniauskas `. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D9

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-25 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 319057. thezbyg added a comment. Remove redundant line. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/new/ https://reviews.llvm.org/D93846 Files: clang/docs/ClangFormatStyleOptions.rst clang/include/

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-25 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:8943 + Style); + Style = getLLVMStyle(); + Style.EmptyLineBeforeAccessModifier = FormatStyle::ELBAMS_Never; Redundant line. Repository: rG LLVM Github Monorepo

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-24 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment. Do you need someone to push this? If so please post email and name to use for the commit. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/new/ https://reviews.llvm.org/D93846 ___

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-14 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 316660. thezbyg added a comment. Improved default style tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/new/ https://reviews.llvm.org/D93846 Files: clang/docs/ClangFormatStyleOptions.rst clang/i

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-14 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius accepted this revision. curdeius added a comment. One last nit, otherwise LGTM. Comment at: clang/unittests/Format/FormatTest.cpp:8891 +TEST_F(FormatTest, FormatsAccessModifiers) { + verifyFormat("struct foo {\n" + "private:\n" For the e

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-13 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 316511. thezbyg added a comment. Renamed DontModify enum to Leave. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/new/ https://reviews.llvm.org/D93846 Files: clang/docs/ClangFormatStyleOptions.rst cla

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-13 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment. Apart from that last naming issue looks good to me. Comment at: clang/lib/Format/Format.cpp:235 +IO.enumCase(Value, "Never", FormatStyle::ELBAMS_Never); +IO.enumCase(Value, "DontModify", FormatStyle::ELBAMS_DontModify); +IO.enumCa

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/lib/Format/Format.cpp:235 +IO.enumCase(Value, "Never", FormatStyle::ELBAMS_Never); +IO.enumCase(Value, "DontModify", FormatStyle::ELBAMS_DontModify); +IO.enumCase(Value, "LogicalBlock", FormatStyle::ELBAMS_Logica

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-13 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 316446. thezbyg added a comment. Rebased changes on master. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/new/ https://reviews.llvm.org/D93846 Files: clang/docs/ClangFormatStyleOptions.rst clang/incl

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-09 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment. In D93846#2488469 , @thezbyg wrote: > 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. Now your diff

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-09 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 315578. thezbyg added a comment. 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. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/ne

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-07 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment. I think your base for the diff is wrong, there are many "added" things which are already in clang-format. Could you update the diff? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/new/ https://reviews.llvm.org/D93846 ___

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-06 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 314962. thezbyg added a comment. Switched `EmptyLineBeforeAccessModifierStyle` option from bool to enum. `EmptyLineBeforeAccessModifierStyle` option can now have one of four values: `Never`, `DontModify`, `LogicalBlock`, `Always`. `Never` removes all empty li

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-05 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1221 +if (Style.EmptyLineBeforeAccessModifier && +PreviousLine->Last->isOneOf(tok::semi, tok::r_brace) && +RootToken.NewlinesBefore == 1) thezbyg

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-05 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg marked an inline comment as done. thezbyg added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1221 +if (Style.EmptyLineBeforeAccessModifier && +PreviousLine->Last->isOneOf(tok::semi, tok::r_brace) && +RootToken.NewlinesBefore

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-05 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1222-1223 +PreviousLine->Last->isOneOf(tok::semi, tok::r_brace) && +RootToken.NewlinesBefore == 1) + ++Newlines; +else if (!Style.EmptyLineBeforeAccessModifier &

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-04 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1221 +if (Style.EmptyLineBeforeAccessModifier && +PreviousLine->Last->isOneOf(tok::semi, tok::r_brace) && +RootToken.NewlinesBefore == 1) thezbyg

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-04 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg marked an inline comment as done. thezbyg added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1221 +if (Style.EmptyLineBeforeAccessModifier && +PreviousLine->Last->isOneOf(tok::semi, tok::r_brace) && +RootToken.NewlinesBefore

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-01 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1221 +if (Style.EmptyLineBeforeAccessModifier && +PreviousLine->Last->isOneOf(tok::semi, tok::r_brace) && +RootToken.NewlinesBefore == 1) maybe I don

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-01 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg added a comment. 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

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-31 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg marked 2 inline comments as done. thezbyg added a comment. 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

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-31 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:8544 +TEST_F(FormatTest, FormatsAccessModifiers) { + EXPECT_EQ("struct foo {\n" +" int i;\n" any reason this can't be verifyFormat? Comment at

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-31 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment. ok so this looks ok, but before we commit can we have a discussion about why you think it fails for the comment case? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/new/ https://reviews.llvm.org/D93846 __

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-30 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 314129. thezbyg marked 3 inline comments as done. thezbyg added a comment. Added missing full stop. Executed clang/doc/tools/dump_style.py to update ClangFormatStyleOptions.rst. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/new/ https://review

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-30 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/include/clang/Format/Format.h:1351 + /// If true, the empty line is inserted before access modifiers + /// \code The full stop will go here then regenerate. CHANGES SINCE LAST ACTION https://reviews.

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-29 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added a comment. Nit. Comment at: clang/docs/ClangFormatStyleOptions.rst:1545 +**EmptyLineBeforeAccessModifier** (``bool``) + If true, the empty line is inserted before access modifiers + Full stop at the end of the phrase. CHANGES SINCE LAST ACTION

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-29 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 313973. thezbyg added a comment. Switched to verifyFormat in most of the tests. Rerun clang-format. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93846/new/ https://reviews.llvm.org/D93846 Files: clang/docs/ClangFormatStyleOptions.rst clang/inc

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-29 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:8544-8556 + EXPECT_EQ("struct foo {\n" +" int i;\n" +"\n" +"private:\n" +" int j;\n" +"}\n", +format("struct foo {\n"

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-28 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:8544-8556 + EXPECT_EQ("struct foo {\n" +" int i;\n" +"\n" +"private:\n" +" int j;\n" +"}\n", +format("struct foo {\n" --

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-28 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg marked 10 inline comments as done. thezbyg added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1220 + if (Style.InsertEmptyLineBeforeAccessModifier && PreviousLine && + PreviousLine->Last->isOneOf(tok::semi, tok::r_brace) && RootTok

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-28 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:8544-8556 + EXPECT_EQ("struct foo {\n" +" int i;\n" +"\n" +"private:\n" +" int j;\n" +"}\n", +format("struct foo {\n"

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-28 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 313863. thezbyg added a comment. 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

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-28 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/include/clang/Format/Format.h:68 + /// \endcode + bool InsertEmptyLineBeforeAccessModifier; + HazardyKnusperkeks wrote: > MyDeveloperDay wrote: > > quite a mouthful... maybe just `NewLineBeforeAccessModifi

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-28 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/include/clang/Format/Format.h:68 + /// \endcode + bool InsertEmptyLineBeforeAccessModifier; + MyDeveloperDay wrote: > quite a mouthful... maybe just `NewLineBeforeAccessModifier` ? A new line is always

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-28 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added a comment. My 2 cents. Otherwise I agree with @MyDeveloperDay's comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1219-1228 + if (Style.InsertEmptyLineBeforeAccessModifier && PreviousLine && + PreviousLine->Last->isOneOf(tok::semi, tok::r_br