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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to