[PATCH] D33440: clang-format: better handle statement and namespace macros

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 04:13:28 PDT 2017

djasper added a comment.

So, there are two things in this patch: Statement macros and namespace macros. Lets break this out and handle them individually. They really aren't related that much.

Statement macros:
I think clang-format's handling here is good enough. clang-format does not insert the line break, but it also doesn't remove it. I am not 100% sure here, so I an be convinced. But I want to understand the use cases better. Do you expect people to run into this frequently? I am essentially trying to understand whether the cost of an extra option is worth the benefit it is giving.

Namespace macros:
How important are the automatic closing comments to you? I'd say that we should punt on that and leave it to the user to fix comments of these. And then, we could try to make the things we already have in MacroBlockBegin detect whether it ends with an opening brace and not need an extra list here. What do you think?

Comment at: unittests/Format/FormatTest.cpp:1483
+  EXPECT_EQ("namespace out { namespace in {\n"
+            "}} // namespace out::in",
What's the difference here?


More information about the cfe-commits mailing list