[PATCH] D125137: [clang-format] Don't remove braces if a 1-statement body would wrap

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 13:16:29 PDT 2022


curdeius added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:787
+
+  const int Length = LastToken->TotalLength;
+
----------------
owenpan wrote:
> curdeius wrote:
> > Why not like this?
> > Why not like this?
> 
> See the assertion on line 781 above. We are computing the `TotalLength` of `LastToken` via `Line`. Either way works, but I prefer the simpler expression. I can change it though if you insist.
Yeah, what I meant is to just get rid of `LastToken` variable and write the suggested code.
But well, both ways work. No strong feelings.


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

https://reviews.llvm.org/D125137



More information about the cfe-commits mailing list