[llvm-bugs] [Bug 33809] New: [clang-format/C++] version 5.0.0 (trunk?) adds empty line after 'public:' where previous versions don't

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 16 07:44:44 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33809

            Bug ID: 33809
           Summary: [clang-format/C++] version 5.0.0 (trunk?) adds empty
                    line after 'public:' where previous versions don't
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: christian.ridderstrom at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

I noticed a difference in behaviour between clang-format v. 5.0.0 (trunk?)
compared to earlier versions (3.8, 3.9 and 4.0). The recent version adds an
empty line where previous versions didn't. The line is added just before an
access specifier, or perhaps it's due to the preceeding inline function
definition, see the example below. Anyway, the result is unexpected.

This is on macOS Sierra 10.12.5 with clang-format from homebrew.

Example: Illustration that version 5.0.0 adds an empty line. This empty line is
_not_ added by version 3.8, 3.9 or 4.0 when tested on the same file and with
the same configuration file. 

$ cat .clang_format 
BreakBeforeBraces: Custom
BraceWrapping:
  AfterFunction:   true

$ export F=test_1.h 
$ diff $F <( clang-format at 3.8 $F )
$ diff $F <( clang-format at 3.9 $F )
$ diff $F <( clang-format at 4.0 $F )
$ diff $F <( clang-format at 5.0 $F )
10a11
> 
$ diff -y -W90 $F <( clang-format at 5.0 $F )
/*                                              /*
Result of using clang-format on this code       Result of using clang-format on
this code
depends on version of clang-format:             depends on version of
clang-format:
- v 3.8, 3.9, 4.0: Code is unchanged            - v 3.8, 3.9, 4.0: Code is
unchanged
- v 5.0: Adds empty line before 'private:'      - v 5.0: Adds empty line before
'private:'
*/                                              */

class A {                                       class A {
public:                                         public:
  int f() const { return 0; }                     int f() const { return 0; }
                                            >
private:                                        private:
};                                              };

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170716/ced141d6/attachment.html>


More information about the llvm-bugs mailing list