[PATCH] D32525: [clang-format] Add SpaceBeforeColon option

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 23 05:17:22 PDT 2017

Typz added a comment.

In https://reviews.llvm.org/D32525#760710, @djasper wrote:

> Then you also (accidentally?) change the spacing in dict literals. However, the latter is already controlled by SpacesInContainerLiterals.

not really accidentally: I want the space on the 'outside' of dict literals, but not before the the colons. Something like:

  [ a: 1, b: 2 ]
  f({ a: 1, b: 2, c: 3 }); 

(btw this option does not seem to affect the space on the 'outside' of dict literals with curly braces. Is this a bug/side effect, or an actual expected behavior? This specific case would also happen for C99 designated literals)

The "logic" behind this patch is that it affects all cases where the colon is used as a separator, but not as a label or operator: e.g. where it would make some sense to format it similarly to a semi-colon. I am not sure where the assembly stands in this regard, though.


More information about the cfe-commits mailing list