[llvm-bugs] [Bug 36960] New: Missing line breaks with loop on a single line

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 30 12:31:06 PDT 2018


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

            Bug ID: 36960
           Summary: Missing line breaks with loop on a single line
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: wlandry at caltech.edu
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

With the .clang-format file

Language:        Cpp
AllowShortBlocksOnASingleLine: true
AllowShortLoopsOnASingleLine: true
BreakBeforeBraces: Custom
BraceWrapping:   
  AfterControlStatement: true


I get this formatting


int main() {
  for (int i = 0; i < 10; ++i)
  { i + i + i + i + i + i + i + i + i + i + i + i; } return 10;
}


Note that "return 10;" is on the same line as the braced block.  I see similar
behavior with "if" statements and AllowShortIfStatementsOnASingleLine.

This is using the Debian package of clang-format-6.0 in buster.

  $ clang-format-6.0 --version
  clang-format version 6.0.0-1 (tags/RELEASE_600/final)

-- 
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/20180330/0b9a0451/attachment.html>


More information about the llvm-bugs mailing list