[PATCH] D73354: clang-format: insert trailing commas into containers.

Pablo Martin-Gomez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 24 08:32:00 PST 2020


Bouska added a comment.

I have an issue with this change. Currently (at least for C++), the presence of a trailing comma is used as a formatting hint to put all the element in one line or one per line as below:

  enum test1 = {ONE, TWO, THREE};
  
  enum test2 = {
      ONE,
      TWO,
      THREE,
  };

As your change come after the formatting, clang-format won't be idempotent anymore. You are going to have the following if the container is bin packed (I did not actually test this):

  First run:  
  enum test1 = {
      ONE, TWO,
      THREE,};
  
  Second run:
  enum test1 = {
      ONE,
      TWO,
      THREE,
  };

So I definitely think this change should be done before formatting and not after.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73354





More information about the cfe-commits mailing list