[clang] [clang-format] revert to string << string handling to previous default (PR #88490)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 14 11:07:24 PDT 2024


owenca wrote:

Please see https://github.com/llvm/llvm-project/issues/88483#issuecomment-2053928993 and Conversation in #69859, which was the first attempt at adding an option for breaking consecutive stream insertion operations. Instead of handling everything specified in https://github.com/llvm/llvm-project/pull/69859#issuecomment-1776064714 in a single patch, we can take a few steps:

1. Handle when to break _before_ `<<`. The current default (since 18.x) is only when the left operand is a string literal ending with a newline and the right operand is a string literal.
2. Handle whether to indent or align after the break.
3. Do the above for breaking breaking _after_ `<<`.

(Ditto for stream extraction operations if needed.)

For No. 1 above, an `enum` option (e.g. `BreakBeforeStreamInsertionOperator`) with `Leave`, `AfterNewline` (LLVM default), `Always`, and `Never` may be sufficient. @s1Sharp

https://github.com/llvm/llvm-project/pull/88490


More information about the cfe-commits mailing list