[llvm-bugs] [Bug 44632] New: clang-format BWACS_MultiLine option not working with ForEachMacros

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 23 06:34:51 PST 2020


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

            Bug ID: 44632
           Summary: clang-format BWACS_MultiLine option not working with
                    ForEachMacros
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vthiberville at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

If the BraceWrapping AfterControlStatement rule is set to MultiLine, this rule
is not correctly handled with ForEachMacros, and acts as if it was configured
as "Always" on these macros:

Here is a short example to reproduce:

Configuration:
```
---
BreakBeforeBraces: Custom
BraceWrapping:
  AfterControlStatement: MultiLine
ColumnLimit: 30
ForEachMacros: ['for_macro']
```

Input file:
```
void bar(void) {
  for (aaa; bbb && ccc && ddd; eee) {
    foo();
  }
  for (a; b; c) {
    foo();
  }
  for_macro (a, b, c) {
    foo();
  }
  for_macro (aaa, bbb && ccc, ddd) {
    foo();
  }
}
```

Result:
```
void bar(void) {
  for (aaa; bbb && ccc && ddd;
       eee)
  {
    foo();
  }
  for (a; b; c) {
    foo();
  }
  for_macro (a, b, c)
  {
    foo();
  }
  for_macro (aaa, bbb && ccc,
             ddd)
  {
    foo();
  }
}
```

Expected result is to get:
```
  for_macro (a, b, c) {
    foo();
  }
```
for the first occurrence.

This is tested with clang-format version
10.0.0-++20200115115127+cbe681bd833-1~exp1~20200115105727.528

-- 
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/20200123/49280530/attachment.html>


More information about the llvm-bugs mailing list