[llvm-bugs] [Bug 45018] New: A newline is added after a string token if the next 2 tokens are lessless and string

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 25 01:39:14 PST 2020


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

            Bug ID: 45018
           Summary: A newline is added after a string token if the next 2
                    tokens are lessless and string
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jeffrey.vandeglind at nobelbiocare.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 23166
  --> https://bugs.llvm.org/attachment.cgi?id=23166&action=edit
File to verify two streamed strings aren't split

Given the code:

 QStringList() << "something" << "something" << variable;

If I then run clang-format with the default config file, the output is the
following code:

 QStringList() << "something"
               << "something" << variable

What I expected, was that it stays on a single line, unless it exceeds the
column limit and possible penalties. In this case, untouched.

It stays untouched when I add a variable in between:

 QStringList() << "something" << a << "something" << variable;

Looking at the code, I noticed that somebody intentionally introduced this to
split endline characters in commit df28f7b8dd6a032515109de4ff5b4067be95da8e
(currently at lib/Format/TokenAnnotator.cpp, line 3073).

In the attachment I added a file with a slightly different example that I used
when debugging clang-format.

-- 
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/20200225/30593b41/attachment.html>


More information about the llvm-bugs mailing list