[llvm-bugs] [Bug 34001] New: One-line if statement problem

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 31 07:38:03 PDT 2017


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

            Bug ID: 34001
           Summary: One-line if statement problem
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bubyofficial at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Configuration of clang-format:
AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
BreakBeforeBraces: Custom
BraceWrapping: { AfterClass: true, AfterControlStatement: true, AfterEnum:
true, AfterFunction: true, AfterNamespace: false, AfterStruct: true,
AfterUnion: true, BeforeCatch: true, BeforeElse: true }

Code:

// BEFORE:
if (statement) doSomething();
if (statement) { doSomething(); }

// AFTER:
if (statement) doSomething();
if (statement) {
  doSomething();
}

I expected, that clang-format will leave second block of code without changes. 
When I don't set BreakBeforeBraces, clang-format works fine, but this property
is required in my project.
Looks like a bug.

-- 
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/20170731/10df6c2f/attachment.html>


More information about the llvm-bugs mailing list