[cfe-dev] Request for improvements and new style options to clang-format (for a fee)

Antti Nivala via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 7 12:16:11 PST 2019


Hi,

I've experimented with clang-format and have tried to implement our current company C++ style rules with a .clang-format file. I can get pretty close, but not surprisingly, there are a few annoying aspects that I can't get clang-format to deal with in the way that we are used to. It's not necessarily about what is good style and what is not, but just that with a large existing code base, any change in style is easily perceived as a problem. I would very much like to start formatting all existing and new code with clang-format to enforce a unified style, but I need to get closer to our current internal style standard before I could enforce the usage of clang-format.

Is anyone interested in modifying/improving clang-format by adding new style options that would enable us to get as close to our current C++ style as is reasonably possible? We would be willing to pay for the work in a reasonable way.

I know we could implement the changes ourselves, but we have our hands full with the our product development tasks, so this will likely not happen as our internal work any time soon. Thus it would be great if we could "outsource" the work.

Mostly the needs for new style options or finer-grained control are related to indenting and spacing. For example, I really like the ContinuationIndentWidth option because it allows us to indent the continuation lines more than normal code block nesting. Unfortunately, the wider ContinuationIndentWidth then applies to some other places where we would not like it to apply to, such as parameters in function declarations when the parameters are on their own lines.

Then there are other very small things like we'd prefer a space between ! and the variable name as in "if( ! bSomething )".

Please reach out to me at antti.nivala at m-files.com if you are interested, or reply here. I also welcome any advise on where I should be asking for this kind of help/work if this is not the right place.

I hope these kind of improvements would be a win-win for everyone: some of the modifications might be only for us if they make no sense for clang-format in general, but I would assume that many of the new style options could be useful for others, too, so adding them to the project could be helpful for others, too.

Antti



More information about the cfe-dev mailing list