Issue 131510
Summary [clang-format] Feature Request: FloatingPointLiteralSeparator
Labels clang-format
Assignees
Reporter xhrnca00
    Clang-format already has an `IntegerLiteralSeparator` option that adds separators to integer literals. When I started using it, it confused me there was no alternative for floating point literals.

It would be great to either:
1. Add a new option called `FloatingPointLiteralSeparator`, which would do the same as its integer alternative, only for floating point literals.
2. Expand the existing `IntegerLiteralSeparator` to apply the formatting to floating point literals.

I was imagining something like:
```yaml
# .clang-format
FloatingPointLiteralSeparator:
  Decimal: 3
 DecimalMinDigits: 5
  Hex: 4
  HexMinDigits: 5
```
The resulting format could look like this:
```C
// Before
double decimal = 12345678.12345678e-50;
double hexa = 0x1234567.89abcdfp-100;

// After
double decimal = 12'345'678.123'456'78e-50;
double hexa = 0x123'4567.89ab'cdfp-100;
```


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to