[PATCH] D135466: [clang-format] Add support to remove unnecessary semicolons after function definition

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 13:35:28 PDT 2022


HazardyKnusperkeks added a comment.

Maybe even extend the option to other unnecessary semicolons like `int x = 5;;` or other noop statements, one just has to be careful not to remove the semicolon when it's the sole if/loop body.



================
Comment at: clang/include/clang/Format/Format.h:3076
+  /// \version 16
+  bool RemoveSemiColons;
+
----------------
The name is a bit hard, just from that it's not clear that this option is harmless (modulo bugs). Maybe something like the said warning `RemoveExtraSemiColons`?


================
Comment at: clang/unittests/Format/FormatTest.cpp:26755
+               "class Foo {\n"
+               "  int getSomething() const { return something; };\n"
+               "};",
----------------
What happens with 2 (or more) semicolons?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135466/new/

https://reviews.llvm.org/D135466



More information about the cfe-commits mailing list