[PATCH] D127260: [clang-format] Remove braces of else blocks that embody an if block

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 23:29:05 PDT 2022


owenpan added inline comments.


================
Comment at: clang/unittests/Format/FormatTest.cpp:25570-25575
+               "  else {\n"
+               "    if (d) {\n"
+               "      e;\n"
+               "      f;\n"
+               "    }\n"
+               "  }\n"
----------------
curdeius wrote:
> Why isn't this block changed like this?
> I might be missing something...
It would cause a dangling `else` error because the last `else` would be paired with the inner merged `else if`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127260



More information about the cfe-commits mailing list