[PATCH] D150057: [clang-format] Fix consecutive alignments in #else blocks

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 6 18:50:27 PDT 2023


owenpan created this revision.
owenpan added a reviewer: mitchell-stellar.
Herald added projects: All, clang, clang-format.
Herald added a subscriber: cfe-commits.
Herald added reviewers: rymiel, HazardyKnusperkeks, MyDeveloperDay.
owenpan requested review of this revision.

Since 3.8 or earlier, clang-format has been lumping all `#else`, `#elif`, etc blocks together when doing whitespace replacements and causing consecutive alignments across #else blocks.

Commit c077975 <https://reviews.llvm.org/rGc0779756a0c4cc84d9f98714734d47879701cc3d> partially addressed the problem but also triggered "regressions".

This patch fixes the root cause of the problem and "reverts" c077975 <https://reviews.llvm.org/rGc0779756a0c4cc84d9f98714734d47879701cc3d> (except for the unit tests).

Fixes https://github.com/llvm/llvm-project/issues/36070.
Fixes https://github.com/llvm/llvm-project/issues/55265.
Fixes https://github.com/llvm/llvm-project/issues/60721.
Fixes https://github.com/llvm/llvm-project/issues/61498.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150057

Files:
  clang/lib/Format/WhitespaceManager.cpp
  clang/unittests/Format/FormatTest.cpp
  clang/unittests/Format/FormatTestComments.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150057.520137.patch
Type: text/x-patch
Size: 5016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230507/9c222a25/attachment.bin>


More information about the cfe-commits mailing list