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 
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;
     }


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