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

2022-03-10 Thread Zequan Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGd54c4df31470: [clang-format] Fix namespace format when the name is followed by a macro (authored by zequanwu). Changed prior to commit: https://reviews.llvm.org/D121269?vs=414442&id=414506#toc Reposito

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

2022-03-10 Thread Owen Pan via Phabricator via cfe-commits
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) { ===

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

2022-03-10 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 414442. zequanwu marked 7 inline comments as done. zequanwu added a comment. Address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121269/new/ https://reviews.llvm.org/D121269 Files: clang/lib/For

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

2022-03-10 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:33 + llvm::function_ref Fn) { + if (!Tok || !Tok->is(StartTok)) +return Tok; And other places below where applicable. Comment at: clang/

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

2022-03-10 Thread Marek Kurdej via Phabricator via cfe-commits
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)) +To

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

2022-03-09 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 414222. zequanwu marked 2 inline comments as done. zequanwu added a comment. Refactor. Add a test for `namespace A __attribute__((availability(macos, introduced=10.15))) {`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews

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

2022-03-09 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added inline comments. Comment at: clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp:192 "}")); + EXPECT_EQ("#define M(x) x##x\n" +"namespace A M(x) {\n" curdeius wrote: > zequanwu wrote: > > zequanwu wrote: > > > cur

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

2022-03-09 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added inline comments. Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:72 -Tok = FirstNSTok; -while (Tok && !Tok->is(tok::l_brace)) { +bool IsPrevColoncolon = false; +bool HasColoncolon = false; Nit: Personally, I'd put these

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

2022-03-09 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added inline comments. Comment at: clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp:192 "}")); + EXPECT_EQ("#define M(x) x##x\n" +"namespace A M(x) {\n" zequanwu wrote: > curdeius wrote: > > MyDeveloperDay wrote: > >

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

2022-03-09 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 414149. zequanwu marked an inline comment as done. zequanwu added a comment. Add a test for `namespace A B {`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121269/new/ https://reviews.llvm.org/D121269 Files:

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

2022-03-09 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added inline comments. Comment at: clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp:192-211 + EXPECT_EQ("#define M(x) x##x\n" +"namespace A M(x) {\n" +"int i;\n" +"int j;\n" +"}// namespace A M(x)", +fi

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

2022-03-09 Thread Nico Weber via Phabricator via cfe-commits
thakis resigned from this revision. thakis added a comment. (deferring to MyDeveloperDay and curdeius) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121269/new/ https://reviews.llvm.org/D121269 ___ cfe-c