[PATCH] D118924: [clang-format] Fix formatting of macro definitions with a leading comment.

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 3 12:01:59 PST 2022


curdeius added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:3574
+      // line.
+      FirstNonCommentOnLine |= FirstOnLine;
+    } else {
----------------
HazardyKnusperkeks wrote:
> I really don't like bitwise operations on bool. Hit some nasty bugs at my job.
Ok, will do.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:3580
     while (!Line->InPPDirective && FormatTok->Tok.is(tok::hash) &&
-           (FormatTok->HasUnescapedNewline || FormatTok->IsFirst)) {
+           FirstNonCommentOnLine) {
       distributeComments(Comments, FormatTok);
----------------
HazardyKnusperkeks wrote:
> This does not change within the loop, is that on purpose? Then it should be an if around the loop.
Oh, good catch. It was certainly not on purpose. And it means that I need to find a new test case that covers that (if appropriate). Ideas welcome!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118924



More information about the cfe-commits mailing list