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

            Bug ID: 47936
           Summary: AfterControlStatement: MultiLine breaks
                    AllowShortFunctionsOnASingleLine
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: edas...@att.net
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Using the MultiLine setting for BraceWrapping.AfterControlStatement appears to
disable AllowShortFunctionsOnASingleLine, even in cases without any control
statements. For the input:

void bar() {}
class Foo {
    void shortfunction() { bar(); }
};

The command:

clang-format --style="{BasedOnStyle: llvm, AllowShortFunctionsOnASingleLine:
Inline, BreakBeforeBraces: Custom, BraceWrapping: {AfterFunction: true,
AfterControlStatement: MultiLine}}"

produces:

void bar() {}
class Foo {
  void shortfunction()
  {
    bar();
  }
};

If MultiLine is replaced with Always or Never, or is left out entirely, we get:

void bar() {}
class Foo {
  void shortfunction() { bar(); }
};

which is the expected result, as no control statements are present.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to