Enum formatting changes - polly automatic formatting verifier

Tobias Grosser tobias at grosser.es
Sun Jan 5 06:58:20 PST 2014


On 01/05/2014 02:13 PM, Daniel Jasper wrote:
> Tobias, could you submit the two small formatting changes that are
> required? I am not entirely certain whether it would be ok for me to just
> submit patches to polly. Also I don't think it would be a good idea for
> clang-format developers to be required to ensure other projects' adherence
> to what clang-format deems to be correct style.

Hi Daniel,

thanks for letting me know. You are not required to fix Polly, but if 
there is an obvious and easy fix, I would be more than happy if you do 
so (it also keeps the buildbot noise down). For non-obvious changes I 
would prefer a short pre-commit mail (or just an headsup as today). 
However, if the style change is non-obvious it would be great if you 
could make it off by default for LLVM and give a short headsup on the 
mailing list such that I can prepare a patch for Polly.

Regarding the change today, I wonder how you figured out that the new 
formatting is 'the predominant choice' in LLVM/clang? I just checked 
what formatting is more common in LLVM/clang by counting the one line 
enums in the current LLVM and clang code and after running the latest 
clang-format over all .cpp and .h files.

I use the following grep call to count:

grep -R 'enum.*{.*}.*;' tools/clang/lib/ lib/ include/ \
                         tools/clang/include | wc

I get 259 cases for the current formatting and 531 for the reformatted 
code, which means 272 cases use currently a multi line formatting.

It seems the one line formatting is actually slightly less common in the 
LLVM/clang files. I also don't believe that the new style buys us 
anything in readability.

I would prefer clang-format to remain consistent between versions,
as long as there is no good reason to break this consistency. 
Consequently, I wonder if it would not make sense to use the old style 
in LLVM mode?

Cheers,
Tobias



More information about the llvm-commits mailing list