[PATCH] D138263: [clang-format] Supress aligning of trailing namespace comments
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 18 12:08:12 PST 2022
owenpan added a comment.
In D138263#3937223 <https://reviews.llvm.org/D138263#3937223>, @HazardyKnusperkeks 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.
>
> One thing I thought about was adding a new `BlockKind`. But maybe I can look into the code that sets that and can add the `MatchingParen`.
Instead, we can annotate the `r_brace` (in `UnwrappedLineParser::parseBlock`) after annotating the `l_brace`, which would enable us to keep the existing test case on line 4037 unchanged.
================
Comment at: clang/unittests/Format/FormatTest.cpp:4037
"int i;\n"
- "} // my_namespace\n"
+ "} // my_namespace\n"
"#endif // HEADER_GUARD",
----------------
This trailing comment was at the correct column and shouldn’t be aligned to the header guard comment below it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138263/new/
https://reviews.llvm.org/D138263
More information about the cfe-commits
mailing list