clang-format: `AlwaysBreakTemplateDeclarations: true` for LLVMStyle?

Hi guys,

Is the current setting of AlwaysBreakTemplateDeclarations: false for LLVMStyle intentional? What was the rationale?

Some rough counts on the LLVM codebase:

$ git grep -E ‘template.(class|struct).{’ – ‘.h’ '.cpp’ | wc -l

(most of them are tiny traits classes, like isPodLike or DenseMapInfo)

$ git grep -A1 -h ‘template’ – ‘.h’ '.cpp’ | egrep ‘^\s*(class|struct).*{’ | wc -l

Recently, when using clang-format I’ve had to manually go back and change cases where clang-format does not put the template <...> on its own line. I know that I could write a local .clang-format for this, but I think it should be in the LLVMStyle to begin with (barring this choice being intentional and having a reasonable rationale).

– Sean Silva

The rationale is that we introduced this option (before it was always ‘false’) and we did not know what the desired behavior for LLVM style is. Thus, we opted for not changing clang-format’s behavior.

Your numbers show to some extend that other developers are also not clear on this (3:1 is far from a clear decision). Note, that some of the 622 not-same-line-cases might in theory be due to line length making the gap even smaller (I have not double-checked that, though).

Feel free to change this flag, but I suggest getting the opinions of a few key contributors first.