[PATCH] D121269: [clang-format] Fix namespace format when the name is followed by a macro

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 00:25:14 PST 2022


curdeius accepted this revision.
curdeius added a comment.

LGTM % nits. Thanks for working on this!



================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:54-55
+    Tok = processTokens(Tok, tok::l_paren, tok::r_paren, nullptr);
+  } else if (Tok->is(tok::l_square))
+    Tok = processTokens(Tok, tok::l_square, tok::r_square, nullptr);
+  return Tok;
----------------
Nit: add braces around `else if` block to match the `if`.


================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:77
   } else {
     // Skip attributes.
+    Tok = skipAttribute(Tok);
----------------
Comment not necessary anymore. Please remove.


================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:130
       Tok = Tok->getNextNonComment();
+      // Skip attribute
+      const FormatToken *TokAfterAttr = skipAttribute(Tok);
----------------
Comment not necessary anymore. Please remove.


================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:138
+    if (!FirstNSName.empty() && !HasColoncolon)
+      name = FirstNSName + (!name.empty() ? " " + name : "");
   }
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121269



More information about the cfe-commits mailing list