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

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 13:26:31 PST 2022


owenpan accepted this revision.
owenpan added inline comments.


================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:108
+  // which one is name. For example, `namespace A B {`.
+  while (Tok && !Tok->is(tok::l_brace)) {
+    if (FirstNSTok) {
----------------



================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:116
+        }
+        if (!FirstNSTok->is(tok::coloncolon)) {
+          NameFinished = true;
----------------



================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:135
   }
-  return name;
+  if (!NameFinished && FirstNSTok && !FirstNSTok->is(tok::l_brace))
+    name += FirstNSTok->TokenText;
----------------



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