clang 19.0.0git
Public Member Functions | 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"

Public Member Functions

bool operator== (const IntegerLiteralSeparatorStyle &R) const
 

Public Attributes

int8_t Binary
 Format separators in binary literals.
 
int8_t BinaryMinDigits
 Format separators in binary literals with a minimum number of digits.
 
int8_t Decimal
 Format separators in decimal literals.
 
int8_t DecimalMinDigits
 Format separators in decimal literals with a minimum number of digits.
 
int8_t Hex
 Format separators in hexadecimal literals.
 
int8_t HexMinDigits
 Format separators in hexadecimal literals with a minimum number of digits.
 

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:2968
int8_t Decimal
Format separators in decimal literals.
Definition: Format.h:2983
int8_t Hex
Format separators in hexadecimal literals.
Definition: Format.h:2998
IntegerLiteralSeparatorStyle IntegerLiteralSeparator
Format integer literal separators (' for C++ and _ for C#, Java, and JavaScript).
Definition: Format.h:3018

You can also specify a minimum number of digits (BinaryMinDigits, DecimalMinDigits, and HexMinDigits) the integer literal must have in order for the separators to be inserted.

Definition at line 2960 of file Format.h.

Member Function Documentation

◆ operator==()

bool clang::format::FormatStyle::IntegerLiteralSeparatorStyle::operator== ( const IntegerLiteralSeparatorStyle R) const
inline

Definition at line 3008 of file Format.h.

References Binary, BinaryMinDigits, Decimal, DecimalMinDigits, Hex, and HexMinDigits.

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 2968 of file Format.h.

Referenced by operator==().

◆ BinaryMinDigits

int8_t clang::format::FormatStyle::IntegerLiteralSeparatorStyle::BinaryMinDigits

Format separators in binary literals with a minimum number of digits.

// Binary: 3
// BinaryMinDigits: 7
b1 = 0b101101;
b2 = 0b1'101'101;

Definition at line 2976 of file Format.h.

Referenced by 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 2983 of file Format.h.

Referenced by clang::format::getClangFormatStyle(), and operator==().

◆ DecimalMinDigits

int8_t clang::format::FormatStyle::IntegerLiteralSeparatorStyle::DecimalMinDigits

Format separators in decimal literals with a minimum number of digits.

// Decimal: 3
// DecimalMinDigits: 5
d1 = 2023;
d2 = 10'000;

Definition at line 2991 of file Format.h.

Referenced by clang::format::getClangFormatStyle(), and 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 2998 of file Format.h.

Referenced by operator==().

◆ HexMinDigits

int8_t clang::format::FormatStyle::IntegerLiteralSeparatorStyle::HexMinDigits

Format separators in hexadecimal literals with a minimum number of digits.

// Hex: 2
// HexMinDigits: 6
h1 = 0xABCDE;
h2 = 0xAB'CD'EF;

Definition at line 3007 of file Format.h.

Referenced by operator==().


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