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: unassignedclangb...@nondot.org
          Reporter: vthibervi...@gmail.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to