[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 03:09:39 PST 2022


owenpan added inline comments.


================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:33
+              llvm::function_ref<void(const FormatToken *)> Fn) {
+  if (!Tok || !Tok->is(StartTok))
+    return Tok;
----------------
And other places below where applicable.


================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:76
     }
   } else {
     // Skip attributes.
----------------
Early return.


================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:122
+        IsPrevColoncolon = FirstNSTok->is(tok::coloncolon);
+        HasColoncolon |= IsPrevColoncolon;
+        if (FirstNSTok->is(tok::kw_inline)) {
----------------



================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:137-140
+    if (!FirstNSName.empty() && !HasColoncolon)
+      name = FirstNSName + (!name.empty() ? " " + name : "");
   }
   return name;
----------------
Something like that.


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