[cfe-dev] clang-format version incompatibility

Renato Golin via cfe-dev cfe-dev at lists.llvm.org
Thu Oct 15 01:15:41 PDT 2020


On Wed, 14 Oct 2020 at 23:21, Sam McCall <sammccall at google.com> wrote:

> AFAIK this is in principle expected, clang-format doesn't place a high
> prioriy on having stable formatting results across major versions.
> This is a tradeoff, requiring formatting to stay stable implies not fixing
> bugs.
>

Agreed.

In some workflows you can mitigate this by formatting/checking changed
> lines, which at least reduces the surface area.
> But this is certainly a pain point if you want to enforce style with CI in
> a diverse environment.
> At work, we enforce the same version of clang-format on all clients and CI.
>

That's what we do, too. I think we'll just have to update the version of
clang-format and require everyone to upgrade theirs, too.

I'll add a line to the "contributing" document about that.

In a JS-based package I work on, we use the clang-format npm package
> <https://www.npmjs.com/package/clang-format> to pin the version.
>

Arch Linux has a "clang-format-static-bin" which puts all statically
compiled versions in /opt. But it would be good to have a solution that
works on all platforms, including Windows.

This looks like a bugfix to me. I think deduction guides were basically
> unsupported and broken in 9.
>

Right, I do prefer the new formatting, but had to revert to using version 9
for the CI.

clang-format-9:
>>       return {MeetType::get(ctx, readElements),
>>               JoinType::get(ctx, writeElements)};
>>
>> clang-format-10:
>>       return {
>>         MeetType::get(ctx, readElements), JoinType::get(ctx,
>> writeElements)};
>>
> Less clear to me what's going on here, but I also suspect a bugfix.
> The docs say "Fundamentally, C++11 braced lists are formatted exactly like
> function calls would be formatted in their place.".
>

If that's true, then wouldn't the last curly brace + semicolon need to be
in a new line, too?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201015/7a4b4aeb/attachment-0001.html>


More information about the cfe-dev mailing list