https://bugs.llvm.org/show_bug.cgi?id=43734
Bug ID: 43734
Summary: Clang-format: BraceWrapping/AfterCaseLabel default
value does not match old behavior
Product: clang
Version: 9.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
With the addition of the BraceWrapping/AfterCaseLabel option the default
behavior has changed and it seems impossible to produce a .clang-format file
which produces consistent output across versions.
The following .clang-format file produces different output depending on the
clang-format version.
---
BreakBeforeBraces: Custom
BraceWrapping:
AfterControlStatement: true
AfterFunction: true
$ clang-format --version
clang-format version 7.0.0 (tags/RELEASE_700/final)
$ clang-format <<< 'switch (42) { default:{ break; } }'
switch (42)
{
default:
{
break;
}
}
$ clang-format --version
clang-format version 9.0.0 (tags/RELEASE_900/final)
$ clang-format <<< 'switch (42) { default:{ break; } }'
switch (42) {
default: {
break;
}
}
Note that adding ` AfterCaseLabel: true` restores the old behavior however
having this line stops older versions of clang-format from running.
`YAML:4:19: error: unknown key 'AfterCaseLabel'`
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs