[clang] [clang-format] revert to string << string handling to previous default (PR #88490)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 13 13:08:19 PDT 2024
================
@@ -5598,11 +5598,45 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
// FIXME: Breaking after newlines seems useful in general. Turn this into an
// option and recognize more cases like endl etc, and break independent of
// what comes after operator lessless.
- if (Right.is(tok::lessless) && Right.Next &&
- Right.Next->is(tok::string_literal) && Left.is(tok::string_literal) &&
- Left.TokenText.ends_with("\\n\"")) {
- return true;
+ switch (Style.BreakStreamOperator) {
+ case FormatStyle::BCOS_BetweenStrings: {
+ if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) &&
+ Right.Next->is(tok::string_literal)) {
+ return true;
+ }
+ break;
+ }
+ case FormatStyle::BCOS_BetweenNewlineStrings: {
+ if (Right.is(tok::lessless) && Right.Next &&
+ Right.Next->is(tok::string_literal) && Left.is(tok::string_literal) &&
+ Left.TokenText.ends_with("\\n\"")) {
+ return true;
+ }
+ break;
+ }
+ case FormatStyle::BCOS_Always: {
+ // Don't break after the very first << or >>
+ // but the Left token can be os or std::os so
----------------
HazardyKnusperkeks wrote:
Still don't understand the part of `os` or `std::os`.
https://github.com/llvm/llvm-project/pull/88490
More information about the cfe-commits
mailing list