[llvm-bugs] [Bug 48906] New: Excessive breaks around return-type-requirement with BraceWrapping: AfterFunction: true or AfterControlStatement: MultiLine

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 27 14:10:15 PST 2021


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

            Bug ID: 48906
           Summary: Excessive breaks around return-type-requirement with
                    BraceWrapping: AfterFunction: true or
                    AfterControlStatement: MultiLine
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: johelegp at gmail.com
                CC: djasper at google.com, johelegp at gmail.com,
                    klimek at google.com, llvm-bugs at lists.llvm.org

This was mentioned in [D79773](https://reviews.llvm.org/D79773#2138304).

> Since a compound requirement is neither a control statement nor a function, I suppose it might eventually need its own BraceWrapping nested configuration flag. For now, I'd prefer if they never break.

---

Input and expected formatted result:
```C++
template <typename T>
concept EqualityComparable = requires(T a, T b) {
  { a == b } -> bool;
};
```

.clang-format:
```
BraceWrapping:
  AfterFunction: true
BreakBeforeBraces: Custom
```

Actual output:
```C++
template <typename T>
concept EqualityComparable = requires(T a, T b)
{
  {
    a == b
    } -> bool;
};
```

.clang-format:
```
BraceWrapping:
  AfterControlStatement: MultiLine
BreakBeforeBraces: Custom
```

Actual output:
```C++
template <typename T>
concept EqualityComparable = requires(T a, T b) {
  {
    a == b
    } -> bool;
};
```

---

.clang-format:
```
BraceWrapping:
  AfterFunction: true
BreakBeforeBraces: Custom
```

Input and expected formatted result:
```C++
template <typename T> void f(T) requires requires(T a, T b) {
  { a == b } -> bool;
}
{}
```

Actual output:
```C++
template <typename T> void f(T) requires requires(T a, T b)
{
  {
    a == b
    } -> bool;
} {}
```

-- 
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/20210127/2490356a/attachment.html>


More information about the llvm-bugs mailing list