[PATCH] D138263: [clang-format] Supress aligning of trailing namespace comments

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 23 13:58:54 PDT 2023


owenpan added inline comments.


================
Comment at: clang/unittests/Format/FormatTestComments.cpp:3137
+                            "    }          // namespace C\n"
+                            "  }// TESTSUITE(B)\n"
+                            "} // NaMeSpAcE A",
----------------
owenpan wrote:
> HazardyKnusperkeks wrote:
> > owenpan wrote:
> > > Why would `TCAS_Leave` result in no space before the trailing comment?
> > It just did, didn't investigate or decide.
> > Most likely clang-format just adds it there and the space just comes from the other formatting, which is disabled with `Leave`. I'd say this is fine, `Leave` just means the coder decides on the position of the comments, and if that comment is added he can just move it around and clang-format will not touch it any further.
> IMO there should be a single space or tab between the closing `namespace` brace and the `namespace` comment (existing or inserted) as `AlignTrailingComments` should not affect `namespace` comments. Anyway, we can fix it in another patch if necessary.
See D156065.


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

https://reviews.llvm.org/D138263



More information about the cfe-commits mailing list