[PATCH] D119649: [clang-format] Correctly format loops and `if` statements even if preceded with comments.

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 12 13:58:21 PST 2022


curdeius added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:379
     if (NextLine.First->is(tok::l_brace)) {
       if ((TheLine->First->isOneOf(tok::kw_if, tok::kw_else, tok::kw_while,
                                    tok::kw_for, tok::kw_switch, tok::kw_try,
----------------
sstwcw wrote:
> Why not use `FirstNonComment` instead of `TheLine->First` down here?
Because I haven't added a test case for it and prefer doing it in a different revision (and because as you see, I already got confused enough :) ).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119649



More information about the cfe-commits mailing list