[PATCH] D87587: [clang-format] Make one-line namespaces resistant to FixNamespaceComments, update documentation
Krystian Kuzniarek via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 14 01:17:29 PDT 2020
kuzkry added a comment.
Thanks @JakeMerdichAMD for your quick feedback.
> In any case, can you also add the full diff context? It makes it easier for us to review.
I'll do that starting from the next patch because I'm afraid if I resubmit the longer version of the same patch, your comment would be hidden or considered obsolete as it would refer to an older revision.
================
Comment at: clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp:426-428
+ EXPECT_EQ("namespace A { a }// namespace A",
+ fixNamespaceEndComments("namespace A { a }"));
+ EXPECT_EQ("namespace A { a };// namespace A",
----------------
JakeMerdichAMD wrote:
> I strongly believe that these ones are not correct. Namespaces that are entirely on one line should never have a trailing comment, even if it has content in it.
>
> A solution would also have to take into account whether future passes would split this onto separate lines (and thus have a different result after re-running clang-format), which was the reason for this limitation in the first place.
You're absolutely right. Btw. do you happen to know which style option controls this behaviour that splits these namespaces onto separate lines?
Anyway, I'm going to look into this in a few days.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87587/new/
https://reviews.llvm.org/D87587
More information about the cfe-commits
mailing list