[PATCH] D42729: clang-format: Fix formatting of function body followed by semicolon

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 06:05:17 PST 2018


Typz added a comment.

In https://reviews.llvm.org/D42729#993159, @djasper wrote:

> I think this case is not important enough to fix. Please tell users to just delete the useless semicolon.


I would agree if were simple to spot: but often this may manifest itself only with a missing space between the function parameters and the function body, which can easily be overlooked...
Another option may be to create new pass which "removes" that extra semicolon: this way we would both fix it and get things right on next pass.

However, the issue with a function which contains only a macro and which is followed by another function which returns an custom type cannot so easily be fixed:

  void abort() {
    FOO()
  }
  uint32_t bar() {}

(note that this case works fine if the body of the function contains a semicolon or reserved keyword, or if the next function returns a base type [int, void...])


Repository:
  rC Clang

https://reviews.llvm.org/D42729





More information about the cfe-commits mailing list