[llvm-bugs] [Bug 24666] New: Allman style doesn't always break before braces

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 1 15:01:14 PDT 2015


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

            Bug ID: 24666
           Summary: Allman style doesn't always break before braces
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aardappel at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

void test()
{
    if (something)
    {
        for (;;)
        {
        }
    }
}

Gets formatted as:

void test()
{
    if (something) {
        for (;;) {
        }
    }
}

Using the following config (with Allman):

---
BasedOnStyle: Google
---
Language: Cpp
IndentWidth: 4
ColumnLimit: 120
UseTab: Never
AccessModifierOffset: 0
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine : All
AllowShortLoopsOnASingleLine: true
BinPackParameters: true
BreakBeforeBraces: Allman
ConstructorInitializerAllOnOneLineOrOnePerLine: true
IndentCaseLabels: true
NamespaceIndentation: None
PointerAlignment: Right
SpaceBeforeParens: ControlStatements
Standard: Cpp11

This is using the visual studio plugin running in VS2010, downloaded today
(date of bug).

GNU style has as similar problem.

Interestingly, on more complex code it sometimes does it right ("if" & "for").
"else", "switch" and functions always get formatted correctly.

-- 
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/20150901/8fc5117a/attachment-0001.html>


More information about the llvm-bugs mailing list