owenpan added a comment. Since this option doesn't work for empty functions yet, we should either add a note in the documentation or qualify the scope with "non-empty" as suggested in my comments.
================ Comment at: clang/docs/ReleaseNotes.rst:528 ------------ +- Add `RemoveSemicolon` option for removing unnecessary `;` after a function definition. ---------------- IMO "unnecessary" is unnecessary. Add "non-empty" if we want to be exact. ================ Comment at: clang/include/clang/Format/Format.h:3058 + /// Remove redundant semicolons after the closing brace of a function + /// \warning ---------------- Now I feel it's probably better to not add "redundant". ================ Comment at: clang/include/clang/Format/Format.h:3068 + /// int max(int a, int b) int max(int a, int b) + /// { { + /// return a > b ? a : b; return a > b ? a : b; ---------------- Nit: unwrap the braces. ================ Comment at: clang/lib/Format/UnwrappedLineParser.cpp:992-997 + // When this is a function block and there is an unnecessary semicolon + // afterwards then mark it as optional (so the RemoveSemi pass can get rid of + // it later). + if (MunchSemi && FormatTok->is(tok::semi)) { nextToken(); + } ---------------- Move the comments to line 965 and elide the braces. ================ Comment at: clang/unittests/Format/FormatTest.cpp:26773 + Style); + + // These tests are here to show a problem that may not be easily ---------------- Add the test case if it will pass. ================ Comment at: clang/unittests/Format/FormatTest.cpp:26780-26786 + verifyFormat("void main(){};", "void main() {};", Style); + verifyFormat("void foo(){}; //\n" + ";\n" + "int bar;", + "void foo(){}; //\n" + "; int bar;", + Style); ---------------- And edit the comments above. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135466/new/ https://reviews.llvm.org/D135466 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits