[clang] [clang-format] Add xxxMaxDigitsNoSeparator (PR #164286)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 28 14:34:36 PDT 2025
HazardyKnusperkeks wrote:
> > This basically adds a Leave option for a specific range of literals.
>
> Can you elaborate? If the max decimal digits value is set to 4, and everything else is left at the default, what will be `1234`, `1'234`, and `12'34` be reformatted to? What about `12345`, `12'345`, and `12'3'45`? (Will `123` and `1'2'3` be left alone?)
As the test shows, if there is at least one separator it is corrected. Everything default will always remove the separators, so I assume:
```
Decimal: 3
DecimalMinDigits: 6
DecimalMaxDigitsNoSeparator: 4
```
* `1234`, `1'234`, and `12'34` will always become `1234`
* `12345`, and `12'345` will stay
* `12'3'45` will be corrected to `12'345`
Leave is in that case not exactly correct. Leave only talks about the choice of separator or no separator, not the placement. I've updated the example in the documentation.
https://github.com/llvm/llvm-project/pull/164286
More information about the cfe-commits
mailing list