[PATCH] D120931: [clang-format] fix namepsace format when the name is macro expansion

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 4 10:13:37 PST 2022


curdeius added a comment.

Please update the summary, the name is no longer empty. Also, if you can add some info in the summary about how it looked before (copying a part of the Chromium bug report seems enough), it would be awesome.
Otherwise, some small comments only.



================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:59
+
+    // Use the string after `namespace` until `{` or `::` or `(` as an name
+    // candicate. If the name is empty, use the candicate.
----------------



================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:60
+    // Use the string after `namespace` until `{` or `::` or `(` as an name
+    // candicate. If the name is empty, use the candicate.
+    std::string FirstNSName;
----------------



================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:69
+    while (Tok && !Tok->is(tok::l_brace) && !Tok->is(tok::coloncolon) &&
+           !Tok->is(tok::l_paren)) {
+      FirstNSName += FirstNSTok->TokenText;
----------------
It should be simpler when written as `!Tok->isOneOf(...)`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120931



More information about the cfe-commits mailing list