[PATCH] D151047: [clang-format] Fix indentation for selective formatting.

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 25 14:17:41 PDT 2023


owenpan added a comment.

In D151047#4396727 <https://reviews.llvm.org/D151047#4396727>, @Sedeniono wrote:

> So, the new patch basically just reverts the original fix of https://reviews.llvm.org/D129064 (i.e. it re-introduces the `resize()` in `LevelIndentTracker::nextLine()`). The other changes are just cosmetics and additional tests.

Perhaps we should have two separate patches: the first one that just reverts D129064 <https://reviews.llvm.org/D129064>, and the second for the new tests. That would be much easier to follow, IMO.



================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:104
+      assert(Line.Level < IndentForLevel.size());
+      if ((!Line.First->is(tok::comment) || IndentForLevel[Line.Level] == -1))
+        IndentForLevel[Line.Level] = LevelIndent;
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151047



More information about the cfe-commits mailing list