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) &&
       RootToken.isAccessSpecifier() && RootToken.NewlinesBefore == 1)
----------------
curdeius wrote:
> Just thinking out loud, but shouldn't we just check that 
> `PreviousLine->Last->isNot(tok::l_brace)`?
> Could you please add a test with comments before access modifiers?
No previous line token check is necessary if it is acceptable to remove empty 
lines in situations where EmptyLineBeforeAccessModifier=true would not add 
empty line.

Without any additional tests formatting the following code with 
EmptyLineBeforeAccessModifier=true:

```
struct foo {
private:
  int i;
}
```
would not add any empty lines, but formatting this code with 
EmptyLineBeforeAccessModifier=false:

```
struct foo {

private:
  int i;
}
```
would remove empty line before modifier.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93846/new/

https://reviews.llvm.org/D93846

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to