[PATCH] D120931: [clang-format] Fix namespace format when the name is a macro expansion
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 4 13:54:42 PST 2022
owenpan added inline comments.
================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:45-54
+ int NestLevel = 1;
+ while (Tok && NestLevel > 0) {
+ Tok = Tok->getNextNonComment();
+ if (Tok) {
+ if (Tok->is(tok::l_square))
+ ++NestLevel;
+ if (Tok->is(tok::r_square))
----------------
To make the loop simpler and more efficient.
================
Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:59-60
+
+ // Use the string after `namespace` until `{` or `::` or `(` as a name
+ // candidate. If the name is empty, use the candicate.
+ std::string FirstNSName;
----------------
Move "as a name candidate" to between "`namespace`" and "until".
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