leijurv wrote:

Oh gosh, that's embarrassing. It looks like I was so focused on the column 
limit that I didn't cover cases where the column limit doesn't break the 
template fully. In other words, I would just type "Fooooooooooooooooooooooo" 
and force it onto the next line, without noticing that a slightly shorter 
Foooooo would have different behavior, I apologize.

In your example, I see that `BreakBeforeTemplateCloser: Multiline, ColumnLimit: 
17` gives me:

```
template <
    class A,
    class B
>
class C {
  void f() {}
};
```

But `BreakBeforeTemplateCloser: Multiline, ColumnLimit: 18` gives me:

```
template <class A,
          class B>
class C {
  void f() {}
};
```

It looks to me like the problem is that when writing this code originally, I 
searched through the codebase for `FormatStyle::BAS_BlockIndent` and tried to 
replicate it. This causes the behavior here, where the `>` only goes onto the 
next line if there was a break after the matching `<`.

In other words, it seems **I was wrong** when I said `I didn't really have an 
intent in mind between your described options of BlockIndent vs Multiline but 
yes, I suppose what I have here is Multiline.` Actually, it seems like what I 
have here is BlockIndent.

So, thankfully I think I can fix this just by **renaming my option from 
Multiline to BlockIndent**, per your comment 
[here](https://github.com/llvm/llvm-project/pull/118046#discussion_r1912382882).

Additionally I have **added more tests** to cover this case where the first 
parameter can fit within the ColumnLimit on the same line as the `template <`.

https://github.com/llvm/llvm-project/pull/118046/commits/09528826ffc9f7b783d043c4447419cfd9a6ff38

https://github.com/llvm/llvm-project/pull/118046
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to