clang  14.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
clang::format::FormatStyle Struct Reference

The FormatStyle is used to configure the formatting to follow specific guidelines. More...

#include "clang/Format/Format.h"

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

Classes

struct  BraceWrappingFlags
 Precise control over the wrapping of braces. More...
 
struct  FormatStyleSet
 
struct  RawStringFormat
 See documentation of RawStringFormats. More...
 
struct  SpacesInLineComment
 Control of spaces within a single line comment. More...
 

Public Types

enum  BracketAlignmentStyle : unsigned char { BAS_Align, BAS_DontAlign, BAS_AlwaysBreak }
 Different styles for aligning after open brackets. More...
 
enum  ArrayInitializerAlignmentStyle { AIAS_Left, AIAS_Right, AIAS_None }
 Different style for aligning array initializers. More...
 
enum  AlignConsecutiveStyle {
  ACS_None, ACS_Consecutive, ACS_AcrossEmptyLines, ACS_AcrossComments,
  ACS_AcrossEmptyLinesAndComments
}
 Styles for alignment of consecutive tokens. More...
 
enum  EscapedNewlineAlignmentStyle : unsigned char { ENAS_DontAlign, ENAS_Left, ENAS_Right }
 Different styles for aligning escaped newlines. More...
 
enum  OperandAlignmentStyle : unsigned char { OAS_DontAlign, OAS_Align, OAS_AlignAfterOperator }
 Different styles for aligning operands. More...
 
enum  ShortBlockStyle : unsigned char { SBS_Never, SBS_Empty, SBS_Always }
 Different styles for merging short blocks containing at most one statement. More...
 
enum  ShortFunctionStyle : unsigned char {
  SFS_None, SFS_InlineOnly, SFS_Empty, SFS_Inline,
  SFS_All
}
 Different styles for merging short functions containing at most one statement. More...
 
enum  ShortIfStyle : unsigned char { SIS_Never, SIS_WithoutElse, SIS_OnlyFirstIf, SIS_AllIfsAndElse }
 Different styles for handling short if statements. More...
 
enum  ShortLambdaStyle : unsigned char { SLS_None, SLS_Empty, SLS_Inline, SLS_All }
 Different styles for merging short lambdas containing at most one statement. More...
 
enum  DefinitionReturnTypeBreakingStyle : unsigned char { DRTBS_None, DRTBS_All, DRTBS_TopLevel }
 Different ways to break after the function definition return type. More...
 
enum  ReturnTypeBreakingStyle : unsigned char {
  RTBS_None, RTBS_All, RTBS_TopLevel, RTBS_AllDefinitions,
  RTBS_TopLevelDefinitions
}
 Different ways to break after the function definition or declaration return type. More...
 
enum  BreakTemplateDeclarationsStyle : unsigned char { BTDS_No, BTDS_MultiLine, BTDS_Yes }
 Different ways to break after the template declaration. More...
 
enum  TrailingCommaStyle : unsigned char { TCS_None, TCS_Wrapped }
 The style of inserting trailing commas into container literals. More...
 
enum  BinPackStyle : unsigned char { BPS_Auto, BPS_Always, BPS_Never }
 The style of wrapping parameters on the same line (bin-packed) or on one line each. More...
 
enum  BinaryOperatorStyle : unsigned char { BOS_None, BOS_NonAssignment, BOS_All }
 The style of breaking before or after binary operators. More...
 
enum  BraceBreakingStyle : unsigned char {
  BS_Attach, BS_Linux, BS_Mozilla, BS_Stroustrup,
  BS_Allman, BS_Whitesmiths, BS_GNU, BS_WebKit,
  BS_Custom
}
 Different ways to attach braces to their surrounding context. More...
 
enum  BraceWrappingAfterControlStatementStyle : unsigned char { BWACS_Never, BWACS_MultiLine, BWACS_Always }
 Different ways to wrap braces after control statements. More...
 
enum  BreakConstructorInitializersStyle : unsigned char { BCIS_BeforeColon, BCIS_BeforeComma, BCIS_AfterColon }
 Different ways to break initializers. More...
 
enum  QualifierAlignmentStyle { QAS_Leave, QAS_Left, QAS_Right, QAS_Custom }
 Different specifiers and qualifiers alignment styles. More...
 
enum  BreakInheritanceListStyle : unsigned char { BILS_BeforeColon, BILS_BeforeComma, BILS_AfterColon, BILS_AfterComma }
 Different ways to break inheritance list. More...
 
enum  EmptyLineAfterAccessModifierStyle : unsigned char { ELAAMS_Never, ELAAMS_Leave, ELAAMS_Always }
 Different styles for empty line after access modifiers. More...
 
enum  EmptyLineBeforeAccessModifierStyle : unsigned char { ELBAMS_Never, ELBAMS_Leave, ELBAMS_LogicalBlock, ELBAMS_Always }
 Different styles for empty line before access modifiers. More...
 
enum  PackConstructorInitializersStyle : unsigned char { PCIS_Never, PCIS_BinPack, PCIS_CurrentLine, PCIS_NextLine }
 Different ways to try to fit all constructor initializers on a line. More...
 
enum  PPDirectiveIndentStyle : unsigned char { PPDIS_None, PPDIS_AfterHash, PPDIS_BeforeHash }
 Options for indenting preprocessor directives. More...
 
enum  IndentExternBlockStyle : unsigned char { IEBS_AfterExternBlock, IEBS_NoIndent, IEBS_Indent }
 Indents extern blocks. More...
 
enum  JavaScriptQuoteStyle : unsigned char { JSQS_Leave, JSQS_Single, JSQS_Double }
 Quotation styles for JavaScript strings. More...
 
enum  LanguageKind : unsigned char {
  LK_None, LK_Cpp, LK_CSharp, LK_Java,
  LK_JavaScript, LK_Json, LK_ObjC, LK_Proto,
  LK_TableGen, LK_TextProto
}
 Supported languages. More...
 
enum  LambdaBodyIndentationKind : unsigned char { LBI_Signature, LBI_OuterScope }
 Indentation logic for lambda bodies. More...
 
enum  NamespaceIndentationKind : unsigned char { NI_None, NI_Inner, NI_All }
 Different ways to indent namespace contents. More...
 
enum  PointerAlignmentStyle : unsigned char { PAS_Left, PAS_Right, PAS_Middle }
 The &, && and * alignment style. More...
 
enum  ReferenceAlignmentStyle { RAS_Pointer, RAS_Left, RAS_Right, RAS_Middle }
 The & and && alignment style. More...
 
enum  SortIncludesOptions : unsigned char { SI_Never, SI_CaseSensitive, SI_CaseInsensitive }
 Include sorting options. More...
 
enum  SortJavaStaticImportOptions : unsigned char { SJSIO_Before, SJSIO_After }
 Position for Java Static imports. More...
 
enum  SpaceAroundPointerQualifiersStyle : unsigned char { SAPQ_Default, SAPQ_Before, SAPQ_After, SAPQ_Both }
 Different ways to put a space before opening parentheses. More...
 
enum  SpaceBeforeParensOptions : unsigned char {
  SBPO_Never, SBPO_ControlStatements, SBPO_ControlStatementsExceptControlMacros, SBPO_NonEmptyParentheses,
  SBPO_Always
}
 Different ways to put a space before opening parentheses. More...
 
enum  SpacesInAnglesStyle : unsigned char { SIAS_Never, SIAS_Always, SIAS_Leave }
 Styles for adding spacing after < and before `> in template argument lists. More...
 
enum  BitFieldColonSpacingStyle : unsigned char { BFCS_Both, BFCS_None, BFCS_Before, BFCS_After }
 Styles for adding spacing around : in bitfield definitions. More...
 
enum  LanguageStandard : unsigned char {
  LS_Cpp03, LS_Cpp11, LS_Cpp14, LS_Cpp17,
  LS_Cpp20, LS_Latest, LS_Auto
}
 Supported language standards for parsing and formatting C++ constructs. More...
 
enum  UseTabStyle : unsigned char {
  UT_Never, UT_ForIndentation, UT_ForContinuationAndIndentation, UT_AlignWithSpaces,
  UT_Always
}
 Different ways to use tab in formatting. More...
 

Public Member Functions

bool isCpp () const
 
bool isCSharp () const
 
bool isJson () const
 
bool operator== (const FormatStyle &R) const
 
llvm::Optional< FormatStyleGetLanguageStyle (LanguageKind Language) const
 

Static Public Member Functions

static FormatStyleSet BuildStyleSetFromConfiguration (const FormatStyle &MainStyle, const std::vector< FormatStyle > &ConfigurationStyles)
 

Public Attributes

bool InheritsParentConfig
 
int AccessModifierOffset
 The extra indent or outdent of access modifiers, e.g. More...
 
BracketAlignmentStyle AlignAfterOpenBracket
 If true, horizontally aligns arguments after an open bracket. More...
 
ArrayInitializerAlignmentStyle AlignArrayOfStructures
 if not None, when using initialization for an array of structs aligns the fields into columns. More...
 
AlignConsecutiveStyle AlignConsecutiveMacros
 Style of aligning consecutive macro definitions. More...
 
AlignConsecutiveStyle AlignConsecutiveAssignments
 Style of aligning consecutive assignments. More...
 
AlignConsecutiveStyle AlignConsecutiveBitFields
 Style of aligning consecutive bit field. More...
 
AlignConsecutiveStyle AlignConsecutiveDeclarations
 Style of aligning consecutive declarations. More...
 
EscapedNewlineAlignmentStyle AlignEscapedNewlines
 Options for aligning backslashes in escaped newlines. More...
 
OperandAlignmentStyle AlignOperands
 If true, horizontally align operands of binary and ternary expressions. More...
 
bool AlignTrailingComments
 If true, aligns trailing comments. More...
 
bool AllowAllArgumentsOnNextLine
 If a function call or braced initializer list doesn't fit on a line, allow putting all arguments onto the next line, even if BinPackArguments is false. More...
 
bool AllowAllConstructorInitializersOnNextLine
 This option is deprecated. More...
 
bool AllowAllParametersOfDeclarationOnNextLine
 If the function declaration doesn't fit on a line, allow putting all parameters of a function declaration onto the next line even if BinPackParameters is false. More...
 
bool AllowShortEnumsOnASingleLine
 Allow short enums on a single line. More...
 
ShortBlockStyle AllowShortBlocksOnASingleLine
 Dependent on the value, while (true) { continue; } can be put on a single line. More...
 
bool AllowShortCaseLabelsOnASingleLine
 If true, short case labels will be contracted to a single line. More...
 
ShortFunctionStyle AllowShortFunctionsOnASingleLine
 Dependent on the value, int f() { return 0; } can be put on a single line. More...
 
ShortIfStyle AllowShortIfStatementsOnASingleLine
 Dependent on the value, if (a) return; can be put on a single line. More...
 
ShortLambdaStyle AllowShortLambdasOnASingleLine
 Dependent on the value, auto lambda []() { return 0; } can be put on a single line. More...
 
bool AllowShortLoopsOnASingleLine
 If true, while (true) continue; can be put on a single line. More...
 
DefinitionReturnTypeBreakingStyle AlwaysBreakAfterDefinitionReturnType
 The function definition return type breaking style to use. More...
 
ReturnTypeBreakingStyle AlwaysBreakAfterReturnType
 The function declaration return type breaking style to use. More...
 
bool AlwaysBreakBeforeMultilineStrings
 If true, always break before multiline string literals. More...
 
BreakTemplateDeclarationsStyle AlwaysBreakTemplateDeclarations
 The template declaration breaking style to use. More...
 
std::vector< std::stringAttributeMacros
 A vector of strings that should be interpreted as attributes/qualifiers instead of identifiers. More...
 
bool BinPackArguments
 If false, a function call's arguments will either be all on the same line or will have one line each. More...
 
TrailingCommaStyle InsertTrailingCommas
 If set to TCS_Wrapped will insert trailing commas in container literals (arrays and objects) that wrap across multiple lines. More...
 
bool BinPackParameters
 If false, a function declaration's or function definition's parameters will either all be on the same line or will have one line each. More...
 
BinaryOperatorStyle BreakBeforeBinaryOperators
 The way to wrap binary operators. More...
 
BraceBreakingStyle BreakBeforeBraces
 The brace breaking style to use. More...
 
BraceWrappingFlags BraceWrapping
 Control of individual brace wrapping cases. More...
 
bool BreakBeforeConceptDeclarations
 If true, concept will be placed on a new line. More...
 
bool BreakBeforeTernaryOperators
 If true, ternary operators will be placed after line breaks. More...
 
BreakConstructorInitializersStyle BreakConstructorInitializers
 The break constructor initializers style to use. More...
 
bool BreakAfterJavaFieldAnnotations
 Break after each annotation on a field in Java files. More...
 
bool BreakStringLiterals
 Allow breaking string literals when formatting. More...
 
unsigned ColumnLimit
 The column limit. More...
 
std::string CommentPragmas
 A regular expression that describes comments with special meaning, which should not be split into lines or otherwise changed. More...
 
QualifierAlignmentStyle QualifierAlignment
 Different ways to arrange specifiers and qualifiers (e.g. More...
 
std::vector< std::stringQualifierOrder
 The order in which the qualifiers appear. More...
 
BreakInheritanceListStyle BreakInheritanceList
 The inheritance list style to use. More...
 
bool CompactNamespaces
 If true, consecutive namespace declarations will be on the same line. More...
 
bool ConstructorInitializerAllOnOneLineOrOnePerLine
 This option is deprecated. More...
 
unsigned ConstructorInitializerIndentWidth
 The number of characters to use for indentation of constructor initializer lists as well as inheritance lists. More...
 
unsigned ContinuationIndentWidth
 Indent width for line continuations. More...
 
bool Cpp11BracedListStyle
 If true, format braced lists as best suited for C++11 braced lists. More...
 
bool DeriveLineEnding
 Analyze the formatted file for the most used line ending (\r\n or \n). More...
 
bool DerivePointerAlignment
 If true, analyze the formatted file for the most common alignment of & and *. More...
 
bool DisableFormat
 Disables formatting completely. More...
 
EmptyLineAfterAccessModifierStyle EmptyLineAfterAccessModifier
 Defines when to put an empty line after access modifiers. More...
 
EmptyLineBeforeAccessModifierStyle EmptyLineBeforeAccessModifier
 Defines in which cases to put empty line before access modifiers. More...
 
bool ExperimentalAutoDetectBinPacking
 If true, clang-format detects whether function calls and definitions are formatted with one parameter per line. More...
 
PackConstructorInitializersStyle PackConstructorInitializers
 The pack constructor initializers style to use. More...
 
bool FixNamespaceComments
 If true, clang-format adds missing namespace end comments for short namespaces and fixes invalid existing ones. More...
 
std::vector< std::stringForEachMacros
 A vector of macros that should be interpreted as foreach loops instead of as function calls. More...
 
std::vector< std::stringIfMacros
 A vector of macros that should be interpreted as conditionals instead of as function calls. More...
 
std::vector< std::stringTypenameMacros
 A vector of macros that should be interpreted as type declarations instead of as function calls. More...
 
std::vector< std::stringStatementMacros
 A vector of macros that should be interpreted as complete statements. More...
 
std::vector< std::stringNamespaceMacros
 A vector of macros which are used to open namespace blocks. More...
 
std::vector< std::stringWhitespaceSensitiveMacros
 A vector of macros which are whitespace-sensitive and should not be touched. More...
 
tooling::IncludeStyle IncludeStyle
 
bool IndentAccessModifiers
 Specify whether access modifiers should have their own indentation level. More...
 
bool IndentCaseLabels
 Indent case labels one level from the switch statement. More...
 
bool IndentCaseBlocks
 Indent case label blocks one level from the case label. More...
 
bool IndentGotoLabels
 Indent goto labels. More...
 
PPDirectiveIndentStyle IndentPPDirectives
 The preprocessor directive indenting style to use. More...
 
IndentExternBlockStyle IndentExternBlock
 IndentExternBlockStyle is the type of indenting of extern blocks. More...
 
bool IndentRequires
 Indent the requires clause in a template. More...
 
unsigned IndentWidth
 The number of columns to use for indentation. More...
 
bool IndentWrappedFunctionNames
 Indent if a function definition or declaration is wrapped after the type. More...
 
std::vector< std::stringJavaImportGroups
 A vector of prefixes ordered by the desired groups for Java imports. More...
 
JavaScriptQuoteStyle JavaScriptQuotes
 The JavaScriptQuoteStyle to use for JavaScript strings. More...
 
bool JavaScriptWrapImports
 Whether to wrap JavaScript import/export statements. More...
 
bool KeepEmptyLinesAtTheStartOfBlocks
 If true, the empty line at the start of blocks is kept. More...
 
LanguageKind Language
 Language, this format style is targeted at. More...
 
LambdaBodyIndentationKind LambdaBodyIndentation
 The indentation style of lambda bodies. More...
 
std::string MacroBlockBegin
 A regular expression matching macros that start a block. More...
 
std::string MacroBlockEnd
 A regular expression matching macros that end a block. More...
 
unsigned MaxEmptyLinesToKeep
 The maximum number of consecutive empty lines to keep. More...
 
NamespaceIndentationKind NamespaceIndentation
 The indentation used for namespaces. More...
 
BinPackStyle ObjCBinPackProtocolList
 Controls bin-packing Objective-C protocol conformance list items into as few lines as possible when they go over ColumnLimit. More...
 
unsigned ObjCBlockIndentWidth
 The number of characters to use for indentation of ObjC blocks. More...
 
bool ObjCSpaceAfterProperty
 Add a space after @property in Objective-C, i.e. More...
 
bool ObjCBreakBeforeNestedBlockParam
 Break parameters list into lines when there is nested block parameters in a function call. More...
 
bool ObjCSpaceBeforeProtocolList
 Add a space in front of an Objective-C protocol list, i.e. More...
 
unsigned PenaltyBreakAssignment
 The penalty for breaking around an assignment operator. More...
 
unsigned PenaltyBreakBeforeFirstCallParameter
 The penalty for breaking a function call after call(. More...
 
unsigned PenaltyBreakComment
 The penalty for each line break introduced inside a comment. More...
 
unsigned PenaltyBreakFirstLessLess
 The penalty for breaking before the first <<. More...
 
unsigned PenaltyBreakString
 The penalty for each line break introduced inside a string literal. More...
 
unsigned PenaltyBreakTemplateDeclaration
 The penalty for breaking after template declaration. More...
 
unsigned PenaltyExcessCharacter
 The penalty for each character outside of the column limit. More...
 
unsigned PenaltyReturnTypeOnItsOwnLine
 Penalty for putting the return type of a function onto its own line. More...
 
unsigned PenaltyIndentedWhitespace
 Penalty for each character of whitespace indentation (counted relative to leading non-whitespace column). More...
 
PointerAlignmentStyle PointerAlignment
 Pointer and reference alignment style. More...
 
int PPIndentWidth
 The number of columns to use for indentation of preprocessor statements. More...
 
std::vector< RawStringFormatRawStringFormats
 Defines hints for detecting supported languages code blocks in raw strings. More...
 
ReferenceAlignmentStyle ReferenceAlignment
 Reference alignment style (overrides PointerAlignment for references). More...
 
bool ReflowComments
 If true, clang-format will attempt to re-flow comments. More...
 
unsigned ShortNamespaceLines
 The maximal number of unwrapped lines that a short namespace spans. More...
 
SortIncludesOptions SortIncludes
 Controls if and how clang-format will sort #includes. More...
 
SortJavaStaticImportOptions SortJavaStaticImport
 When sorting Java imports, by default static imports are placed before non-static imports. More...
 
bool SortUsingDeclarations
 If true, clang-format will sort using declarations. More...
 
bool SpaceAfterCStyleCast
 If true, a space is inserted after C style casts. More...
 
bool SpaceAfterLogicalNot
 If true, a space is inserted after the logical not operator (!). More...
 
bool SpaceAfterTemplateKeyword
 If true, a space will be inserted after the 'template' keyword. More...
 
SpaceAroundPointerQualifiersStyle SpaceAroundPointerQualifiers
 Defines in which cases to put a space before or after pointer qualifiers. More...
 
bool SpaceBeforeAssignmentOperators
 If false, spaces will be removed before assignment operators. More...
 
bool SpaceBeforeCaseColon
 If false, spaces will be removed before case colon. More...
 
bool SpaceBeforeCpp11BracedList
 If true, a space will be inserted before a C++11 braced list used to initialize an object (after the preceding identifier or type). More...
 
bool SpaceBeforeCtorInitializerColon
 If false, spaces will be removed before constructor initializer colon. More...
 
bool SpaceBeforeInheritanceColon
 If false, spaces will be removed before inheritance colon. More...
 
SpaceBeforeParensOptions SpaceBeforeParens
 Defines in which cases to put a space before opening parentheses. More...
 
bool SpaceBeforeRangeBasedForLoopColon
 If false, spaces will be removed before range-based for loop colon. More...
 
bool SpaceInEmptyBlock
 If true, spaces will be inserted into {}. More...
 
bool SpaceInEmptyParentheses
 If true, spaces may be inserted into (). More...
 
unsigned SpacesBeforeTrailingComments
 The number of spaces before trailing line comments (// - comments). More...
 
SpacesInAnglesStyle SpacesInAngles
 The SpacesInAnglesStyle to use for template argument lists. More...
 
bool SpacesInConditionalStatement
 If true, spaces will be inserted around if/for/switch/while conditions. More...
 
bool SpacesInContainerLiterals
 If true, spaces are inserted inside container literals (e.g. More...
 
bool SpacesInCStyleCastParentheses
 If true, spaces may be inserted into C style casts. More...
 
SpacesInLineComment SpacesInLineCommentPrefix
 How many spaces are allowed at the start of a line comment. More...
 
bool SpacesInParentheses
 If true, spaces will be inserted after ( and before ). More...
 
bool SpacesInSquareBrackets
 If true, spaces will be inserted after [ and before ]. More...
 
bool SpaceBeforeSquareBrackets
 If true, spaces will be before [. More...
 
BitFieldColonSpacingStyle BitFieldColonSpacing
 The BitFieldColonSpacingStyle to use for bitfields. More...
 
LanguageStandard Standard
 Parse and format C++ constructs compatible with this standard. More...
 
std::vector< std::stringStatementAttributeLikeMacros
 Macros which are ignored in front of a statement, as if they were an attribute. More...
 
unsigned TabWidth
 The number of columns used for tab stops. More...
 
bool UseCRLF
 Use \r\n instead of \n for line breaks. More...
 
UseTabStyle UseTab
 The way to use tab characters in the resulting file. More...
 

Friends

std::error_code parseConfiguration (llvm::MemoryBufferRef Config, FormatStyle *Style, bool AllowUnknownOptions, llvm::SourceMgr::DiagHandlerTy DiagHandler, void *DiagHandlerCtxt)
 Parse configuration from YAML-formatted text. More...
 

Detailed Description

The FormatStyle is used to configure the formatting to follow specific guidelines.

Definition at line 59 of file Format.h.

Member Enumeration Documentation

◆ AlignConsecutiveStyle

Styles for alignment of consecutive tokens.

Tokens can be assignment signs (see AlignConsecutiveAssignments), bitfield member separators (see AlignConsecutiveBitFields), names in declarations (see AlignConsecutiveDeclarations) or macro definitions (see AlignConsecutiveMacros).

Enumerator
ACS_None 
ACS_Consecutive 
ACS_AcrossEmptyLines 
ACS_AcrossComments 
ACS_AcrossEmptyLinesAndComments 

Definition at line 135 of file Format.h.

◆ ArrayInitializerAlignmentStyle

Different style for aligning array initializers.

Enumerator
AIAS_Left 

Align array column and left justify the columns e.g.

:

struct test demo[] =
{
{56, 23, "hello"},
{-1, 93463, "world"},
{7, 5, "!!" }
};
AIAS_Right 

Align array column and right justify the columns e.g.

:

struct test demo[] =
{
{56, 23, "hello"},
{-1, 93463, "world"},
{ 7, 5, "!!"}
};
AIAS_None 

Don't align array initializer columns.

Definition at line 100 of file Format.h.

◆ BinaryOperatorStyle

The style of breaking before or after binary operators.

Enumerator
BOS_None 

Break after operators.

LooooooooooongType loooooooooooooooooooooongVariable =
someLooooooooooooooooongFunction();
bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ==
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >
ccccccccccccccccccccccccccccccccccccccccc;
BOS_NonAssignment 

Break before operators that aren't assignments.

LooooooooooongType loooooooooooooooooooooongVariable =
someLooooooooooooooooongFunction();
bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
== aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
&& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> ccccccccccccccccccccccccccccccccccccccccc;
BOS_All 

Break before operators.

LooooooooooongType loooooooooooooooooooooongVariable
= someLooooooooooooooooongFunction();
bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
== aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
&& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> ccccccccccccccccccccccccccccccccccccccccc;

Definition at line 1012 of file Format.h.

◆ BinPackStyle

The style of wrapping parameters on the same line (bin-packed) or on one line each.

Enumerator
BPS_Auto 

Automatically determine parameter bin-packing behavior.

BPS_Always 

Always bin-pack parameters.

BPS_Never 

Never bin-pack parameters.

Definition at line 1002 of file Format.h.

◆ BitFieldColonSpacingStyle

Styles for adding spacing around : in bitfield definitions.

Enumerator
BFCS_Both 

Add one space on each side of the :

unsigned bf : 2;
BFCS_None 

Add no space around the : (except when needed for AlignConsecutiveBitFields).

unsigned bf:2;
BFCS_Before 

Add space before the : only.

unsigned bf :2;
BFCS_After 

Add space after the : only (space may be added before if needed for AlignConsecutiveBitFields).

unsigned bf: 2;

Definition at line 3490 of file Format.h.

◆ BraceBreakingStyle

Different ways to attach braces to their surrounding context.

Enumerator
BS_Attach 

Always attach braces to surrounding context.

namespace N {
enum E {
E1,
E2,
};
class C {
public:
C();
};
bool baz(int i) {
try {
do {
switch (i) {
case 1: {
foobar();
break;
}
default: {
break;
}
}
} while (--i);
return true;
} catch (...) {
handleError();
return false;
}
}
void foo(bool b) {
if (b) {
baz(2);
} else {
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
BS_Linux 

Like Attach, but break before braces on function, namespace and class definitions.

namespace N
{
enum E {
E1,
E2,
};
class C
{
public:
C();
};
bool baz(int i)
{
try {
do {
switch (i) {
case 1: {
foobar();
break;
}
default: {
break;
}
}
} while (--i);
return true;
} catch (...) {
handleError();
return false;
}
}
void foo(bool b)
{
if (b) {
baz(2);
} else {
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
BS_Mozilla 

Like Attach, but break before braces on enum, function, and record definitions.

namespace N {
enum E
{
E1,
E2,
};
class C
{
public:
C();
};
bool baz(int i)
{
try {
do {
switch (i) {
case 1: {
foobar();
break;
}
default: {
break;
}
}
} while (--i);
return true;
} catch (...) {
handleError();
return false;
}
}
void foo(bool b)
{
if (b) {
baz(2);
} else {
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
BS_Stroustrup 

Like Attach, but break before function definitions, catch, and else.

namespace N {
enum E {
E1,
E2,
};
class C {
public:
C();
};
bool baz(int i)
{
try {
do {
switch (i) {
case 1: {
foobar();
break;
}
default: {
break;
}
}
} while (--i);
return true;
}
catch (...) {
handleError();
return false;
}
}
void foo(bool b)
{
if (b) {
baz(2);
}
else {
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
BS_Allman 

Always break before braces.

namespace N
{
enum E
{
E1,
E2,
};
class C
{
public:
C();
};
bool baz(int i)
{
try
{
do
{
switch (i)
{
case 1:
{
foobar();
break;
}
default:
{
break;
}
}
} while (--i);
return true;
}
catch (...)
{
handleError();
return false;
}
}
void foo(bool b)
{
if (b)
{
baz(2);
}
else
{
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
BS_Whitesmiths 

Like Allman but always indent braces and line up code with braces.

namespace N
{
enum E
{
E1,
E2,
};
class C
{
public:
C();
};
bool baz(int i)
{
try
{
do
{
switch (i)
{
case 1:
{
foobar();
break;
}
default:
{
break;
}
}
} while (--i);
return true;
}
catch (...)
{
handleError();
return false;
}
}
void foo(bool b)
{
if (b)
{
baz(2);
}
else
{
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
BS_GNU 

Always break before braces and add an extra level of indentation to braces of control statements, not to those of class, function or other definitions.

namespace N
{
enum E
{
E1,
E2,
};
class C
{
public:
C();
};
bool baz(int i)
{
try
{
do
{
switch (i)
{
case 1:
{
foobar();
break;
}
default:
{
break;
}
}
}
while (--i);
return true;
}
catch (...)
{
handleError();
return false;
}
}
void foo(bool b)
{
if (b)
{
baz(2);
}
else
{
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
BS_WebKit 

Like Attach, but break before functions.

namespace N {
enum E {
E1,
E2,
};
class C {
public:
C();
};
bool baz(int i)
{
try {
do {
switch (i) {
case 1: {
foobar();
break;
}
default: {
break;
}
}
} while (--i);
return true;
} catch (...) {
handleError();
return false;
}
}
void foo(bool b)
{
if (b) {
baz(2);
} else {
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
BS_Custom 

Configure each individual brace in BraceWrapping.

Definition at line 1056 of file Format.h.

◆ BraceWrappingAfterControlStatementStyle

Different ways to wrap braces after control statements.

Enumerator
BWACS_Never 

Never wrap braces after a control statement.

if (foo()) {
} else {
}
for (int i = 0; i < 10; ++i) {
}
BWACS_MultiLine 

Only wrap braces after a multi-line control statement.

if (foo && bar &&
baz)
{
quux();
}
while (foo || bar) {
}
BWACS_Always 

Always wrap braces after a control statement.

if (foo())
{
} else
{}
for (int i = 0; i < 10; ++i)
{}

Definition at line 1491 of file Format.h.

◆ BracketAlignmentStyle

Different styles for aligning after open brackets.

Enumerator
BAS_Align 

Align parameters on the open bracket, e.g.

:

someLongFunction(argument1,
argument2);
BAS_DontAlign 

Don't align, instead use ContinuationIndentWidth, e.g.

:

someLongFunction(argument1,
argument2);
BAS_AlwaysBreak 

Always break after an open bracket, if the parameters don't fit on a single line, e.g.

:

someLongFunction(
argument1, argument2);

Definition at line 70 of file Format.h.

◆ BreakConstructorInitializersStyle

Different ways to break initializers.

Enumerator
BCIS_BeforeColon 

Break constructor initializers before the colon and after the commas.

: initializer1(),
initializer2()
BCIS_BeforeComma 

Break constructor initializers before the colon and commas, and align the commas with the colon.

: initializer1()
, initializer2()
BCIS_AfterColon 

Break constructor initializers after the colon and commas.

initializer1(),
initializer2()

Definition at line 1793 of file Format.h.

◆ BreakInheritanceListStyle

Different ways to break inheritance list.

Enumerator
BILS_BeforeColon 

Break inheritance list before the colon and after the commas.

class Foo
: Base1,
Base2
{};
BILS_BeforeComma 

Break inheritance list before the colon and commas, and align the commas with the colon.

class Foo
: Base1
, Base2
{};
BILS_AfterColon 

Break inheritance list after the colon and commas.

class Foo :
Base1,
Base2
{};
BILS_AfterComma 

Break inheritance list only after the commas.

class Foo : Base1,
Base2
{};

Definition at line 1933 of file Format.h.

◆ BreakTemplateDeclarationsStyle

Different ways to break after the template declaration.

Enumerator
BTDS_No 

Do not force break before declaration.

PenaltyBreakTemplateDeclaration is taken into account.

template <typename T> T foo() {
}
template <typename T> T foo(int aaaaaaaaaaaaaaaaaaaaa,
int bbbbbbbbbbbbbbbbbbbbb) {
}
BTDS_MultiLine 

Force break after template declaration only when the following declaration spans multiple lines.

template <typename T> T foo() {
}
template <typename T>
T foo(int aaaaaaaaaaaaaaaaaaaaa,
int bbbbbbbbbbbbbbbbbbbbb) {
}
BTDS_Yes 

Always break after template declaration.

template <typename T>
T foo() {
}
template <typename T>
T foo(int aaaaaaaaaaaaaaaaaaaaa,
int bbbbbbbbbbbbbbbbbbbbb) {
}

Definition at line 878 of file Format.h.

◆ DefinitionReturnTypeBreakingStyle

Different ways to break after the function definition return type.

This option is deprecated and is retained for backwards compatibility.

Enumerator
DRTBS_None 

Break after return type automatically.

PenaltyReturnTypeOnItsOwnLine is taken into account.

DRTBS_All 

Always break after the return type.

DRTBS_TopLevel 

Always break after the return types of top-level functions.

Definition at line 772 of file Format.h.

◆ EmptyLineAfterAccessModifierStyle

Different styles for empty line after access modifiers.

EmptyLineBeforeAccessModifier configuration handles the number of empty lines between two access modifiers.

Enumerator
ELAAMS_Never 

Remove all empty lines after access modifiers.

struct foo {
private:
int i;
protected:
int j;
/* comment */
public:
foo() {}
private:
protected:
};
ELAAMS_Leave 

Keep existing empty lines after access modifiers.

MaxEmptyLinesToKeep is applied instead.

ELAAMS_Always 

Always add empty line after access modifiers if there are none.

MaxEmptyLinesToKeep is applied also.

struct foo {
private:
int i;
protected:
int j;
/* comment */
public:
foo() {}
private:
protected:
};

Definition at line 2060 of file Format.h.

◆ EmptyLineBeforeAccessModifierStyle

Different styles for empty line before access modifiers.

Enumerator
ELBAMS_Never 

Remove all empty lines before access modifiers.

struct foo {
private:
int i;
protected:
int j;
/* comment */
public:
foo() {}
private:
protected:
};
ELBAMS_Leave 

Keep existing empty lines before access modifiers.

ELBAMS_LogicalBlock 

Add empty line only when access modifier starts a new logical block.

Logical block is a group of one or more member fields or functions.

struct foo {
private:
int i;
protected:
int j;
/* comment */
public:
foo() {}
private:
protected:
};
ELBAMS_Always 

Always add empty line before access modifiers unless access modifier is at the start of struct or class definition.

struct foo {
private:
int i;
protected:
int j;
/* comment */
public:
foo() {}
private:
protected:
};

Definition at line 2109 of file Format.h.

◆ EscapedNewlineAlignmentStyle

Different styles for aligning escaped newlines.

Enumerator
ENAS_DontAlign 

Don't align escaped newlines.

#define A \
int aaaa; \
int b; \
int dddddddddd;
ENAS_Left 

Align escaped newlines as far left as possible.

true:
#define A \
int aaaa; \
int b; \
int dddddddddd;
false:
ENAS_Right 

Align escaped newlines in the right-most column.

#define A \
int aaaa; \
int b; \
int dddddddddd;

Definition at line 424 of file Format.h.

◆ IndentExternBlockStyle

Indents extern blocks.

Enumerator
IEBS_AfterExternBlock 

Backwards compatible with AfterExternBlock's indenting.

IndentExternBlock: AfterExternBlock
extern "C"
{
void foo();
}
IndentExternBlock: AfterExternBlock
extern "C" {
void foo();
}
IEBS_NoIndent 

Does not indent extern blocks.

extern "C" {
void foo();
}
IEBS_Indent 

Indents extern blocks.

extern "C" {
void foo();
}

Definition at line 2465 of file Format.h.

◆ JavaScriptQuoteStyle

Quotation styles for JavaScript strings.

Does not affect template strings.

Enumerator
JSQS_Leave 

Leave string quotes as they are.

string1 = "foo";
string2 = 'bar';
JSQS_Single 

Always use single quotes.

string1 = 'foo';
string2 = 'bar';
JSQS_Double 

Always use double quotes.

string1 = "foo";
string2 = "bar";

Definition at line 2587 of file Format.h.

◆ LambdaBodyIndentationKind

Indentation logic for lambda bodies.

Enumerator
LBI_Signature 

Align lambda body relative to the lambda signature.

This is the default.

someMethod(
[](SomeReallyLongLambdaSignatureArgument foo) {
return;
});
LBI_OuterScope 

Align lambda body relative to the indentation level of the outer scope the lambda signature resides in.

someMethod(
[](SomeReallyLongLambdaSignatureArgument foo) {
return;
});

Definition at line 2678 of file Format.h.

◆ LanguageKind

Supported languages.

When stored in a configuration file, specifies the language, that the configuration targets. When passed to the reformat() function, enables syntax features specific to the language.

Enumerator
LK_None 

Do not use.

LK_Cpp 

Should be used for C, C++.

LK_CSharp 

Should be used for C#.

LK_Java 

Should be used for Java.

LK_JavaScript 

Should be used for JavaScript.

LK_Json 

Should be used for JSON.

LK_ObjC 

Should be used for Objective-C, Objective-C++.

LK_Proto 

Should be used for Protocol Buffers (https://developers.google.com/protocol-buffers/).

LK_TableGen 

Should be used for TableGen code.

LK_TextProto 

Should be used for Protocol Buffer messages in text format (https://developers.google.com/protocol-buffers/).

Definition at line 2645 of file Format.h.

◆ LanguageStandard

Supported language standards for parsing and formatting C++ constructs.

Latest: vector<set<int>>
c++03 vs. vector<set<int> >

The correct way to spell a specific language version is e.g. c++11. The historical aliases Cpp03 and Cpp11 are deprecated.

Enumerator
LS_Cpp03 

Parse and format as C++03.

Cpp03 is a deprecated alias for c++03

LS_Cpp11 

Parse and format as C++11.

LS_Cpp14 

Parse and format as C++14.

LS_Cpp17 

Parse and format as C++17.

LS_Cpp20 

Parse and format as C++20.

LS_Latest 

Parse and format using the latest supported language version.

Cpp11 is a deprecated alias for Latest

LS_Auto 

Automatic detection based on the input.

Definition at line 3526 of file Format.h.

◆ NamespaceIndentationKind

Different ways to indent namespace contents.

Enumerator
NI_None 

Don't indent in namespaces.

namespace out {
int i;
namespace in {
int i;
}
}
NI_Inner 

Indent only in inner namespaces (nested in other namespaces).

namespace out {
int i;
namespace in {
int i;
}
}
NI_All 

Indent in all namespaces.

namespace out {
int i;
namespace in {
int i;
}
}

Definition at line 2758 of file Format.h.

◆ OperandAlignmentStyle

Different styles for aligning operands.

Enumerator
OAS_DontAlign 

Do not align operands of binary and ternary expressions.

The wrapped lines are indented ContinuationIndentWidth spaces from the start of the line.

OAS_Align 

Horizontally align operands of binary and ternary expressions.

Specifically, this aligns operands of a single expression that needs
to be split over multiple lines, e.g.:
\code
  int aaa = bbbbbbbbbbbbbbb +
            ccccccccccccccc;
\endcode

When ``BreakBeforeBinaryOperators`` is set, the wrapped operator is
aligned with the operand on the first line.
\code
  int aaa = bbbbbbbbbbbbbbb
            + ccccccccccccccc;
\endcode 
OAS_AlignAfterOperator 

Horizontally align operands of binary and ternary expressions.

This is similar to ``AO_Align``, except when
``BreakBeforeBinaryOperators`` is set, the operator is un-indented so
that the wrapped operand is aligned with the operand on the first line.
\code
  int aaa = bbbbbbbbbbbbbbb
          + ccccccccccccccc;
\endcode 

Definition at line 459 of file Format.h.

◆ PackConstructorInitializersStyle

Different ways to try to fit all constructor initializers on a line.

Enumerator
PCIS_Never 

Always put each constructor initializer on its own line.

: a(),
b()
PCIS_BinPack 

Bin-pack constructor initializers.

: aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(),
cccccccccccccccccccc()
PCIS_CurrentLine 

Put all constructor initializers on the current line if they fit.

Otherwise, put each one on its own line.

Constructor() : a(), b()
: aaaaaaaaaaaaaaaaaaaa(),
bbbbbbbbbbbbbbbbbbbb(),
ddddddddddddd()
PCIS_NextLine 

Same as PCIS_CurrentLine except that if all constructor initializers do not fit on the current line, try to fit them on the next line.

Constructor() : a(), b()
: aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(), ddddddddddddd()
: aaaaaaaaaaaaaaaaaaaa(),
bbbbbbbbbbbbbbbbbbbb(),
cccccccccccccccccccc()

Definition at line 2185 of file Format.h.

◆ PointerAlignmentStyle

The &, && and * alignment style.

Enumerator
PAS_Left 

Align pointer to the left.

int* a;
PAS_Right 

Align pointer to the right.

int *a;
PAS_Middle 

Align pointer in the middle.

int * a;

Definition at line 2912 of file Format.h.

◆ PPDirectiveIndentStyle

Options for indenting preprocessor directives.

Enumerator
PPDIS_None 

Does not indent any directives.

#if FOO
#if BAR
#include <foo>
#endif
#endif
PPDIS_AfterHash 

Indents directives after the hash.

#if FOO
# if BAR
# include <foo>
# endif
#endif
PPDIS_BeforeHash 

Indents directives before the hash.

#if FOO
#if BAR
#include <foo>
#endif
#endif

Definition at line 2430 of file Format.h.

◆ QualifierAlignmentStyle

Different specifiers and qualifiers alignment styles.

Enumerator
QAS_Leave 

Don't change specifiers/qualifiers to either Left or Right alignment (default).

int const a;
const int *a;
QAS_Left 

Change specifiers/qualifiers to be left-aligned.

const int a;
const int *a;
QAS_Right 

Change specifiers/qualifiers to be right-aligned.

int const a;
int const *a;
QAS_Custom 

Change specifiers/qualifiers to be aligned based on QualifierOrder.

With:

QualifierOrder: ['inline', 'static' , 'type', 'const']
int const a;
int const *a;

Definition at line 1865 of file Format.h.

◆ ReferenceAlignmentStyle

The & and && alignment style.

Enumerator
RAS_Pointer 

Align reference like PointerAlignment.

RAS_Left 

Align reference to the left.

int& a;
RAS_Right 

Align reference to the right.

int &a;
RAS_Middle 

Align reference in the middle.

int & a;

Definition at line 3010 of file Format.h.

◆ ReturnTypeBreakingStyle

Different ways to break after the function definition or declaration return type.

Enumerator
RTBS_None 

Break after return type automatically.

PenaltyReturnTypeOnItsOwnLine is taken into account.

class A {
int f() { return 0; };
};
int f();
int f() { return 1; }
RTBS_All 

Always break after the return type.

class A {
int
f() {
return 0;
};
};
int
f();
int
f() {
return 1;
}
RTBS_TopLevel 

Always break after the return types of top-level functions.

class A {
int f() { return 0; };
};
int
f();
int
f() {
return 1;
}
RTBS_AllDefinitions 

Always break after the return type of function definitions.

class A {
int
f() {
return 0;
};
};
int f();
int
f() {
return 1;
}
RTBS_TopLevelDefinitions 

Always break after the return type of top-level definitions.

class A {
int f() { return 0; };
};
int f();
int
f() {
return 1;
}

Definition at line 784 of file Format.h.

◆ ShortBlockStyle

Different styles for merging short blocks containing at most one statement.

Enumerator
SBS_Never 

Never merge blocks into a single line.

while (true) {
}
while (true) {
continue;
}
SBS_Empty 

Only merge empty blocks.

while (true) {}
while (true) {
continue;
}
SBS_Always 

Always merge short blocks into a single line.

while (true) {}
while (true) { continue; }

Definition at line 562 of file Format.h.

◆ ShortFunctionStyle

Different styles for merging short functions containing at most one statement.

Enumerator
SFS_None 

Never merge functions into a single line.

SFS_InlineOnly 

Only merge functions defined inside a class.

Same as "inline", except it does not implies "empty": i.e. top level empty functions are not merged either.

class Foo {
void f() { foo(); }
};
void f() {
foo();
}
void f() {
}
SFS_Empty 

Only merge empty functions.

void f() {}
void f2() {
bar2();
}
SFS_Inline 

Only merge functions defined inside a class.

Implies "empty".

class Foo {
void f() { foo(); }
};
void f() {
foo();
}
void f() {}
SFS_All 

Merge all functions fitting on a single line.

class Foo {
void f() { foo(); }
};
void f() { bar(); }

Definition at line 609 of file Format.h.

◆ ShortIfStyle

Different styles for handling short if statements.

Enumerator
SIS_Never 

Never put short ifs on the same line.

if (a)
return;
if (b)
return;
else
return;
if (c)
return;
else {
return;
}
SIS_WithoutElse 

Put short ifs on the same line only if there is no else statement.

if (a) return;
if (b)
return;
else
return;
if (c)
return;
else {
return;
}
SIS_OnlyFirstIf 

Put short ifs, but not else ifs nor else statements, on the same line.

if (a) return;
if (b) return;
else if (b)
return;
else
return;
if (c) return;
else {
return;
}
SIS_AllIfsAndElse 

Always put short ifs, else ifs and else statements on the same line.

if (a) return;
if (b) return;
else return;
if (c) return;
else {
return;
}

Definition at line 661 of file Format.h.

◆ ShortLambdaStyle

Different styles for merging short lambdas containing at most one statement.

Enumerator
SLS_None 

Never merge lambdas into a single line.

SLS_Empty 

Only merge empty lambdas.

auto lambda = [](int a) {}
auto lambda2 = [](int a) {
return a;
};
SLS_Inline 

Merge lambda into a single line if argument of a function.

auto lambda = [](int a) {
return a;
};
sort(a.begin(), a.end(), ()[] { return x < y; })
SLS_All 

Merge all lambdas fitting on a single line.

auto lambda = [](int a) {}
auto lambda2 = [](int a) { return a; };

Definition at line 733 of file Format.h.

◆ SortIncludesOptions

Include sorting options.

Enumerator
SI_Never 

Includes are never sorted.

#include "B/A.h"
#include "A/B.h"
#include "a/b.h"
#include "A/b.h"
#include "B/a.h"
SI_CaseSensitive 

Includes are sorted in an ASCIIbetical or case sensitive fashion.

#include "A/B.h"
#include "A/b.h"
#include "B/A.h"
#include "B/a.h"
#include "a/b.h"
SI_CaseInsensitive 

Includes are sorted in an alphabetical or case insensitive fashion.

#include "A/B.h"
#include "A/b.h"
#include "a/b.h"
#include "B/A.h"
#include "B/a.h"

Definition at line 3075 of file Format.h.

◆ SortJavaStaticImportOptions

Position for Java Static imports.

Enumerator
SJSIO_Before 

Static imports are placed before non-static imports.

import static org.example.function1;
import org.example.ClassA;
SJSIO_After 

Static imports are placed after non-static imports.

import org.example.ClassA;
import static org.example.function1;

Definition at line 3115 of file Format.h.

◆ SpaceAroundPointerQualifiersStyle

Different ways to put a space before opening parentheses.

Enumerator
SAPQ_Default 

Don't ensure spaces around pointer qualifiers and use PointerAlignment instead.

void* const* x = NULL; vs. void *const *x = NULL;
SAPQ_Before 

Ensure that there is a space before pointer qualifiers.

void* const* x = NULL; vs. void * const *x = NULL;
SAPQ_After 

Ensure that there is a space after pointer qualifiers.

void* const * x = NULL; vs. void *const *x = NULL;
SAPQ_Both 

Ensure that there is a space both before and after pointer qualifiers.

void* const * x = NULL; vs. void * const *x = NULL;

Definition at line 3180 of file Format.h.

◆ SpaceBeforeParensOptions

Different ways to put a space before opening parentheses.

Enumerator
SBPO_Never 

Never put a space before opening parentheses.

void f() {
if(true) {
f();
}
}
SBPO_ControlStatements 

Put a space before opening parentheses only after control statement keywords (for/if/while...).

void f() {
if (true) {
f();
}
}
SBPO_ControlStatementsExceptControlMacros 

Same as SBPO_ControlStatements except this option doesn't apply to ForEach and If macros.

This is useful in projects where ForEach/If macros are treated as function calls instead of control statements. SBPO_ControlStatementsExceptForEachMacros remains an alias for backward compatibility.

void f() {
Q_FOREACH(...) {
f();
}
}
SBPO_NonEmptyParentheses 

Put a space before opening parentheses only if the parentheses are not empty i.e.

'()'

void() {
if (true) {
f();
g (x, y, z);
}
}
SBPO_Always 

Always put a space before opening parentheses, except when it's prohibited by the syntax rules (in function-like macro definitions) or when determined by other style rules (after unary operators, opening parentheses, etc.)

void f () {
if (true) {
f ();
}
}

Definition at line 3261 of file Format.h.

◆ SpacesInAnglesStyle

Styles for adding spacing after < and before `> in template argument lists.

Enumerator
SIAS_Never 

Remove spaces after < and before >.

static_cast<int>(arg);
std::function<void(int)> fct;
SIAS_Always 

Add spaces after < and before >.

static_cast< int >(arg);
std::function< void(int) > fct;
SIAS_Leave 

Keep a single space after < and before > if any spaces were present.

Option Standard: Cpp03 takes precedence.

Definition at line 3373 of file Format.h.

◆ TrailingCommaStyle

The style of inserting trailing commas into container literals.

Enumerator
TCS_None 

Do not insert trailing commas.

TCS_Wrapped 

Insert trailing commas in container literals that were wrapped over multiple lines.

Note that this is conceptually incompatible with bin-packing, because the trailing comma is used as an indicator that a container should be formatted one-per-line (i.e. not bin-packed). So inserting a trailing comma counteracts bin-packing.

Definition at line 956 of file Format.h.

◆ UseTabStyle

Different ways to use tab in formatting.

Enumerator
UT_Never 

Never use tab.

UT_ForIndentation 

Use tabs only for indentation.

UT_ForContinuationAndIndentation 

Fill all leading whitespace with tabs, and use spaces for alignment that appears within a line (e.g.

consecutive assignments and declarations).

UT_AlignWithSpaces 

Use tabs for line continuation and indentation, and spaces for alignment.

UT_Always 

Use tabs whenever we need to fill whitespace that spans at least from one tab stop to the next one.

Definition at line 3575 of file Format.h.

Member Function Documentation

◆ BuildStyleSetFromConfiguration()

static FormatStyleSet clang::format::FormatStyle::BuildStyleSetFromConfiguration ( const FormatStyle MainStyle,
const std::vector< FormatStyle > &  ConfigurationStyles 
)
static

◆ GetLanguageStyle()

llvm::Optional< FormatStyle > clang::format::FormatStyle::GetLanguageStyle ( FormatStyle::LanguageKind  Language) const

◆ isCpp()

bool clang::format::FormatStyle::isCpp ( ) const
inline

Definition at line 2669 of file Format.h.

References LK_Cpp, and LK_ObjC.

◆ isCSharp()

bool clang::format::FormatStyle::isCSharp ( ) const
inline

Definition at line 2670 of file Format.h.

References LK_CSharp.

Referenced by clang::format::FormatTokenLexer::lex().

◆ isJson()

bool clang::format::FormatStyle::isJson ( ) const
inline

Definition at line 2671 of file Format.h.

References LK_Json.

Referenced by clang::format::getLLVMStyle().

◆ operator==()

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

Definition at line 3600 of file Format.h.

References AccessModifierOffset, AlignAfterOpenBracket, AlignArrayOfStructures, AlignConsecutiveAssignments, AlignConsecutiveBitFields, AlignConsecutiveDeclarations, AlignConsecutiveMacros, AlignEscapedNewlines, AlignOperands, AlignTrailingComments, AllowAllArgumentsOnNextLine, AllowAllParametersOfDeclarationOnNextLine, AllowShortBlocksOnASingleLine, AllowShortCaseLabelsOnASingleLine, AllowShortEnumsOnASingleLine, AllowShortFunctionsOnASingleLine, AllowShortIfStatementsOnASingleLine, AllowShortLambdasOnASingleLine, AllowShortLoopsOnASingleLine, AlwaysBreakAfterReturnType, AlwaysBreakBeforeMultilineStrings, AlwaysBreakTemplateDeclarations, AttributeMacros, BinPackArguments, BinPackParameters, BitFieldColonSpacing, BreakAfterJavaFieldAnnotations, BreakBeforeBinaryOperators, BreakBeforeBraces, BreakBeforeConceptDeclarations, BreakBeforeTernaryOperators, BreakConstructorInitializers, BreakInheritanceList, BreakStringLiterals, ColumnLimit, CommentPragmas, CompactNamespaces, ConstructorInitializerIndentWidth, ContinuationIndentWidth, Cpp11BracedListStyle, DeriveLineEnding, DerivePointerAlignment, DisableFormat, EmptyLineAfterAccessModifier, EmptyLineBeforeAccessModifier, ExperimentalAutoDetectBinPacking, FixNamespaceComments, ForEachMacros, clang::tooling::IncludeStyle::IncludeBlocks, clang::tooling::IncludeStyle::IncludeCategories, clang::tooling::IncludeStyle::IncludeIsMainRegex, clang::tooling::IncludeStyle::IncludeIsMainSourceRegex, IncludeStyle, IndentAccessModifiers, IndentCaseBlocks, IndentCaseLabels, IndentExternBlock, IndentGotoLabels, IndentPPDirectives, IndentRequires, IndentWidth, IndentWrappedFunctionNames, JavaImportGroups, JavaScriptQuotes, JavaScriptWrapImports, KeepEmptyLinesAtTheStartOfBlocks, LambdaBodyIndentation, Language, MacroBlockBegin, MacroBlockEnd, MaxEmptyLinesToKeep, clang::format::FormatStyle::SpacesInLineComment::Maximum, clang::format::FormatStyle::SpacesInLineComment::Minimum, NamespaceIndentation, NamespaceMacros, ObjCBinPackProtocolList, ObjCBlockIndentWidth, ObjCBreakBeforeNestedBlockParam, ObjCSpaceAfterProperty, ObjCSpaceBeforeProtocolList, PackConstructorInitializers, PenaltyBreakAssignment, PenaltyBreakBeforeFirstCallParameter, PenaltyBreakComment, PenaltyBreakFirstLessLess, PenaltyBreakString, PenaltyBreakTemplateDeclaration, PenaltyExcessCharacter, PenaltyReturnTypeOnItsOwnLine, PointerAlignment, QualifierAlignment, QualifierOrder, RawStringFormats, ReferenceAlignment, ShortNamespaceLines, SortIncludes, SortJavaStaticImport, SpaceAfterCStyleCast, SpaceAfterLogicalNot, SpaceAfterTemplateKeyword, SpaceAroundPointerQualifiers, SpaceBeforeAssignmentOperators, SpaceBeforeCaseColon, SpaceBeforeCpp11BracedList, SpaceBeforeCtorInitializerColon, SpaceBeforeInheritanceColon, SpaceBeforeParens, SpaceBeforeRangeBasedForLoopColon, SpaceBeforeSquareBrackets, SpaceInEmptyBlock, SpaceInEmptyParentheses, SpacesBeforeTrailingComments, SpacesInAngles, SpacesInConditionalStatement, SpacesInContainerLiterals, SpacesInCStyleCastParentheses, SpacesInLineCommentPrefix, SpacesInParentheses, SpacesInSquareBrackets, Standard, StatementAttributeLikeMacros, StatementMacros, TabWidth, TypenameMacros, UseCRLF, and UseTab.

Friends And Related Function Documentation

◆ parseConfiguration

std::error_code parseConfiguration ( llvm::MemoryBufferRef  Config,
FormatStyle Style,
bool  AllowUnknownOptions = false,
llvm::SourceMgr::DiagHandlerTy  DiagHandler = nullptr,
void *  DiagHandlerCtxt = nullptr 
)
friend

Parse configuration from YAML-formatted text.

Style->Language is used to get the base style, if the BasedOnStyle option is present.

The FormatStyleSet of Style is reset.

When BasedOnStyle is not present, options not present in the YAML document, are retained in Style.

If AllowUnknownOptions is true, no errors are emitted if unknown format options are occured.

If set all diagnostics are emitted through the DiagHandler.

Definition at line 1580 of file Format.cpp.

Member Data Documentation

◆ AccessModifierOffset

int clang::format::FormatStyle::AccessModifierOffset

The extra indent or outdent of access modifiers, e.g.

public:.

Version
3.3

Definition at line 67 of file Format.h.

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

◆ AlignAfterOpenBracket

BracketAlignmentStyle clang::format::FormatStyle::AlignAfterOpenBracket

If true, horizontally aligns arguments after an open bracket.

This applies to round brackets (parentheses), angle brackets and square brackets.

Version
3.8

Definition at line 97 of file Format.h.

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

◆ AlignArrayOfStructures

ArrayInitializerAlignmentStyle clang::format::FormatStyle::AlignArrayOfStructures

if not None, when using initialization for an array of structs aligns the fields into columns.

Version
13

Definition at line 127 of file Format.h.

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

◆ AlignConsecutiveAssignments

AlignConsecutiveStyle clang::format::FormatStyle::AlignConsecutiveAssignments

Style of aligning consecutive assignments.

Consecutive will result in formattings like:

int a = 1;
int somelongname = 2;
double c = 3;

Possible values:

  • ACS_None (in configuration: None) Do not align assignments on consecutive lines.
  • ACS_Consecutive (in configuration: Consecutive) Align assignments on consecutive lines. This will result in formattings like:
    int a = 1;
    int somelongname = 2;
    double c = 3;
    int d = 3;
    /* A comment. */
    double e = 4;
  • ACS_AcrossEmptyLines (in configuration: AcrossEmptyLines) Same as ACS_Consecutive, but also spans over empty lines, e.g.
    int a = 1;
    int somelongname = 2;
    double c = 3;
    int d = 3;
    /* A comment. */
    double e = 4;
  • ACS_AcrossComments (in configuration: AcrossComments) Same as ACS_Consecutive, but also spans over lines only containing comments, e.g.
    int a = 1;
    int somelongname = 2;
    double c = 3;
    int d = 3;
    /* A comment. */
    double e = 4;
  • ACS_AcrossEmptyLinesAndComments (in configuration: AcrossEmptyLinesAndComments)

    Same as ACS_Consecutive, but also spans over lines only containing comments and empty lines, e.g.

    int a = 1;
    int somelongname = 2;
    double c = 3;
    int d = 3;
    /* A comment. */
    double e = 4;
    Version
    3.8

Definition at line 281 of file Format.h.

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

◆ AlignConsecutiveBitFields

AlignConsecutiveStyle clang::format::FormatStyle::AlignConsecutiveBitFields

Style of aligning consecutive bit field.

Consecutive will align the bitfield separators of consecutive lines. This will result in formattings like:

int aaaa : 1;
int b : 12;
int ccc : 8;

Possible values:

  • ACS_None (in configuration: None) Do not align bit fields on consecutive lines.
  • ACS_Consecutive (in configuration: Consecutive) Align bit fields on consecutive lines. This will result in formattings like:
    int aaaa : 1;
    int b : 12;
    int ccc : 8;
    int d : 2;
    /* A comment. */
    int ee : 3;
  • ACS_AcrossEmptyLines (in configuration: AcrossEmptyLines) Same as ACS_Consecutive, but also spans over empty lines, e.g.
    int aaaa : 1;
    int b : 12;
    int ccc : 8;
    int d : 2;
    /* A comment. */
    int ee : 3;
  • ACS_AcrossComments (in configuration: AcrossComments) Same as ACS_Consecutive, but also spans over lines only containing comments, e.g.
    int aaaa : 1;
    int b : 12;
    int ccc : 8;
    int d : 2;
    /* A comment. */
    int ee : 3;
  • ACS_AcrossEmptyLinesAndComments (in configuration: AcrossEmptyLinesAndComments)

    Same as ACS_Consecutive, but also spans over lines only containing comments and empty lines, e.g.

    int aaaa : 1;
    int b : 12;
    int ccc : 8;
    int d : 2;
    /* A comment. */
    int ee : 3;
    Version
    11

Definition at line 351 of file Format.h.

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

◆ AlignConsecutiveDeclarations

AlignConsecutiveStyle clang::format::FormatStyle::AlignConsecutiveDeclarations

Style of aligning consecutive declarations.

Consecutive will align the declaration names of consecutive lines. This will result in formattings like:

int aaaa = 12;
float b = 23;

Possible values:

  • ACS_None (in configuration: None) Do not align bit declarations on consecutive lines.
  • ACS_Consecutive (in configuration: Consecutive) Align declarations on consecutive lines. This will result in formattings like:
    int aaaa = 12;
    float b = 23;
    int a = 42;
    /* A comment. */
    bool c = false;
  • ACS_AcrossEmptyLines (in configuration: AcrossEmptyLines) Same as ACS_Consecutive, but also spans over empty lines, e.g.
    int aaaa = 12;
    float b = 23;
    int a = 42;
    /* A comment. */
    bool c = false;
  • ACS_AcrossComments (in configuration: AcrossComments) Same as ACS_Consecutive, but also spans over lines only containing comments, e.g.
    int aaaa = 12;
    float b = 23;
    int a = 42;
    /* A comment. */
    bool c = false;
  • ACS_AcrossEmptyLinesAndComments (in configuration: AcrossEmptyLinesAndComments)

    Same as ACS_Consecutive, but also spans over lines only containing comments and empty lines, e.g.

    int aaaa = 12;
    float b = 23;
    int a = 42;
    /* A comment. */
    bool c = false;
    Version
    3.8

Definition at line 421 of file Format.h.

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

◆ AlignConsecutiveMacros

AlignConsecutiveStyle clang::format::FormatStyle::AlignConsecutiveMacros

Style of aligning consecutive macro definitions.

Consecutive will result in formattings like:

#define SHORT_NAME 42
#define LONGER_NAME 0x007f
#define EVEN_LONGER_NAME (2)
#define foo(x) (x * x)
#define bar(y, z) (y + z)

Possible values:

  • ACS_None (in configuration: None) Do not align macro definitions on consecutive lines.
  • ACS_Consecutive (in configuration: Consecutive) Align macro definitions on consecutive lines. This will result in formattings like:
    #define SHORT_NAME 42
    #define LONGER_NAME 0x007f
    #define EVEN_LONGER_NAME (2)
    #define foo(x) (x * x)
    /* some comment */
    #define bar(y, z) (y + z)
  • ACS_AcrossEmptyLines (in configuration: AcrossEmptyLines) Same as ACS_Consecutive, but also spans over empty lines, e.g.
    #define SHORT_NAME 42
    #define LONGER_NAME 0x007f
    #define EVEN_LONGER_NAME (2)
    #define foo(x) (x * x)
    /* some comment */
    #define bar(y, z) (y + z)
  • ACS_AcrossComments (in configuration: AcrossComments) Same as ACS_Consecutive, but also spans over lines only containing comments, e.g.
    #define SHORT_NAME 42
    #define LONGER_NAME 0x007f
    #define EVEN_LONGER_NAME (2)
    #define foo(x) (x * x)
    /* some comment */
    #define bar(y, z) (y + z)
  • ACS_AcrossEmptyLinesAndComments (in configuration: AcrossEmptyLinesAndComments)

    Same as ACS_Consecutive, but also spans over lines only containing comments and empty lines, e.g.

    #define SHORT_NAME 42
    #define LONGER_NAME 0x007f
    #define EVEN_LONGER_NAME (2)
    #define foo(x) (x * x)
    /* some comment */
    #define bar(y, z) (y + z)
    Version
    9

Definition at line 212 of file Format.h.

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

◆ AlignEscapedNewlines

EscapedNewlineAlignmentStyle clang::format::FormatStyle::AlignEscapedNewlines

Options for aligning backslashes in escaped newlines.

Version
5

Definition at line 456 of file Format.h.

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

◆ AlignOperands

OperandAlignmentStyle clang::format::FormatStyle::AlignOperands

If true, horizontally align operands of binary and ternary expressions.

Version
12

Definition at line 495 of file Format.h.

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

◆ AlignTrailingComments

bool clang::format::FormatStyle::AlignTrailingComments

If true, aligns trailing comments.

true: false:
int a; // My comment a vs. int a; // My comment a
int b = 2; // comment b int b = 2; // comment about b
Version
3.7

Definition at line 504 of file Format.h.

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

◆ AllowAllArgumentsOnNextLine

bool clang::format::FormatStyle::AllowAllArgumentsOnNextLine

If a function call or braced initializer list doesn't fit on a line, allow putting all arguments onto the next line, even if BinPackArguments is false.

true:
callFunction(
a, b, c, d);
false:
callFunction(a,
b,
c,
d);
Version
9

Definition at line 521 of file Format.h.

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

◆ AllowAllConstructorInitializersOnNextLine

bool clang::format::FormatStyle::AllowAllConstructorInitializersOnNextLine

This option is deprecated.

See NextLine of PackConstructorInitializers.

Version
9

Definition at line 526 of file Format.h.

◆ AllowAllParametersOfDeclarationOnNextLine

bool clang::format::FormatStyle::AllowAllParametersOfDeclarationOnNextLine

If the function declaration doesn't fit on a line, allow putting all parameters of a function declaration onto the next line even if BinPackParameters is false.

true:
void myFunction(
int a, int b, int c, int d, int e);
false:
void myFunction(int a,
int b,
int c,
int d,
int e);
Version
3.3

Definition at line 544 of file Format.h.

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

◆ AllowShortBlocksOnASingleLine

ShortBlockStyle clang::format::FormatStyle::AllowShortBlocksOnASingleLine

Dependent on the value, while (true) { continue; } can be put on a single line.

Version
11

Definition at line 591 of file Format.h.

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

◆ AllowShortCaseLabelsOnASingleLine

bool clang::format::FormatStyle::AllowShortCaseLabelsOnASingleLine

If true, short case labels will be contracted to a single line.

true: false:
switch (a) { vs. switch (a) {
case 1: x = 1; break; case 1:
case 2: return; x = 1;
} break;
case 2:
return;
}
Version
3.6

Definition at line 605 of file Format.h.

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

◆ AllowShortEnumsOnASingleLine

bool clang::format::FormatStyle::AllowShortEnumsOnASingleLine

Allow short enums on a single line.

true:
enum { A, B } myEnum;
false:
enum {
A,
B
} myEnum;
Version
12

Definition at line 558 of file Format.h.

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

◆ AllowShortFunctionsOnASingleLine

ShortFunctionStyle clang::format::FormatStyle::AllowShortFunctionsOnASingleLine

Dependent on the value, int f() { return 0; } can be put on a single line.

Version
3.5

Definition at line 658 of file Format.h.

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

◆ AllowShortIfStatementsOnASingleLine

ShortIfStyle clang::format::FormatStyle::AllowShortIfStatementsOnASingleLine

Dependent on the value, if (a) return; can be put on a single line.

Version
9

Definition at line 729 of file Format.h.

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

◆ AllowShortLambdasOnASingleLine

ShortLambdaStyle clang::format::FormatStyle::AllowShortLambdasOnASingleLine

Dependent on the value, auto lambda []() { return 0; } can be put on a single line.

Version
9

Definition at line 763 of file Format.h.

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

◆ AllowShortLoopsOnASingleLine

bool clang::format::FormatStyle::AllowShortLoopsOnASingleLine

If true, while (true) continue; can be put on a single line.

Version
3.7

Definition at line 768 of file Format.h.

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

◆ AlwaysBreakAfterDefinitionReturnType

DefinitionReturnTypeBreakingStyle clang::format::FormatStyle::AlwaysBreakAfterDefinitionReturnType

The function definition return type breaking style to use.

This option is deprecated and is retained for backwards compatibility.

Version
3.7

Definition at line 856 of file Format.h.

Referenced by clang::format::getLLVMStyle(), and clang::format::getMozillaStyle().

◆ AlwaysBreakAfterReturnType

ReturnTypeBreakingStyle clang::format::FormatStyle::AlwaysBreakAfterReturnType

The function declaration return type breaking style to use.

Version
3.8

Definition at line 860 of file Format.h.

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

◆ AlwaysBreakBeforeMultilineStrings

bool clang::format::FormatStyle::AlwaysBreakBeforeMultilineStrings

If true, always break before multiline string literals.

This flag is mean to make cases where there are multiple multiline strings in a file look more consistent. Thus, it will only take effect if wrapping the string at that point leads to it being indented ContinuationIndentWidth spaces from the start of the line.

true: false:
aaaa = vs. aaaa = "bbbb"
"bbbb" "cccc";
"cccc";
Version
3.4

Definition at line 875 of file Format.h.

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

◆ AlwaysBreakTemplateDeclarations

BreakTemplateDeclarationsStyle clang::format::FormatStyle::AlwaysBreakTemplateDeclarations

The template declaration breaking style to use.

Version
7

Definition at line 915 of file Format.h.

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

◆ AttributeMacros

std::vector<std::string> clang::format::FormatStyle::AttributeMacros

A vector of strings that should be interpreted as attributes/qualifiers instead of identifiers.

This can be useful for language extensions or static analyzer annotations.

For example:

x = (char *__capability)&y;
int function(void) __ununsed;
void only_writes_to_buffer(char *__output buffer);

In the .clang-format configuration file, this can be configured like:

AttributeMacros: ['__capability', '__output', '__ununsed']
Version
12

Definition at line 934 of file Format.h.

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

◆ BinPackArguments

bool clang::format::FormatStyle::BinPackArguments

If false, a function call's arguments will either be all on the same line or will have one line each.

true:
void f() {
f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
}
false:
void f() {
f(aaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
}
Version
3.7

Definition at line 953 of file Format.h.

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

◆ BinPackParameters

bool clang::format::FormatStyle::BinPackParameters

If false, a function declaration's or function definition's parameters will either all be on the same line or will have one line each.

true:
void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,
int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
false:
void f(int aaaaaaaaaaaaaaaaaaaa,
int aaaaaaaaaaaaaaaaaaaa,
int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
Version
3.7

Definition at line 998 of file Format.h.

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

◆ BitFieldColonSpacing

BitFieldColonSpacingStyle clang::format::FormatStyle::BitFieldColonSpacing

The BitFieldColonSpacingStyle to use for bitfields.

Version
12

Definition at line 3516 of file Format.h.

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

◆ BraceWrapping

BraceWrappingFlags clang::format::FormatStyle::BraceWrapping

Control of individual brace wrapping cases.

If BreakBeforeBraces is set to BS_Custom, use this to specify how each individual brace case should be handled. Otherwise, this is ignored.

# Example of usage:
BreakBeforeBraces: Custom
BraceWrapping:
AfterEnum: true
AfterStruct: false
SplitEmptyFunction: false
Version
3.8

Definition at line 1763 of file Format.h.

Referenced by clang::format::getLLVMStyle().

◆ BreakAfterJavaFieldAnnotations

bool clang::format::FormatStyle::BreakAfterJavaFieldAnnotations

Break after each annotation on a field in Java files.

true: false:
@Partial vs. @Partial @Mock DataLoad loader;
@Mock
DataLoad loader;
Version
3.8

Definition at line 1830 of file Format.h.

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

◆ BreakBeforeBinaryOperators

BinaryOperatorStyle clang::format::FormatStyle::BreakBeforeBinaryOperators

The way to wrap binary operators.

Version
3.6

Definition at line 1053 of file Format.h.

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

◆ BreakBeforeBraces

BraceBreakingStyle clang::format::FormatStyle::BreakBeforeBraces

The brace breaking style to use.

Version
3.7

Definition at line 1488 of file Format.h.

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

◆ BreakBeforeConceptDeclarations

bool clang::format::FormatStyle::BreakBeforeConceptDeclarations

If true, concept will be placed on a new line.

true:
template<typename T>
concept ...
false:
template<typename T> concept ...
Version
13

Definition at line 1775 of file Format.h.

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

◆ BreakBeforeTernaryOperators

bool clang::format::FormatStyle::BreakBeforeTernaryOperators

If true, ternary operators will be placed after line breaks.

true:
veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
? firstValue
: SecondValueVeryVeryVeryVeryLong;
false:
veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?
firstValue :
SecondValueVeryVeryVeryVeryLong;
Version
3.7

Definition at line 1790 of file Format.h.

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

◆ BreakConstructorInitializers

BreakConstructorInitializersStyle clang::format::FormatStyle::BreakConstructorInitializers

The break constructor initializers style to use.

Version
5

Definition at line 1820 of file Format.h.

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

◆ BreakInheritanceList

BreakInheritanceListStyle clang::format::FormatStyle::BreakInheritanceList

The inheritance list style to use.

Version
7

Definition at line 1970 of file Format.h.

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

◆ BreakStringLiterals

bool clang::format::FormatStyle::BreakStringLiterals

Allow breaking string literals when formatting.

true:
const char* x = "veryVeryVeryVeryVeryVe"
"ryVeryVeryVeryVeryVery"
"VeryLongString";
false:
const char* x =
"veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
Version
3.9

Definition at line 1844 of file Format.h.

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

◆ ColumnLimit

unsigned clang::format::FormatStyle::ColumnLimit

The column limit.

A column limit of 0 means that there is no column limit. In this case, clang-format will respect the input's line breaking decisions within statements unless they contradict other rules.

Version
3.7

Definition at line 1852 of file Format.h.

Referenced by clang::tooling::applyAtomicChanges(), clang::format::CommaSeparatedList::formatAfterToken(), clang::format::getChromiumStyle(), clang::format::ContinuationIndenter::getColumnLimit(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), operator==(), clang::format::CommaSeparatedList::precomputeFormattingInfos(), and clang::format::RawStringFormatStyleManager::RawStringFormatStyleManager().

◆ CommentPragmas

std::string clang::format::FormatStyle::CommentPragmas

A regular expression that describes comments with special meaning, which should not be split into lines or otherwise changed.

// CommentPragmas: '^ FOOBAR pragma:'
// Will leave the following line unaffected
#include <vector> // FOOBAR pragma: keep
Version
3.7

Definition at line 1862 of file Format.h.

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

◆ CompactNamespaces

bool clang::format::FormatStyle::CompactNamespaces

If true, consecutive namespace declarations will be on the same line.

If false, each namespace is declared on a new line.

true:
namespace Foo { namespace Bar {
}}
false:
namespace Foo {
namespace Bar {
}
}

If it does not fit on a single line, the overflowing namespaces get wrapped:

namespace Foo { namespace Bar {
namespace Extra {
}}}
Version
5

Definition at line 1994 of file Format.h.

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

◆ ConstructorInitializerAllOnOneLineOrOnePerLine

bool clang::format::FormatStyle::ConstructorInitializerAllOnOneLineOrOnePerLine

This option is deprecated.

See CurrentLine of PackConstructorInitializers.

Version
3.7

Definition at line 1999 of file Format.h.

◆ ConstructorInitializerIndentWidth

unsigned clang::format::FormatStyle::ConstructorInitializerIndentWidth

The number of characters to use for indentation of constructor initializer lists as well as inheritance lists.

Version
3.7

Definition at line 2004 of file Format.h.

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

◆ ContinuationIndentWidth

unsigned clang::format::FormatStyle::ContinuationIndentWidth

Indent width for line continuations.

int i = // VeryVeryVeryVeryVeryLongComment
longFunction( // Again a long comment
arg);
Version
3.7

Definition at line 2015 of file Format.h.

Referenced by clang::format::getChromiumStyle(), clang::format::BreakableBlockComment::getContentIndent(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().

◆ Cpp11BracedListStyle

bool clang::format::FormatStyle::Cpp11BracedListStyle

If true, format braced lists as best suited for C++11 braced lists.

Important differences:

  • No spaces inside the braced list.
  • No line break before the closing brace.
  • Indentation with the continuation indent, not with the block indent.

Fundamentally, C++11 braced lists are formatted exactly like function calls would be formatted in their place. If the braced list follows a name (e.g. a type or variable name), clang-format formats as if the {} were the parentheses of a function call with that name. If there is no name, a zero-length name is assumed.

true: false:
vector<int> x{1, 2, 3, 4}; vs. vector<int> x{ 1, 2, 3, 4 };
vector<T> x{{}, {}, {}, {}}; vector<T> x{ {}, {}, {}, {} };
f(MyMap[{composite, key}]); f(MyMap[{ composite, key }]);
new int[3]{1, 2, 3}; new int[3]{ 1, 2, 3 };
Version
3.4

Definition at line 2038 of file Format.h.

Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), operator==(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().

◆ DeriveLineEnding

bool clang::format::FormatStyle::DeriveLineEnding

Analyze the formatted file for the most used line ending (\r\n or \n).

UseCRLF is only used as a fallback if none can be derived.

Version
11

Definition at line 2043 of file Format.h.

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

◆ DerivePointerAlignment

bool clang::format::FormatStyle::DerivePointerAlignment

If true, analyze the formatted file for the most common alignment of & and *.

Pointer and reference alignment styles are going to be updated according to the preferences found in the file. PointerAlignment is then used only as fallback.

Version
3.7

Definition at line 2051 of file Format.h.

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

◆ DisableFormat

bool clang::format::FormatStyle::DisableFormat

Disables formatting completely.

Version
3.7

Definition at line 2055 of file Format.h.

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

◆ EmptyLineAfterAccessModifier

EmptyLineAfterAccessModifierStyle clang::format::FormatStyle::EmptyLineAfterAccessModifier

Defines when to put an empty line after access modifiers.

EmptyLineBeforeAccessModifier configuration handles the number of empty lines between two access modifiers.

Version
14

Definition at line 2106 of file Format.h.

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

◆ EmptyLineBeforeAccessModifier

EmptyLineBeforeAccessModifierStyle clang::format::FormatStyle::EmptyLineBeforeAccessModifier

Defines in which cases to put empty line before access modifiers.

Version
13

Definition at line 2169 of file Format.h.

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

◆ ExperimentalAutoDetectBinPacking

bool clang::format::FormatStyle::ExperimentalAutoDetectBinPacking

If true, clang-format detects whether function calls and definitions are formatted with one parameter per line.

Each call can be bin-packed, one-per-line or inconclusive. If it is inconclusive, e.g. completely on one line, but a decision needs to be made, clang-format analyzes whether there are other bin-packed cases in the input file and act accordingly.

NOTE: This is an experimental flag, that might go away or be renamed. Do not use this in config files, etc. Use at your own risk.

Version
3.7

Definition at line 2182 of file Format.h.

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

◆ FixNamespaceComments

bool clang::format::FormatStyle::FixNamespaceComments

If true, clang-format adds missing namespace end comments for short namespaces and fixes invalid existing ones.

Short ones are controlled by "ShortNamespaceLines".

true: false:
namespace a { vs. namespace a {
foo(); foo();
bar(); bar();
} // namespace a }
Version
5

Definition at line 2242 of file Format.h.

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

◆ ForEachMacros

std::vector<std::string> clang::format::FormatStyle::ForEachMacros

A vector of macros that should be interpreted as foreach loops instead of as function calls.

These are expected to be macros of the form:

FOREACH(<variable-declaration>, ...)
<loop-body>

In the .clang-format configuration file, this can be configured like:

ForEachMacros: ['RANGES_FOR', 'FOREACH']

For example: BOOST_FOREACH.

Version
3.7

Definition at line 2260 of file Format.h.

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

◆ IfMacros

std::vector<std::string> clang::format::FormatStyle::IfMacros

A vector of macros that should be interpreted as conditionals instead of as function calls.

These are expected to be macros of the form:

IF(...)
<conditional-body>
else IF(...)
<conditional-body>

In the .clang-format configuration file, this can be configured like:

IfMacros: ['IF']

For example: KJ_IF_MAYBE <https://github.com/capnproto/capnproto/blob/master/kjdoc/tour.md#maybes>_

Version
14

Definition at line 2281 of file Format.h.

Referenced by clang::format::getLLVMStyle().

◆ IncludeStyle

tooling::IncludeStyle clang::format::FormatStyle::IncludeStyle

◆ IndentAccessModifiers

bool clang::format::FormatStyle::IndentAccessModifiers

Specify whether access modifiers should have their own indentation level.

When false, access modifiers are indented (or outdented) relative to the record members, respecting the AccessModifierOffset. Record members are indented one level below the record. When true, access modifiers get their own indentation level. As a consequence, record members are always indented 2 levels below the record, regardless of the access modifier presence. Value of the AccessModifierOffset is ignored.

false: true:
class C { vs. class C {
class D { class D {
void bar(); void bar();
protected: protected:
D(); D();
}; };
public: public:
C(); C();
}; };
void foo() { void foo() {
return 1; return 1;
} }
Version
13

Definition at line 2368 of file Format.h.

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

◆ IndentCaseBlocks

bool clang::format::FormatStyle::IndentCaseBlocks

Indent case label blocks one level from the case label.

When false, the block following the case label uses the same indentation level as for the case label, treating the case label the same as an if-statement. When true, the block gets indented as a scope block.

false: true:
switch (fool) { vs. switch (fool) {
case 1: { case 1:
bar(); {
} break; bar();
default: { }
plop(); break;
} default:
} {
plop();
}
}
Version
11

Definition at line 2410 of file Format.h.

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

◆ IndentCaseLabels

bool clang::format::FormatStyle::IndentCaseLabels

Indent case labels one level from the switch statement.

When false, use the same indentation level as for the switch statement. Switch statement body is always indented one level more than case labels (except the first block following the case label, which itself indents the code - unless IndentCaseBlocks is enabled).

false: true:
switch (fool) { vs. switch (fool) {
case 1: case 1:
bar(); bar();
break; break;
default: default:
plop(); plop();
} }
Version
3.3

Definition at line 2387 of file Format.h.

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

◆ IndentExternBlock

IndentExternBlockStyle clang::format::FormatStyle::IndentExternBlock

IndentExternBlockStyle is the type of indenting of extern blocks.

Version
12

Definition at line 2502 of file Format.h.

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

◆ IndentGotoLabels

bool clang::format::FormatStyle::IndentGotoLabels

Indent goto labels.

When false, goto labels are flushed left.

true: false:
int f() { vs. int f() {
if (foo()) { if (foo()) {
label1: label1:
bar(); bar();
} }
label2: label2:
return 1; return 1;
} }
Version
10

Definition at line 2427 of file Format.h.

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

◆ IndentPPDirectives

PPDirectiveIndentStyle clang::format::FormatStyle::IndentPPDirectives

The preprocessor directive indenting style to use.

Version
6

Definition at line 2462 of file Format.h.

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

◆ IndentRequires

bool clang::format::FormatStyle::IndentRequires

Indent the requires clause in a template.

true:
template <typename It>
requires Iterator<It>
void sort(It begin, It end) {
//....
}
false:
template <typename It>
requires Iterator<It>
void sort(It begin, It end) {
//....
}
Version
13

Definition at line 2521 of file Format.h.

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

◆ IndentWidth

unsigned clang::format::FormatStyle::IndentWidth

The number of columns to use for indentation.

void f() {
someFunction();
if (true, false) {
f();
}
}
Version
3.7

Definition at line 2535 of file Format.h.

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

◆ IndentWrappedFunctionNames

bool clang::format::FormatStyle::IndentWrappedFunctionNames

Indent if a function definition or declaration is wrapped after the type.

true:
LoooooooooooooooooooooooooooooooooooooooongReturnType
LoooooooooooooooooooooooooooooooongFunctionDeclaration();
false:
LoooooooooooooooooooooooooooooooooooooooongReturnType
LoooooooooooooooooooooooooooooooongFunctionDeclaration();
Version
3.7

Definition at line 2549 of file Format.h.

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

◆ InheritsParentConfig

bool clang::format::FormatStyle::InheritsParentConfig

Definition at line 63 of file Format.h.

Referenced by clang::format::getLLVMStyle().

◆ InsertTrailingCommas

TrailingCommaStyle clang::format::FormatStyle::InsertTrailingCommas

If set to TCS_Wrapped will insert trailing commas in container literals (arrays and objects) that wrap across multiple lines.

It is currently only available for JavaScript and disabled by default TCS_None. InsertTrailingCommas cannot be used together with BinPackArguments as inserting the comma disables bin-packing.

TSC_Wrapped:
const someArray = [
aaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaa,
// ^ inserted
]
Version
12

Definition at line 983 of file Format.h.

Referenced by clang::format::getLLVMStyle().

◆ JavaImportGroups

std::vector<std::string> clang::format::FormatStyle::JavaImportGroups

A vector of prefixes ordered by the desired groups for Java imports.

One group's prefix can be a subset of another - the longest prefix is always matched. Within a group, the imports are ordered lexicographically. Static imports are grouped separately and follow the same group rules. By default, static imports are placed before non-static imports, but this behavior is changed by another option, SortJavaStaticImport.

In the .clang-format configuration file, this can be configured like in the following yaml example. This will result in imports being formatted as in the Java example below.

JavaImportGroups: ['com.example', 'com', 'org']
import static com.example.function1;
import static com.test.function2;
import static org.example.function3;
import com.example.ClassA;
import com.example.Test;
import com.example.a.ClassB;
import com.test.ClassC;
import org.example.ClassD;
Version
8

Definition at line 2583 of file Format.h.

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

◆ JavaScriptQuotes

JavaScriptQuoteStyle clang::format::FormatStyle::JavaScriptQuotes

The JavaScriptQuoteStyle to use for JavaScript strings.

Version
3.9

Definition at line 2610 of file Format.h.

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

◆ JavaScriptWrapImports

bool clang::format::FormatStyle::JavaScriptWrapImports

Whether to wrap JavaScript import/export statements.

true:
import {
VeryLongImportsAreAnnoying,
VeryLongImportsAreAnnoying,
VeryLongImportsAreAnnoying,
} from 'some/module.js'
false:
import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from "some/module.js"
Version
3.9

Definition at line 2626 of file Format.h.

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

◆ KeepEmptyLinesAtTheStartOfBlocks

bool clang::format::FormatStyle::KeepEmptyLinesAtTheStartOfBlocks

If true, the empty line at the start of blocks is kept.

true: false:
if (foo) { vs. if (foo) {
bar();
bar(); }
}
Version
3.7

Definition at line 2638 of file Format.h.

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

◆ LambdaBodyIndentation

LambdaBodyIndentationKind clang::format::FormatStyle::LambdaBodyIndentation

The indentation style of lambda bodies.

Signature (the default) causes the lambda body to be indented one additional level relative to the indentation level of the signature. OuterScope forces the lambda body to be indented one additional level relative to the parent scope containing the lambda signature. For callback-heavy code, it may improve readability to have the signature indented two levels and to use OuterScope. The KJ style guide requires OuterScope. KJ style guide <https://github.com/capnproto/capnproto/blob/master/kjdoc/style-guide.md>_

Version
13

Definition at line 2708 of file Format.h.

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

◆ Language

LanguageKind clang::format::FormatStyle::Language

◆ MacroBlockBegin

std::string clang::format::FormatStyle::MacroBlockBegin

A regular expression matching macros that start a block.

# With:
MacroBlockBegin: "^NS_MAP_BEGIN|\
NS_TABLE_HEAD$"
NS_MAP_END|\
NS_TABLE_.*_END$"
NS_MAP_BEGIN
foo();
NS_MAP_END
NS_TABLE_HEAD
bar();
NS_TABLE_FOO_END
# Without:
NS_MAP_BEGIN
foo();
NS_MAP_END
NS_TABLE_HEAD
bar();
NS_TABLE_FOO_END
Version
3.7

Definition at line 2737 of file Format.h.

Referenced by operator==().

◆ MacroBlockEnd

std::string clang::format::FormatStyle::MacroBlockEnd

A regular expression matching macros that end a block.

Version
3.7

Definition at line 2741 of file Format.h.

Referenced by operator==().

◆ MaxEmptyLinesToKeep

unsigned clang::format::FormatStyle::MaxEmptyLinesToKeep

The maximum number of consecutive empty lines to keep.

int f() { int f() {
int = 1; int i = 1;
i = foo();
i = foo(); return i;
}
return i;
}
Version
3.7

Definition at line 2755 of file Format.h.

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

◆ NamespaceIndentation

NamespaceIndentationKind clang::format::FormatStyle::NamespaceIndentation

The indentation used for namespaces.

Version
3.7

Definition at line 2793 of file Format.h.

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

◆ NamespaceMacros

std::vector<std::string> clang::format::FormatStyle::NamespaceMacros

A vector of macros which are used to open namespace blocks.

These are expected to be macros of the form:

NAMESPACE(<namespace-name>, ...) {
<namespace-content>
}

For example: TESTSUITE

Version
9

Definition at line 2322 of file Format.h.

Referenced by operator==().

◆ ObjCBinPackProtocolList

BinPackStyle clang::format::FormatStyle::ObjCBinPackProtocolList

Controls bin-packing Objective-C protocol conformance list items into as few lines as possible when they go over ColumnLimit.

If Auto (the default), delegates to the value in BinPackParameters. If that is true, bin-packs Objective-C protocol conformance list items into as few lines as possible whenever they go over ColumnLimit.

If Always, always bin-packs Objective-C protocol conformance list items into as few lines as possible whenever they go over ColumnLimit.

If Never, lays out Objective-C protocol conformance list items onto individual lines whenever they go over ColumnLimit.

Always (or Auto, if BinPackParameters=true):
@interface ccccccccccccc () <
ccccccccccccc, ccccccccccccc,
ccccccccccccc, ccccccccccccc> {
}
Never (or Auto, if BinPackParameters=false):
@interface ddddddddddddd () <
ddddddddddddd,
ddddddddddddd,
ddddddddddddd,
ddddddddddddd> {
}
Version
7

Definition at line 2826 of file Format.h.

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

◆ ObjCBlockIndentWidth

unsigned clang::format::FormatStyle::ObjCBlockIndentWidth

The number of characters to use for indentation of ObjC blocks.

ObjCBlockIndentWidth: 4
[operation setCompletionBlock:^{
[self onOperationDone];
}];
Version
3.7

Definition at line 2837 of file Format.h.

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

◆ ObjCBreakBeforeNestedBlockParam

bool clang::format::FormatStyle::ObjCBreakBeforeNestedBlockParam

Break parameters list into lines when there is nested block parameters in a function call.

false:
- (void)_aMethod
{
[self.test1 t:self w:self callback:^(typeof(self) self, NSNumber
*u, NSNumber *v) {
u = c;
}]
}
true:
- (void)_aMethod
{
[self.test1 t:self
w:self
callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
u = c;
}]
}
Version
12

Definition at line 2866 of file Format.h.

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

◆ ObjCSpaceAfterProperty

bool clang::format::FormatStyle::ObjCSpaceAfterProperty

Add a space after @property in Objective-C, i.e.

use @property (readonly) instead of @property(readonly).

Version
3.7

Definition at line 2842 of file Format.h.

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

◆ ObjCSpaceBeforeProtocolList

bool clang::format::FormatStyle::ObjCSpaceBeforeProtocolList

Add a space in front of an Objective-C protocol list, i.e.

use Foo <Protocol> instead of Foo<Protocol>.

Version
3.7

Definition at line 2871 of file Format.h.

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

◆ PackConstructorInitializers

PackConstructorInitializersStyle clang::format::FormatStyle::PackConstructorInitializers

The pack constructor initializers style to use.

Version
14;

Definition at line 2229 of file Format.h.

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

◆ PenaltyBreakAssignment

unsigned clang::format::FormatStyle::PenaltyBreakAssignment

The penalty for breaking around an assignment operator.

Version
5

Definition at line 2875 of file Format.h.

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

◆ PenaltyBreakBeforeFirstCallParameter

unsigned clang::format::FormatStyle::PenaltyBreakBeforeFirstCallParameter

The penalty for breaking a function call after call(.

Version
3.7

Definition at line 2879 of file Format.h.

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

◆ PenaltyBreakComment

unsigned clang::format::FormatStyle::PenaltyBreakComment

The penalty for each line break introduced inside a comment.

Version
3.7

Definition at line 2883 of file Format.h.

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

◆ PenaltyBreakFirstLessLess

unsigned clang::format::FormatStyle::PenaltyBreakFirstLessLess

The penalty for breaking before the first <<.

Version
3.7

Definition at line 2887 of file Format.h.

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

◆ PenaltyBreakString

unsigned clang::format::FormatStyle::PenaltyBreakString

The penalty for each line break introduced inside a string literal.

Version
3.7

Definition at line 2891 of file Format.h.

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

◆ PenaltyBreakTemplateDeclaration

unsigned clang::format::FormatStyle::PenaltyBreakTemplateDeclaration

The penalty for breaking after template declaration.

Version
7

Definition at line 2895 of file Format.h.

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

◆ PenaltyExcessCharacter

unsigned clang::format::FormatStyle::PenaltyExcessCharacter

The penalty for each character outside of the column limit.

Version
3.7

Definition at line 2899 of file Format.h.

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

◆ PenaltyIndentedWhitespace

unsigned clang::format::FormatStyle::PenaltyIndentedWhitespace

Penalty for each character of whitespace indentation (counted relative to leading non-whitespace column).

Version
12

Definition at line 2909 of file Format.h.

Referenced by clang::format::getLLVMStyle().

◆ PenaltyReturnTypeOnItsOwnLine

unsigned clang::format::FormatStyle::PenaltyReturnTypeOnItsOwnLine

Penalty for putting the return type of a function onto its own line.

Version
3.7

Definition at line 2904 of file Format.h.

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

◆ PointerAlignment

PointerAlignmentStyle clang::format::FormatStyle::PointerAlignment

Pointer and reference alignment style.

Version
3.7

Definition at line 2932 of file Format.h.

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

◆ PPIndentWidth

int clang::format::FormatStyle::PPIndentWidth

The number of columns to use for indentation of preprocessor statements.

When set to -1 (default) IndentWidth is used also for preprocessor statements.

#ifdef __linux__
# define FOO
#else
# define BAR
#endif
Version
14

Definition at line 2947 of file Format.h.

Referenced by clang::format::getLLVMStyle().

◆ QualifierAlignment

QualifierAlignmentStyle clang::format::FormatStyle::QualifierAlignment

Different ways to arrange specifiers and qualifiers (e.g.

const/volatile).

Warning
Setting QualifierAlignment to something other than Leave, COULD lead to incorrect code formatting due to incorrect decisions made due to clang-formats lack of complete semantic information. As such extra care should be taken to review code changes made by the use of this option. \endwarning
Version
14

Definition at line 1908 of file Format.h.

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

◆ QualifierOrder

std::vector<std::string> clang::format::FormatStyle::QualifierOrder

The order in which the qualifiers appear.

Order is an array that can contain any of the following:

  • const
  • inline
  • static
  • constexpr
  • volatile
  • restrict
  • type

Note: it MUST contain 'type'. Items to the left of 'type' will be placed to the left of the type and aligned in the order supplied. Items to the right of 'type' will be placed to the right of the type and aligned in the order supplied.

QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ]
Version
14

Definition at line 1930 of file Format.h.

Referenced by operator==().

◆ RawStringFormats

std::vector<RawStringFormat> clang::format::FormatStyle::RawStringFormats

Defines hints for detecting supported languages code blocks in raw strings.

A raw string with a matching delimiter or a matching enclosing function name will be reformatted assuming the specified language based on the style for that language defined in the .clang-format file. If no style has been defined in the .clang-format file for the specific language, a predefined style given by 'BasedOnStyle' is used. If 'BasedOnStyle' is not found, the formatting is based on llvm style. A matching delimiter takes precedence over a matching enclosing function name for determining the language of the raw string contents.

If a canonical delimiter is specified, occurrences of other delimiters for the same language will be updated to the canonical if possible.

There should be at most one specification per language and each delimiter and enclosing function should not occur in multiple specifications.

To configure this in the .clang-format file, use:

RawStringFormats:
- Language: TextProto
Delimiters:
- 'pb'
- 'proto'
EnclosingFunctions:
- 'PARSE_TEXT_PROTO'
BasedOnStyle: google
- Language: Cpp
Delimiters:
- 'cc'
- 'cpp'
BasedOnStyle: llvm
CanonicalDelimiter: 'cc'
Version
6

Definition at line 3007 of file Format.h.

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

◆ ReferenceAlignment

ReferenceAlignmentStyle clang::format::FormatStyle::ReferenceAlignment

Reference alignment style (overrides PointerAlignment for references).

Version
14

Definition at line 3033 of file Format.h.

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

◆ ReflowComments

bool clang::format::FormatStyle::ReflowComments

If true, clang-format will attempt to re-flow comments.

false:
// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
/* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
true:
// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
// information
/* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
* information */
Version
4

Definition at line 3049 of file Format.h.

Referenced by clang::format::getLLVMStyle().

◆ ShortNamespaceLines

unsigned clang::format::FormatStyle::ShortNamespaceLines

The maximal number of unwrapped lines that a short namespace spans.

Defaults to 1.

This determines the maximum length of short namespaces by counting unwrapped lines (i.e. containing neither opening nor closing namespace brace) and makes "FixNamespaceComments" omit adding end comments for those.

namespace a { namespace a {
int foo; int foo;
} } // namespace a
namespace b { namespace b {
int foo; int foo;
int bar; int bar;
} // namespace b } // namespace b
Version
14

Definition at line 3072 of file Format.h.

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

◆ SortIncludes

SortIncludesOptions clang::format::FormatStyle::SortIncludes

Controls if and how clang-format will sort #includes.

If Never, includes are never sorted. If CaseInsensitive, includes are sorted in an ASCIIbetical or case insensitive fashion. If CaseSensitive, includes are sorted in an alphabetical or case sensitive fashion.

Version
4

Definition at line 3112 of file Format.h.

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

◆ SortJavaStaticImport

SortJavaStaticImportOptions clang::format::FormatStyle::SortJavaStaticImport

When sorting Java imports, by default static imports are placed before non-static imports.

If JavaStaticImportAfterImport is After, static imports are placed after non-static imports.

Version
12

Definition at line 3136 of file Format.h.

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

◆ SortUsingDeclarations

bool clang::format::FormatStyle::SortUsingDeclarations

If true, clang-format will sort using declarations.

The order of using declarations is defined as follows: Split the strings by "::" and discard any initial empty strings. The last element of each list is a non-namespace name; all others are namespace names. Sort the lists of names lexicographically, where the sort order of individual names is that all non-namespace names come before all namespace names, and within those groups, names are in case-insensitive lexicographic order.

false: true:
using std::cout; vs. using std::cin;
using std::cin; using std::cout;
Version
5

Definition at line 3153 of file Format.h.

Referenced by clang::format::getLLVMStyle(), and clang::format::getNoStyle().

◆ SpaceAfterCStyleCast

bool clang::format::FormatStyle::SpaceAfterCStyleCast

If true, a space is inserted after C style casts.

true: false:
(int) i; vs. (int)i;
Version
3.5

Definition at line 3161 of file Format.h.

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

◆ SpaceAfterLogicalNot

bool clang::format::FormatStyle::SpaceAfterLogicalNot

If true, a space is inserted after the logical not operator (!).

true: false:
! someExpression(); vs. !someExpression();
Version
9

Definition at line 3169 of file Format.h.

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

◆ SpaceAfterTemplateKeyword

bool clang::format::FormatStyle::SpaceAfterTemplateKeyword

If true, a space will be inserted after the 'template' keyword.

true: false:
template <int> void foo(); vs. template<int> void foo();
Version
4

Definition at line 3177 of file Format.h.

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

◆ SpaceAroundPointerQualifiers

SpaceAroundPointerQualifiersStyle clang::format::FormatStyle::SpaceAroundPointerQualifiers

Defines in which cases to put a space before or after pointer qualifiers.

Version
12

Definition at line 3210 of file Format.h.

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

◆ SpaceBeforeAssignmentOperators

bool clang::format::FormatStyle::SpaceBeforeAssignmentOperators

If false, spaces will be removed before assignment operators.

true: false:
int a = 5; vs. int a= 5;
a += 42; a+= 42;
Version
3.7

Definition at line 3219 of file Format.h.

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

◆ SpaceBeforeCaseColon

bool clang::format::FormatStyle::SpaceBeforeCaseColon

If false, spaces will be removed before case colon.

true: false
switch (x) { vs. switch (x) {
case 1 : break; case 1: break;
} }
Version
12

Definition at line 3229 of file Format.h.

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

◆ SpaceBeforeCpp11BracedList

bool clang::format::FormatStyle::SpaceBeforeCpp11BracedList

If true, a space will be inserted before a C++11 braced list used to initialize an object (after the preceding identifier or type).

true: false:
Foo foo { bar }; vs. Foo foo{ bar };
Foo {}; Foo{};
vector<int> { 1, 2, 3 }; vector<int>{ 1, 2, 3 };
new int[3] { 1, 2, 3 }; new int[3]{ 1, 2, 3 };
Version
7

Definition at line 3241 of file Format.h.

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

◆ SpaceBeforeCtorInitializerColon

bool clang::format::FormatStyle::SpaceBeforeCtorInitializerColon

If false, spaces will be removed before constructor initializer colon.

true: false:
Foo::Foo() : a(a) {} Foo::Foo(): a(a) {}
Version
7

Definition at line 3250 of file Format.h.

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

◆ SpaceBeforeInheritanceColon

bool clang::format::FormatStyle::SpaceBeforeInheritanceColon

If false, spaces will be removed before inheritance colon.

true: false:
class Foo : Bar {} vs. class Foo: Bar {}
Version
7

Definition at line 3258 of file Format.h.

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

◆ SpaceBeforeParens

SpaceBeforeParensOptions clang::format::FormatStyle::SpaceBeforeParens

Defines in which cases to put a space before opening parentheses.

Version
3.5

Definition at line 3321 of file Format.h.

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

◆ SpaceBeforeRangeBasedForLoopColon

bool clang::format::FormatStyle::SpaceBeforeRangeBasedForLoopColon

If false, spaces will be removed before range-based for loop colon.

true: false:
for (auto v : values) {} vs. for(auto v: values) {}
Version
7

Definition at line 3330 of file Format.h.

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

◆ SpaceBeforeSquareBrackets

bool clang::format::FormatStyle::SpaceBeforeSquareBrackets

If true, spaces will be before [.

Lambdas will not be affected. Only the first [ will get a space added.

true: false:
int a [5]; vs. int a[5];
int a [5][5]; vs. int a[5][5];
Version
11

Definition at line 3487 of file Format.h.

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

◆ SpaceInEmptyBlock

bool clang::format::FormatStyle::SpaceInEmptyBlock

If true, spaces will be inserted into {}.

true: false:
void f() { } vs. void f() {}
while (true) { } while (true) {}
Version
11

Definition at line 3339 of file Format.h.

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

◆ SpaceInEmptyParentheses

bool clang::format::FormatStyle::SpaceInEmptyParentheses

If true, spaces may be inserted into ().

true: false:
void f( ) { vs. void f() {
int x[] = {foo( ), bar( )}; int x[] = {foo(), bar()};
if (true) { if (true) {
f( ); f();
} }
} }
Version
3.7

Definition at line 3352 of file Format.h.

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

◆ SpacesBeforeTrailingComments

unsigned clang::format::FormatStyle::SpacesBeforeTrailingComments

The number of spaces before trailing line comments (// - comments).

This does not affect trailing block comments (/* - comments) as those commonly have different usage patterns and a number of special cases.

void f() {
if (true) { // foo1
f(); // bar
} // foo
}
Version
3.7

Definition at line 3369 of file Format.h.

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

◆ SpacesInAngles

SpacesInAnglesStyle clang::format::FormatStyle::SpacesInAngles

The SpacesInAnglesStyle to use for template argument lists.

Version
14

Definition at line 3392 of file Format.h.

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

◆ SpacesInConditionalStatement

bool clang::format::FormatStyle::SpacesInConditionalStatement

If true, spaces will be inserted around if/for/switch/while conditions.

true: false:
if ( a ) { ... } vs. if (a) { ... }
while ( i < 5 ) { ... } while (i < 5) { ... }
Version
11

Definition at line 3402 of file Format.h.

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

◆ SpacesInContainerLiterals

bool clang::format::FormatStyle::SpacesInContainerLiterals

If true, spaces are inserted inside container literals (e.g.

ObjC and Javascript array and dict literals).

true: false:
var arr = [ 1, 2, 3 ]; vs. var arr = [1, 2, 3];
f({a : 1, b : 2, c : 3}); f({a: 1, b: 2, c: 3});
Version
3.7

Definition at line 3412 of file Format.h.

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

◆ SpacesInCStyleCastParentheses

bool clang::format::FormatStyle::SpacesInCStyleCastParentheses

If true, spaces may be inserted into C style casts.

true: false:
x = ( int32 )y vs. x = (int32)y
Version
3.7

Definition at line 3420 of file Format.h.

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

◆ SpacesInLineCommentPrefix

SpacesInLineComment clang::format::FormatStyle::SpacesInLineCommentPrefix

How many spaces are allowed at the start of a line comment.

To disable the maximum set it to -1, apart from that the maximum takes precedence over the minimum.

Minimum = 1 Maximum = -1
// One space is forced
// but more spaces are possible
Minimum = 0
Maximum = 0
//Forces to start every comment directly after the slashes

Note that in line comment sections the relative indent of the subsequent lines is kept, that means the following:

Minimum: 1
//if (b) { // if (b) {
// return true; // return true;
//} // }
Maximum: 0
/// List: ///List:
/// - Foo /// - Foo
/// - Bar /// - Bar
Version
14

Definition at line 3458 of file Format.h.

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

◆ SpacesInParentheses

bool clang::format::FormatStyle::SpacesInParentheses

If true, spaces will be inserted after ( and before ).

true: false:
t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete;
Version
3.7

Definition at line 3466 of file Format.h.

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

◆ SpacesInSquareBrackets

bool clang::format::FormatStyle::SpacesInSquareBrackets

If true, spaces will be inserted after [ and before ].

Lambdas without arguments or unspecified size array declarations will not be affected.

true: false:
int a[ 5 ]; vs. int a[5];
std::unique_ptr<int[]> foo() {} // Won't be affected
Version
3.7

Definition at line 3477 of file Format.h.

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

◆ Standard

LanguageStandard clang::format::FormatStyle::Standard

Parse and format C++ constructs compatible with this standard.

c++03: latest:
vector<set<int> > x; vs. vector<set<int>> x;
Version
3.7

Definition at line 3551 of file Format.h.

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

◆ StatementAttributeLikeMacros

std::vector<std::string> clang::format::FormatStyle::StatementAttributeLikeMacros

Macros which are ignored in front of a statement, as if they were an attribute.

So that they are not parsed as identifier, for example for Qts emit.

unsigned char data = 'x';
emit signal(data); // This is parsed as variable declaration.
unsigned char data = 'x';
emit signal(data); // Now it's fine again.
Version
12

Definition at line 3568 of file Format.h.

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

◆ StatementMacros

std::vector<std::string> clang::format::FormatStyle::StatementMacros

A vector of macros that should be interpreted as complete statements.

Typical macros are expressions, and require a semi-colon to be added; sometimes this is not the case, and this allows to make clang-format aware of such cases.

For example: Q_UNUSED

Version
8

Definition at line 2309 of file Format.h.

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

◆ TabWidth

unsigned clang::format::FormatStyle::TabWidth

◆ TypenameMacros

std::vector<std::string> clang::format::FormatStyle::TypenameMacros

A vector of macros that should be interpreted as type declarations instead of as function calls.

These are expected to be macros of the form:

STACK_OF(...)

In the .clang-format configuration file, this can be configured like:

TypenameMacros: ['STACK_OF', 'LIST']

For example: OpenSSL STACK_OF, BSD LIST_ENTRY.

Version
9

Definition at line 2298 of file Format.h.

Referenced by operator==().

◆ UseCRLF

bool clang::format::FormatStyle::UseCRLF

Use \r\n instead of \n for line breaks.

Also used as fallback if DeriveLineEnding is true.

Version
11

Definition at line 3594 of file Format.h.

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

◆ UseTab

UseTabStyle clang::format::FormatStyle::UseTab

The way to use tab characters in the resulting file.

Version
3.7

Definition at line 3598 of file Format.h.

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

◆ WhitespaceSensitiveMacros

std::vector<std::string> clang::format::FormatStyle::WhitespaceSensitiveMacros

A vector of macros which are whitespace-sensitive and should not be touched.

These are expected to be macros of the form:

STRINGIZE(...)

In the .clang-format configuration file, this can be configured like:

WhitespaceSensitiveMacros: ['STRINGIZE', 'PP_STRINGIZE']

For example: BOOST_PP_STRINGIZE

Version
12

Definition at line 2339 of file Format.h.

Referenced by clang::format::getLLVMStyle().


The documentation for this struct was generated from the following files:
clang::format::FormatStyle::MaxEmptyLinesToKeep
unsigned MaxEmptyLinesToKeep
The maximum number of consecutive empty lines to keep.
Definition: Format.h:2755
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
NULL
#define NULL
Definition: stddef.h:89
clang::format::FormatStyle::ShortNamespaceLines
unsigned ShortNamespaceLines
The maximal number of unwrapped lines that a short namespace spans.
Definition: Format.h:3072
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:54
int
__device__ int
Definition: __clang_hip_libdevice_declares.h:63
b
__device__ __2f16 b
Definition: __clang_hip_libdevice_declares.h:314
clang::index::SymbolKind::Constructor
@ Constructor
clang::format::FormatStyle::PPIndentWidth
int PPIndentWidth
The number of columns to use for indentation of preprocessor statements.
Definition: Format.h:2947
emit
static std::enable_if_t<!std::is_pointer< T >::value, void > emit(Program &P, std::vector< char > &Code, const T &Val, bool &Success)
Helper to write bytecode and bail out if 32-bit offsets become invalid.
Definition: ByteCodeEmitter.cpp:130
clang::format::FormatStyle::BraceWrappingFlags::AfterExternBlock
bool AfterExternBlock
Wrap extern blocks.
Definition: Format.h:1650
clang::format::FormatStyle::IndentWidth
unsigned IndentWidth
The number of columns to use for indentation.
Definition: Format.h:2535
clang::format::FormatStyle::IndentExternBlock
IndentExternBlockStyle IndentExternBlock
IndentExternBlockStyle is the type of indenting of extern blocks.
Definition: Format.h:2502
clang::format::FormatStyle::AlignConsecutiveDeclarations
AlignConsecutiveStyle AlignConsecutiveDeclarations
Style of aligning consecutive declarations.
Definition: Format.h:421
clang::format::FormatStyle::MacroBlockEnd
std::string MacroBlockEnd
A regular expression matching macros that end a block.
Definition: Format.h:2741
x
IRgen optimization opportunities The common pattern of short x
Definition: README.txt:7
clang::format::FormatStyle::StatementAttributeLikeMacros
std::vector< std::string > StatementAttributeLikeMacros
Macros which are ignored in front of a statement, as if they were an attribute.
Definition: Format.h:3568
clang::format::FormatStyle::BraceWrapping
BraceWrappingFlags BraceWrapping
Control of individual brace wrapping cases.
Definition: Format.h:1763
clang::format::FormatStyle::ContinuationIndentWidth
unsigned ContinuationIndentWidth
Indent width for line continuations.
Definition: Format.h:2015
clang::transformer::after
RangeSelector after(RangeSelector Selector)
Selects the point immediately following Selector.
Definition: RangeSelector.cpp:115
clang::format::FormatStyle::MacroBlockBegin
std::string MacroBlockBegin
A regular expression matching macros that start a block.
Definition: Format.h:2737
std::arg
__DEVICE__ _Tp arg(const std::complex< _Tp > &__c)
Definition: complex_cmath.h:40
clang::format::FormatStyle::SpacesBeforeTrailingComments
unsigned SpacesBeforeTrailingComments
The number of spaces before trailing line comments (// - comments).
Definition: Format.h:3369
clang::format::FormatStyle::PointerAlignment
PointerAlignmentStyle PointerAlignment
Pointer and reference alignment style.
Definition: Format.h:2932
c
__device__ __2f16 float c
Definition: __clang_hip_libdevice_declares.h:315
v
do v
Definition: arm_acle.h:76
clang::transformer::name
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...
Definition: RangeSelector.cpp:200
clang::transformer::before
RangeSelector before(RangeSelector Selector)
Selects the (empty) range [B,B) when Selector selects the range [B,E).
Definition: RangeSelector.cpp:106