clang 17.0.0git
Public Attributes | List of all members
clang::format::FormatStyle::IntegerLiteralSeparatorStyle Struct Reference

Separator format of integer literals of different bases. More...

#include "clang/Format/Format.h"

Collaboration diagram for clang::format::FormatStyle::IntegerLiteralSeparatorStyle:
Collaboration graph
[legend]

Public Attributes

int8_t Binary
 Format separators in binary literals.
 
int8_t Decimal
 Format separators in decimal literals.
 
int8_t Hex
 Format separators in hexadecimal literals.
 

Detailed Description

Separator format of integer literals of different bases.

If negative, remove separators. If 0, leave the literal as is. If positive, insert separators between digits starting from the rightmost digit.

For example, the config below will leave separators in binary literals alone, insert separators in decimal literals to separate the digits into groups of 3, and remove separators in hexadecimal literals.

Binary: 0
Hex: -1
int8_t Binary
Format separators in binary literals.
Definition: Format.h:2511
int8_t Decimal
Format separators in decimal literals.
Definition: Format.h:2518
int8_t Hex
Format separators in hexadecimal literals.
Definition: Format.h:2525
IntegerLiteralSeparatorStyle IntegerLiteralSeparator
Format integer literal separators (' for C++ and _ for C#, Java, and JavaScript).
Definition: Format.h:2531

Definition at line 2503 of file Format.h.

Member Data Documentation

◆ Binary

int8_t clang::format::FormatStyle::IntegerLiteralSeparatorStyle::Binary

Format separators in binary literals.

/* -1: */ b = 0b100111101101;
/* 0: */ b = 0b10011'11'0110'1;
/* 3: */ b = 0b100'111'101'101;
/* 4: */ b = 0b1001'1110'1101;

Definition at line 2511 of file Format.h.

Referenced by clang::format::FormatStyle::operator==().

◆ Decimal

int8_t clang::format::FormatStyle::IntegerLiteralSeparatorStyle::Decimal

Format separators in decimal literals.

/* -1: */ d = 18446744073709550592ull;
/* 0: */ d = 184467'440737'0'95505'92ull;
/* 3: */ d = 18'446'744'073'709'550'592ull;

Definition at line 2518 of file Format.h.

Referenced by clang::format::FormatStyle::operator==().

◆ Hex

int8_t clang::format::FormatStyle::IntegerLiteralSeparatorStyle::Hex

Format separators in hexadecimal literals.

/* -1: */ h = 0xDEADBEEFDEADBEEFuz;
/* 0: */ h = 0xDEAD'BEEF'DE'AD'BEE'Fuz;
/* 2: */ h = 0xDE'AD'BE'EF'DE'AD'BE'EFuz;

Definition at line 2525 of file Format.h.

Referenced by clang::format::FormatStyle::operator==().


The documentation for this struct was generated from the following file: