[PATCH] D155239: [clang-format] Add SpacesInParens with SpacesInParensOptions

Gedare Bloom via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 15:49:30 PDT 2023


gedare added a comment.

In D155239#4509921 <https://reviews.llvm.org/D155239#4509921>, @HazardyKnusperkeks wrote:

> If you limit it to `Never` I don't see any value in the differentiation. You could just always use `Custom` (by dropping the custom and only having the nested options).
>
> But I think having at least the `Always` option would be nice. If you want **always** to have a space and you set everything by hand to true, someone comes along and adds a new option (which then is defaulted to `false`) you don't get what you want.

Having `Custom` simplifies detecting if the new options are being used. It is possible to add an `Always` option if someone wants it, but that option has not existed yet for `clang-format`.



================
Comment at: clang/lib/Format/Format.cpp:1035
     IO.mapOptional("SpaceInEmptyBlock", Style.SpaceInEmptyBlock);
-    IO.mapOptional("SpaceInEmptyParentheses", Style.SpaceInEmptyParentheses);
     IO.mapOptional("SpacesBeforeTrailingComments",
----------------
HazardyKnusperkeks wrote:
> MyDeveloperDay wrote:
> > By removing the old options don’t you break everyone’s clang format file
> You need to parse all of the old options, and map them to the new one, if and only if the old one(s) is/are set and the new is not! See below for the other deprecated options.
Got it, I misunderstood how to handle deprecated options (twice). I think I have that sorted now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155239



More information about the cfe-commits mailing list