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

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 8 01:11:22 PDT 2022


owenpan added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:963
   nextToken(/*LevelDifference=*/-AddLevels);
   HandleVerilogBlockLabel();
 
----------------
lahwaacz wrote:
> owenpan wrote:
> > The `while` loop would address https://reviews.llvm.org/D135466#inline-1306331 but is optional IMO because it wouldn't distinguish `};;` and the following:
> > ```
> > };
> > ;
> > ```
> Does it matter? If you have `struct foo {};;` and format it with e.g. `clang-format --style=LLVM`, you'll get
> ```
> struct foo {};
> ;
> ```
> so IMO these _should_ be indistinguishible.
It might matter when removing the semicolons. We can keep the loop if we have sufficient coverage in test cases. For example, we must ensure that
```
void foo() {}; //
; int bar;
```
is not formatted to
```
void foo() {} // int bar;
```


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