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

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 26 12:20:06 PDT 2023


HazardyKnusperkeks added a comment.

In D138263#4535269 <https://reviews.llvm.org/D138263#4535269>, @MyDeveloperDay wrote:

> In D138263#3936536 <https://reviews.llvm.org/D138263#3936536>, @HazardyKnusperkeks wrote:
>
>> In D138263#3936007 <https://reviews.llvm.org/D138263#3936007>, @owenpan wrote:
>>
>>> I suppose it's fairly easy to annotate the `l_brace` of a namespace? If so, then wouldn't it be better to do that?
>>
>> But the `r_brace` has no `MatchingParen`, and I didn't want to go into that hole.
>
> How many times has that caught you out though?....I could have used this SO many times to constraint stuff... I wonder how painful a BraceMatchingPass would be, labelling all BraceTypes to Match each others.

Yeah... see D139257 <https://reviews.llvm.org/D139257> and D139760 <https://reviews.llvm.org/D139760>.



================
Comment at: clang/unittests/Format/FormatTestComments.cpp:3182
+               "} // namespace A\n"
+               "  // Comment", Input, Style);
+
----------------
owenpan wrote:
> And put the test case in a `#if 0` block? I don't think it should be aligned with the `namespace` comment.
I thought about it and came to the conclusion, that we (in this change) only want to suppress the alignment of namespace comments, not aligning other comments to the namespace comment.
But all is fine for me.


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

https://reviews.llvm.org/D138263



More information about the cfe-commits mailing list