[llvm-bugs] [Bug 42156] New: Clang-format Adds Space in Placement New Expression with Setting SpaceBeforeParens: ControlStatements

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 6 05:40:37 PDT 2019


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

            Bug ID: 42156
           Summary: Clang-format Adds Space in Placement New Expression
                    with Setting SpaceBeforeParens: ControlStatements
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matthias.schaefer at versasec.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

.clang-format file:
Language: Cpp
SpaceBeforeParens: ControlStatements
ColumnLimit: 0

After running clang-format the code is formatted as follows:
void Foo() {
  new (place) Bar;
}

The new expression is not a control statement (the docs name for/if/while as
examples). Instead, it works and feels much more like a function call. The
parentheses are enclosing a parameter list, not a control expression. So this
parameter list should be formatted like the one of a function call, like so:
void Foo() {
  new(place) Bar;
}

Note the missing space before the parameter list.

-- 
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/20190606/c47a3c5f/attachment.html>


More information about the llvm-bugs mailing list