clang  15.0.0git
Public Member Functions | Public Attributes | List of all members
clang::format::FormatStyle::AlignConsecutiveStyle Struct Reference

Alignment options. More...

#include "clang/Format/Format.h"

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

Public Member Functions

bool operator== (const AlignConsecutiveStyle &R) const
 
bool operator!= (const AlignConsecutiveStyle &R) const
 

Public Attributes

bool Enabled
 Whether aligning is enabled. More...
 
bool AcrossEmptyLines
 Whether to align across empty lines. More...
 
bool AcrossComments
 Whether to align across comments. More...
 
bool AlignCompound
 Only for AlignConsecutiveAssignments. More...
 
bool PadOperators
 Only for AlignConsecutiveAssignments. More...
 

Detailed Description

Alignment options.

They can also be read as a whole for compatibility. The choices are:

For example, to align across empty lines and not across comments, either of these work.

Definition at line 160 of file Format.h.

Member Function Documentation

◆ operator!=()

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

Definition at line 248 of file Format.h.

◆ operator==()

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

Definition at line 243 of file Format.h.

References AcrossComments, AcrossEmptyLines, AlignCompound, Enabled, and PadOperators.

Member Data Documentation

◆ AcrossComments

bool clang::format::FormatStyle::AlignConsecutiveStyle::AcrossComments

Whether to align across comments.

true:
int d = 3;
/* A comment. */
double e = 4;
false:
int d = 3;
/* A comment. */
double e = 4;

Definition at line 211 of file Format.h.

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

◆ AcrossEmptyLines

bool clang::format::FormatStyle::AlignConsecutiveStyle::AcrossEmptyLines

Whether to align across empty lines.

true:
int a = 1;
int somelongname = 2;
double c = 3;
int d = 3;
false:
int a = 1;
int somelongname = 2;
double c = 3;
int d = 3;

Definition at line 198 of file Format.h.

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

◆ AlignCompound

bool clang::format::FormatStyle::AlignConsecutiveStyle::AlignCompound

Only for AlignConsecutiveAssignments.

Whether compound assignments like += are aligned along with =.

true:
a &= 2;
bbb = 2;
false:
a &= 2;
bbb = 2;

Definition at line 223 of file Format.h.

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

◆ Enabled

bool clang::format::FormatStyle::AlignConsecutiveStyle::Enabled

Whether aligning is enabled.

#define SHORT_NAME 42
#define LONGER_NAME 0x007f
#define EVEN_LONGER_NAME (2)
#define foo(x) (x * x)
#define bar(y, z) (y + z)
int a = 1;
int somelongname = 2;
double c = 3;
int aaaa : 1;
int b : 12;
int ccc : 8;
int aaaa = 12;
float b = 23;

Definition at line 181 of file Format.h.

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

◆ PadOperators

bool clang::format::FormatStyle::AlignConsecutiveStyle::PadOperators

Only for AlignConsecutiveAssignments.

Whether short assignment operators are left-padded to the same length as long ones in order to put all assignment operators to the right of the left hand side.

true:
a >>= 2;
bbb = 2;
a = 2;
bbb >>= 2;
false:
a >>= 2;
bbb = 2;
a = 2;
bbb >>= 2;

Definition at line 242 of file Format.h.

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


The documentation for this struct was generated from the following file:
clang::format::FormatStyle::AlignConsecutiveStyle::Enabled
bool Enabled
Whether aligning is enabled.
Definition: Format.h:181
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
b
__device__ __2f16 b
Definition: __clang_hip_libdevice_declares.h:314
clang::format::FormatStyle::AlignConsecutiveStyle::AcrossEmptyLines
bool AcrossEmptyLines
Whether to align across empty lines.
Definition: Format.h:198
clang::format::FormatStyle::AlignConsecutiveMacros
AlignConsecutiveStyle AlignConsecutiveMacros
Style of aligning consecutive macro definitions.
Definition: Format.h:264
clang::format::FormatStyle::AlignConsecutiveStyle::AcrossComments
bool AcrossComments
Whether to align across comments.
Definition: Format.h:211
c
__device__ __2f16 float c
Definition: __clang_hip_libdevice_declares.h:315