[PATCH] D114151: [clang-format] [C++20] [Module] clang-format couldn't recognize partitions

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 19 07:49:53 PST 2021


Quuxplusone added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3235
+    if (Left.is(TT_ModulePartitionColon) &&
+        Right.isOneOf(tok::identifier, tok::kw_public, tok::kw_private))
+      return false;
----------------
owenpan wrote:
> Is `module :public` a thing in C++20? If not, I would remove `kw_public`.
For the record, my understanding is that `module :public` is not a thing, and neither is `module public:while` or any other combination of keywords //except// for `module :private`. (I don't even think `module foo:private` is a thing; is it?)
So +1 to removing `kw_public`. However, if the codebase happens to already have a function for `isIdentifierOrKeyword`, I think this would be a perfect place to use it. Consider an autoformatter-as-you-type dealing with `module foo:public[X]_methods` or `module :if[X]stream`.


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

https://reviews.llvm.org/D114151



More information about the cfe-commits mailing list