[PATCH] D136154: Fix the continuation indenter

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 13:51:49 PDT 2022


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:812-814
+    if (Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None ||
++       Style.BreakBeforeBinaryOperators == FormatStyle::BOS_NonAssignment)
       CurrentState.LastSpace = State.Column;
----------------
Add braces (and drop the plus).


================
Comment at: clang/unittests/Format/FormatTest.cpp:6599-6601
+  Style.AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak;
+  Style.BinPackParameters = false;
+  Style.ContinuationIndentWidth = 2;
----------------
Do you need this for the observed effect? From the description I don't see that.


================
Comment at: clang/unittests/Format/FormatTest.cpp:6603
+  Style.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment;
+  EXPECT_EQ(
+      "struct Derived {\n"
----------------
Is the behavior different when the code is already formatted like you want it? (It shouldn't.) Then you should use `verifyFormat()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136154/new/

https://reviews.llvm.org/D136154



More information about the cfe-commits mailing list