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

Sedenion via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 12:02:02 PDT 2023


Sedeniono updated this revision to Diff 534688.
Sedeniono added a comment.

As suggested by @owenpan, split the commits differently. My previous statement, that the whole fix consists of a revert of D129064 <https://reviews.llvm.org/D129064> was not entirely correct: The fix reintroduces the `resize()` that got removed in D129064 <https://reviews.llvm.org/D129064>, but it additionally surrounds it by the `if (!Line.InPPDirective)`. Otherwise, the formatting is wrong if some PP directives are encountered. (The FormatMacroRegardlessOfPreviousIndent tests check this.)
Also, as @owenpan suggested, I replaced the `!Line.First->is(tok::comment)` with `Line.First->isNot(tok::comment)` in `adjustToUnmodifiedLine()`.
I also rebased the patch to the current main branch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151047

Files:
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/unittests/Format/FormatTestSelective.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151047.534688.patch
Type: text/x-patch
Size: 6323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230626/0a6af6f0/attachment.bin>


More information about the cfe-commits mailing list