clang
15.0.0git
|
The FormatStyle
is used to configure the formatting to follow specific guidelines.
More...
#include "clang/Format/Format.h"
Classes | |
struct | AlignConsecutiveStyle |
Alignment options. More... | |
struct | BraceWrappingFlags |
Precise control over the wrapping of braces. More... | |
struct | FormatStyleSet |
struct | RawStringFormat |
See documentation of RawStringFormats . More... | |
struct | SpaceBeforeParensCustom |
Precise control over the spacing before parentheses. More... | |
struct | SpacesInLineComment |
Control of spaces within a single line comment. More... | |
Public Types | |
enum | BracketAlignmentStyle : int8_t { BAS_Align, BAS_DontAlign, BAS_AlwaysBreak, BAS_BlockIndent } |
Different styles for aligning after open brackets. More... | |
enum | ArrayInitializerAlignmentStyle : int8_t { AIAS_Left, AIAS_Right, AIAS_None } |
Different style for aligning array initializers. More... | |
enum | EscapedNewlineAlignmentStyle : int8_t { ENAS_DontAlign, ENAS_Left, ENAS_Right } |
Different styles for aligning escaped newlines. More... | |
enum | OperandAlignmentStyle : int8_t { OAS_DontAlign, OAS_Align, OAS_AlignAfterOperator } |
Different styles for aligning operands. More... | |
enum | ShortBlockStyle : int8_t { SBS_Never, SBS_Empty, SBS_Always } |
Different styles for merging short blocks containing at most one statement. More... | |
enum | ShortFunctionStyle : int8_t { SFS_None, SFS_InlineOnly, SFS_Empty, SFS_Inline, SFS_All } |
Different styles for merging short functions containing at most one statement. More... | |
enum | ShortIfStyle : int8_t { SIS_Never, SIS_WithoutElse, SIS_OnlyFirstIf, SIS_AllIfsAndElse } |
Different styles for handling short if statements. More... | |
enum | ShortLambdaStyle : int8_t { SLS_None, SLS_Empty, SLS_Inline, SLS_All } |
Different styles for merging short lambdas containing at most one statement. More... | |
enum | DefinitionReturnTypeBreakingStyle : int8_t { DRTBS_None, DRTBS_All, DRTBS_TopLevel } |
Different ways to break after the function definition return type. More... | |
enum | ReturnTypeBreakingStyle : int8_t { 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 : int8_t { BTDS_No, BTDS_MultiLine, BTDS_Yes } |
Different ways to break after the template declaration. More... | |
enum | TrailingCommaStyle : int8_t { TCS_None, TCS_Wrapped } |
The style of inserting trailing commas into container literals. More... | |
enum | BinPackStyle : int8_t { 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 : int8_t { BOS_None, BOS_NonAssignment, BOS_All } |
The style of breaking before or after binary operators. More... | |
enum | BraceBreakingStyle : int8_t { 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 : int8_t { BWACS_Never, BWACS_MultiLine, BWACS_Always } |
Different ways to wrap braces after control statements. More... | |
enum | BreakBeforeConceptDeclarationsStyle : int8_t { BBCDS_Never, BBCDS_Allowed, BBCDS_Always } |
Different ways to break before concept declarations. More... | |
enum | BreakConstructorInitializersStyle : int8_t { BCIS_BeforeColon, BCIS_BeforeComma, BCIS_AfterColon } |
Different ways to break initializers. More... | |
enum | QualifierAlignmentStyle : int8_t { QAS_Leave, QAS_Left, QAS_Right, QAS_Custom } |
Different specifiers and qualifiers alignment styles. More... | |
enum | BreakInheritanceListStyle : int8_t { BILS_BeforeColon, BILS_BeforeComma, BILS_AfterColon, BILS_AfterComma } |
Different ways to break inheritance list. More... | |
enum | EmptyLineAfterAccessModifierStyle : int8_t { ELAAMS_Never, ELAAMS_Leave, ELAAMS_Always } |
Different styles for empty line after access modifiers. More... | |
enum | EmptyLineBeforeAccessModifierStyle : int8_t { ELBAMS_Never, ELBAMS_Leave, ELBAMS_LogicalBlock, ELBAMS_Always } |
Different styles for empty line before access modifiers. More... | |
enum | PackConstructorInitializersStyle : int8_t { PCIS_Never, PCIS_BinPack, PCIS_CurrentLine, PCIS_NextLine } |
Different ways to try to fit all constructor initializers on a line. More... | |
enum | PPDirectiveIndentStyle : int8_t { PPDIS_None, PPDIS_AfterHash, PPDIS_BeforeHash } |
Options for indenting preprocessor directives. More... | |
enum | IndentExternBlockStyle : int8_t { IEBS_AfterExternBlock, IEBS_NoIndent, IEBS_Indent } |
Indents extern blocks. More... | |
enum | JavaScriptQuoteStyle : int8_t { JSQS_Leave, JSQS_Single, JSQS_Double } |
Quotation styles for JavaScript strings. More... | |
enum | LanguageKind : int8_t { 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 : int8_t { LBI_Signature, LBI_OuterScope } |
Indentation logic for lambda bodies. More... | |
enum | NamespaceIndentationKind : int8_t { NI_None, NI_Inner, NI_All } |
Different ways to indent namespace contents. More... | |
enum | PointerAlignmentStyle : int8_t { PAS_Left, PAS_Right, PAS_Middle } |
The & , && and * alignment style. More... | |
enum | ReferenceAlignmentStyle : int8_t { RAS_Pointer, RAS_Left, RAS_Right, RAS_Middle } |
The & and && alignment style. More... | |
enum | RequiresClausePositionStyle : int8_t { RCPS_OwnLine, RCPS_WithPreceding, RCPS_WithFollowing, RCPS_SingleLine } |
The possible positions for the requires clause. More... | |
enum | SeparateDefinitionStyle : int8_t { SDS_Leave, SDS_Always, SDS_Never } |
The style if definition blocks should be separated. More... | |
enum | SortIncludesOptions : int8_t { SI_Never, SI_CaseSensitive, SI_CaseInsensitive } |
Include sorting options. More... | |
enum | SortJavaStaticImportOptions : int8_t { SJSIO_Before, SJSIO_After } |
Position for Java Static imports. More... | |
enum | SpaceAroundPointerQualifiersStyle : int8_t { SAPQ_Default, SAPQ_Before, SAPQ_After, SAPQ_Both } |
Different ways to put a space before opening parentheses. More... | |
enum | SpaceBeforeParensStyle : int8_t { SBPO_Never, SBPO_ControlStatements, SBPO_ControlStatementsExceptControlMacros, SBPO_NonEmptyParentheses, SBPO_Always, SBPO_Custom } |
Different ways to put a space before opening parentheses. More... | |
enum | SpacesInAnglesStyle : int8_t { SIAS_Never, SIAS_Always, SIAS_Leave } |
Styles for adding spacing after < and before `> in template argument lists. More... | |
enum | BitFieldColonSpacingStyle : int8_t { BFCS_Both, BFCS_None, BFCS_Before, BFCS_After } |
Styles for adding spacing around : in bitfield definitions. More... | |
enum | LanguageStandard : int8_t { 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 : int8_t { 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 | isJavaScript () const |
bool | operator== (const FormatStyle &R) const |
llvm::Optional< FormatStyle > | GetLanguageStyle (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 fields. 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::string > | AttributeMacros |
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... | |
BreakBeforeConceptDeclarationsStyle | BreakBeforeConceptDeclarations |
The concept declaration style to use. 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::string > | QualifierOrder |
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::string > | ForEachMacros |
A vector of macros that should be interpreted as foreach loops instead of as function calls. More... | |
std::vector< std::string > | IfMacros |
A vector of macros that should be interpreted as conditionals instead of as function calls. More... | |
std::vector< std::string > | TypenameMacros |
A vector of macros that should be interpreted as type declarations instead of as function calls. More... | |
std::vector< std::string > | StatementMacros |
A vector of macros that should be interpreted as complete statements. More... | |
std::vector< std::string > | NamespaceMacros |
A vector of macros which are used to open namespace blocks. More... | |
std::vector< std::string > | WhitespaceSensitiveMacros |
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 | IndentRequiresClause |
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... | |
bool | InsertBraces |
Insert braces after control statements (if , else , for , do , and while ) in C++ unless the control statements are inside macro definitions or the braces would enclose preprocessor directives. More... | |
std::vector< std::string > | JavaImportGroups |
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 | PenaltyBreakOpenParenthesis |
The penalty for breaking after ( . 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< RawStringFormat > | RawStringFormats |
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... | |
bool | RemoveBracesLLVM |
Remove optional braces of control statements (if , else , for , and while ) in C++ according to the LLVM coding style. More... | |
RequiresClausePositionStyle | RequiresClausePosition |
The position of the requires clause. More... | |
SeparateDefinitionStyle | SeparateDefinitionBlocks |
Specifies the use of empty lines to separate definition blocks, including classes, structs, enums, and functions. 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... | |
SpaceBeforeParensStyle | SpaceBeforeParens |
Defines in which cases to put a space before opening parentheses. More... | |
SpaceBeforeParensCustom | SpaceBeforeParensOptions |
Control of individual space before 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::string > | StatementAttributeLikeMacros |
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... | |
The FormatStyle
is used to configure the formatting to follow specific guidelines.
Different style for aligning array initializers.
enum clang::format::FormatStyle::BinaryOperatorStyle : int8_t |
The style of breaking before or after binary operators.
enum clang::format::FormatStyle::BinPackStyle : int8_t |
enum clang::format::FormatStyle::BitFieldColonSpacingStyle : int8_t |
Styles for adding spacing around :
in bitfield definitions.
enum clang::format::FormatStyle::BraceBreakingStyle : int8_t |
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;
}
}
if (b) {
baz(2);
} else {
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
|
BS_Linux | Like 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;
}
}
{
if (b) {
baz(2);
} else {
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
|
BS_Mozilla | Like 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;
}
}
{
if (b) {
baz(2);
} else {
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
|
BS_Stroustrup | Like 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;
}
}
{
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;
}
}
{
if (b)
{
baz(2);
}
else
{
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
|
BS_Whitesmiths | Like 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;
}
}
{
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;
}
}
{
if (b)
{
baz(2);
}
else
{
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
|
BS_WebKit | Like 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;
}
}
{
if (b) {
baz(2);
} else {
baz(5);
}
}
void bar() { foo(true); }
} // namespace N
|
BS_Custom | Configure each individual brace in |
Different ways to wrap braces after control statements.
enum clang::format::FormatStyle::BracketAlignmentStyle : int8_t |
Different styles for aligning after open brackets.
Different ways to break before concept declarations.
Enumerator | |
---|---|
BBCDS_Never | Keep the template declaration line together with |
BBCDS_Allowed | Breaking between template declaration and The actual behavior depends on the content and line breaking rules and penalities. |
BBCDS_Always | Always break before template <typename T>
concept C = ...;
|
Different ways to break initializers.
enum clang::format::FormatStyle::BreakInheritanceListStyle : int8_t |
Different ways to break inheritance list.
Different ways to break after the template declaration.
Different ways to break after the function definition return type.
This option is deprecated and is retained for backwards compatibility.
Different styles for empty line after access modifiers.
EmptyLineBeforeAccessModifier
configuration handles the number of empty lines between two access modifiers.
Different styles for empty line before access modifiers.
enum clang::format::FormatStyle::EscapedNewlineAlignmentStyle : int8_t |
Different styles for aligning escaped newlines.
enum clang::format::FormatStyle::IndentExternBlockStyle : int8_t |
Indents extern blocks.
enum clang::format::FormatStyle::JavaScriptQuoteStyle : int8_t |
Quotation styles for JavaScript strings.
Does not affect template strings.
enum clang::format::FormatStyle::LambdaBodyIndentationKind : int8_t |
Indentation logic for lambda bodies.
enum clang::format::FormatStyle::LanguageKind : int8_t |
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/). |
enum clang::format::FormatStyle::LanguageStandard : int8_t |
Supported language standards for parsing and formatting C++ constructs.
The correct way to spell a specific language version is e.g. c++11
. The historical aliases Cpp03
and Cpp11
are deprecated.
enum clang::format::FormatStyle::NamespaceIndentationKind : int8_t |
Different ways to indent namespace contents.
enum clang::format::FormatStyle::OperandAlignmentStyle : int8_t |
Different styles for aligning operands.
Different ways to try to fit all constructor initializers on a line.
Enumerator | |
---|---|
PCIS_Never | Always put each constructor initializer on its own line. |
PCIS_BinPack | Bin-pack constructor initializers. |
PCIS_CurrentLine | Put all constructor initializers on the current line if they fit. Otherwise, put each one on its own line. |
PCIS_NextLine | Same as Constructor() : a(), b()
: aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(), ddddddddddddd()
: aaaaaaaaaaaaaaaaaaaa(),
bbbbbbbbbbbbbbbbbbbb(),
cccccccccccccccccccc()
|
enum clang::format::FormatStyle::PointerAlignmentStyle : int8_t |
enum clang::format::FormatStyle::PPDirectiveIndentStyle : int8_t |
Options for indenting preprocessor directives.
enum clang::format::FormatStyle::QualifierAlignmentStyle : int8_t |
Different specifiers and qualifiers alignment styles.
enum clang::format::FormatStyle::ReferenceAlignmentStyle : int8_t |
enum clang::format::FormatStyle::RequiresClausePositionStyle : int8_t |
The possible positions for the requires clause.
The IndentRequires
option is only used if the requires
is put on the start of a line.
enum clang::format::FormatStyle::ReturnTypeBreakingStyle : int8_t |
Different ways to break after the function definition or declaration return type.
enum clang::format::FormatStyle::SeparateDefinitionStyle : int8_t |
enum clang::format::FormatStyle::ShortBlockStyle : int8_t |
Different styles for merging short blocks containing at most one statement.
enum clang::format::FormatStyle::ShortFunctionStyle : int8_t |
Different styles for merging short functions containing at most one statement.
enum clang::format::FormatStyle::ShortIfStyle : int8_t |
Different styles for handling short if statements.
enum clang::format::FormatStyle::ShortLambdaStyle : int8_t |
Different styles for merging short lambdas containing at most one statement.
enum clang::format::FormatStyle::SortIncludesOptions : int8_t |
Include sorting options.
enum clang::format::FormatStyle::SortJavaStaticImportOptions : int8_t |
Position for Java Static imports.
Different ways to put a space before opening parentheses.
Enumerator | |
---|---|
SAPQ_Default | Don't ensure spaces around pointer qualifiers and use PointerAlignment instead. PointerAlignment: Left PointerAlignment: Right
|
SAPQ_Before | Ensure that there is a space before pointer qualifiers. PointerAlignment: Left PointerAlignment: Right
|
SAPQ_After | Ensure that there is a space after pointer qualifiers. PointerAlignment: Left PointerAlignment: Right
|
SAPQ_Both | Ensure that there is a space both before and after pointer qualifiers. PointerAlignment: Left PointerAlignment: Right
|
enum clang::format::FormatStyle::SpaceBeforeParensStyle : int8_t |
Different ways to put a space before opening parentheses.
enum clang::format::FormatStyle::SpacesInAnglesStyle : int8_t |
Styles for adding spacing after <
and before `>
in template argument lists.
enum clang::format::FormatStyle::TrailingCommaStyle : int8_t |
The style of inserting trailing commas into container literals.
enum clang::format::FormatStyle::UseTabStyle : int8_t |
Different ways to use tab in formatting.
|
static |
llvm::Optional< FormatStyle > clang::format::FormatStyle::GetLanguageStyle | ( | FormatStyle::LanguageKind | Language | ) | const |
Definition at line 1823 of file Format.cpp.
References clang::format::FormatStyle::FormatStyleSet::Get().
Referenced by clang::format::RawStringFormatStyleManager::RawStringFormatStyleManager().
|
inline |
|
inline |
Definition at line 2595 of file Format.h.
References LK_CSharp.
Referenced by clang::format::FormatTokenLexer::lex().
|
inline |
Definition at line 2597 of file Format.h.
References LK_JavaScript.
Referenced by clang::format::BreakableBlockComment::getContentIndent(), and clang::format::FormatTokenLexer::lex().
|
inline |
Definition at line 2596 of file Format.h.
References LK_Json.
Referenced by clang::format::getLLVMStyle().
|
inline |
Definition at line 3844 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, IndentRequiresClause, 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, PenaltyBreakOpenParenthesis, PenaltyBreakString, PenaltyBreakTemplateDeclaration, PenaltyExcessCharacter, PenaltyReturnTypeOnItsOwnLine, PointerAlignment, QualifierAlignment, QualifierOrder, RawStringFormats, ReferenceAlignment, RemoveBracesLLVM, RequiresClausePosition, SeparateDefinitionBlocks, ShortNamespaceLines, SortIncludes, SortJavaStaticImport, SpaceAfterCStyleCast, SpaceAfterLogicalNot, SpaceAfterTemplateKeyword, SpaceAroundPointerQualifiers, SpaceBeforeAssignmentOperators, SpaceBeforeCaseColon, SpaceBeforeCpp11BracedList, SpaceBeforeCtorInitializerColon, SpaceBeforeInheritanceColon, SpaceBeforeParens, SpaceBeforeParensOptions, SpaceBeforeRangeBasedForLoopColon, SpaceBeforeSquareBrackets, SpaceInEmptyBlock, SpaceInEmptyParentheses, SpacesBeforeTrailingComments, SpacesInAngles, SpacesInConditionalStatement, SpacesInContainerLiterals, SpacesInCStyleCastParentheses, SpacesInLineCommentPrefix, SpacesInParentheses, SpacesInSquareBrackets, Standard, StatementAttributeLikeMacros, StatementMacros, TabWidth, TypenameMacros, UseCRLF, and UseTab.
|
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 occurred.
If set all diagnostics are emitted through the DiagHandler.
Definition at line 1717 of file Format.cpp.
int clang::format::FormatStyle::AccessModifierOffset |
The extra indent or outdent of access modifiers, e.g.
public:
.
Definition at line 62 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 105 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), operator==(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
ArrayInitializerAlignmentStyle clang::format::FormatStyle::AlignArrayOfStructures |
if not None
, when using initialization for an array of structs aligns the fields into columns.
NOTE: As of clang-format 15 this option only applied to arrays with equal number of columns per row.
Definition at line 139 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
AlignConsecutiveStyle clang::format::FormatStyle::AlignConsecutiveAssignments |
Style of aligning consecutive assignments.
Consecutive
will result in formattings like:
Definition at line 274 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
AlignConsecutiveStyle clang::format::FormatStyle::AlignConsecutiveBitFields |
Style of aligning consecutive bit fields.
Consecutive
will align the bitfield separators of consecutive lines. This will result in formattings like:
Definition at line 285 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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:
Definition at line 296 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
AlignConsecutiveStyle clang::format::FormatStyle::AlignConsecutiveMacros |
Style of aligning consecutive macro definitions.
Consecutive
will result in formattings like:
Definition at line 264 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
EscapedNewlineAlignmentStyle clang::format::FormatStyle::AlignEscapedNewlines |
Options for aligning backslashes in escaped newlines.
Definition at line 331 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
OperandAlignmentStyle clang::format::FormatStyle::AlignOperands |
If true
, horizontally align operands of binary and ternary expressions.
Definition at line 370 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::AlignTrailingComments |
If true
, aligns trailing comments.
Definition at line 379 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
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
.
Definition at line 396 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::AllowAllConstructorInitializersOnNextLine |
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
.
Definition at line 419 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
ShortBlockStyle clang::format::FormatStyle::AllowShortBlocksOnASingleLine |
Dependent on the value, while (true) { continue; }
can be put on a single line.
Definition at line 466 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::AllowShortCaseLabelsOnASingleLine |
If true
, short case labels will be contracted to a single line.
Definition at line 480 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::AllowShortEnumsOnASingleLine |
Allow short enums on a single line.
Definition at line 433 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
ShortFunctionStyle clang::format::FormatStyle::AllowShortFunctionsOnASingleLine |
Dependent on the value, int f() { return 0; }
can be put on a single line.
Definition at line 533 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
ShortIfStyle clang::format::FormatStyle::AllowShortIfStatementsOnASingleLine |
Dependent on the value, if (a) return;
can be put on a single line.
Definition at line 604 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
ShortLambdaStyle clang::format::FormatStyle::AllowShortLambdasOnASingleLine |
Dependent on the value, auto lambda []() { return 0; }
can be put on a single line.
Definition at line 638 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::AllowShortLoopsOnASingleLine |
If true
, while (true) continue;
can be put on a single line.
Definition at line 643 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
DefinitionReturnTypeBreakingStyle clang::format::FormatStyle::AlwaysBreakAfterDefinitionReturnType |
The function definition return type breaking style to use.
This option is deprecated and is retained for backwards compatibility.
Definition at line 731 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and clang::format::getMozillaStyle().
ReturnTypeBreakingStyle clang::format::FormatStyle::AlwaysBreakAfterReturnType |
The function declaration return type breaking style to use.
Definition at line 735 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
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.
Definition at line 750 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
BreakTemplateDeclarationsStyle clang::format::FormatStyle::AlwaysBreakTemplateDeclarations |
The template declaration breaking style to use.
Definition at line 790 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
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:
In the .clang-format configuration file, this can be configured like:
Definition at line 809 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 828 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), operator==(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
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.
Definition at line 873 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
BitFieldColonSpacingStyle clang::format::FormatStyle::BitFieldColonSpacing |
The BitFieldColonSpacingStyle to use for bitfields.
Definition at line 3760 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 1641 of file Format.h.
Referenced by clang::format::expandPresetsBraceWrapping(), and clang::format::getLLVMStyle().
bool clang::format::FormatStyle::BreakAfterJavaFieldAnnotations |
Break after each annotation on a field in Java files.
Definition at line 1720 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), and operator==().
BinaryOperatorStyle clang::format::FormatStyle::BreakBeforeBinaryOperators |
The way to wrap binary operators.
Definition at line 928 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
BraceBreakingStyle clang::format::FormatStyle::BreakBeforeBraces |
The brace breaking style to use.
Definition at line 1363 of file Format.h.
Referenced by clang::format::expandPresetsBraceWrapping(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
BreakBeforeConceptDeclarationsStyle clang::format::FormatStyle::BreakBeforeConceptDeclarations |
The concept declaration style to use.
Definition at line 1665 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::BreakBeforeTernaryOperators |
If true
, ternary operators will be placed after line breaks.
Definition at line 1680 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
BreakConstructorInitializersStyle clang::format::FormatStyle::BreakConstructorInitializers |
The break constructor initializers style to use.
Definition at line 1710 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
BreakInheritanceListStyle clang::format::FormatStyle::BreakInheritanceList |
The inheritance list style to use.
Definition at line 1860 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
bool clang::format::FormatStyle::BreakStringLiterals |
Allow breaking string literals when formatting.
Definition at line 1734 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 1742 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().
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.
Definition at line 1752 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
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.
If it does not fit on a single line, the overflowing namespaces get wrapped:
Definition at line 1884 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::ConstructorInitializerAllOnOneLineOrOnePerLine |
unsigned clang::format::FormatStyle::ConstructorInitializerIndentWidth |
The number of characters to use for indentation of constructor initializer lists as well as inheritance lists.
Definition at line 1894 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
unsigned clang::format::FormatStyle::ContinuationIndentWidth |
Indent width for line continuations.
Definition at line 1905 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::BreakableBlockComment::getContentIndent(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
bool clang::format::FormatStyle::Cpp11BracedListStyle |
If true
, format braced lists as best suited for C++11 braced lists.
Important differences:
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.
Definition at line 1928 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), operator==(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
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.
Definition at line 1933 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 1941 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::DisableFormat |
Disables formatting completely.
Definition at line 1945 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getNoStyle(), and operator==().
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.
Definition at line 1996 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
EmptyLineBeforeAccessModifierStyle clang::format::FormatStyle::EmptyLineBeforeAccessModifier |
Defines in which cases to put empty line before access modifiers.
Definition at line 2059 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 2072 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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".
Definition at line 2132 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
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:
In the .clang-format configuration file, this can be configured like:
For example: BOOST_FOREACH.
Definition at line 2150 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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:
In the .clang-format configuration file, this can be configured like:
For example: KJ_IF_MAYBE <https://github.com/capnproto/capnproto/blob/master/kjdoc/tour.md#maybes>
_
Definition at line 2171 of file Format.h.
Referenced by clang::format::getLLVMStyle().
tooling::IncludeStyle clang::format::FormatStyle::IncludeStyle |
Definition at line 2231 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 2258 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 2300 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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).
Definition at line 2277 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
IndentExternBlockStyle clang::format::FormatStyle::IndentExternBlock |
IndentExternBlockStyle is the type of indenting of extern blocks.
Definition at line 2392 of file Format.h.
Referenced by clang::format::expandPresetsBraceWrapping(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::IndentGotoLabels |
Indent goto labels.
When false
, goto labels are flushed left.
Definition at line 2317 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
PPDirectiveIndentStyle clang::format::FormatStyle::IndentPPDirectives |
The preprocessor directive indenting style to use.
Definition at line 2352 of file Format.h.
Referenced by clang::format::ContinuationIndenter::getInitialState(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::IndentRequiresClause |
Indent the requires clause in a template.
This only applies when RequiresClausePosition
is OwnLine
, or WithFollowing
.
In clang-format 12, 13 and 14 it was named IndentRequires
.
Definition at line 2414 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::IndentWidth |
The number of columns to use for indentation.
Definition at line 2428 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::IndentWrappedFunctionNames |
Indent if a function definition or declaration is wrapped after the type.
Definition at line 2442 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::InheritsParentConfig |
Definition at line 58 of file Format.h.
Referenced by clang::format::getLLVMStyle().
bool clang::format::FormatStyle::InsertBraces |
Insert braces after control statements (if
, else
, for
, do
, and while
) in C++ unless the control statements are inside macro definitions or the braces would enclose preprocessor directives.
true
could lead to incorrect code formatting due to clang-format's lack of complete semantic information. As such, extra care should be taken to review code changes made by this option. \endwarning Definition at line 2474 of file Format.h.
Referenced by clang::format::getLLVMStyle().
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.
Definition at line 858 of file Format.h.
Referenced by clang::format::getLLVMStyle().
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.
Definition at line 2508 of file Format.h.
Referenced by clang::format::getChromiumStyle(), and operator==().
JavaScriptQuoteStyle clang::format::FormatStyle::JavaScriptQuotes |
The JavaScriptQuoteStyle to use for JavaScript strings.
Definition at line 2535 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::JavaScriptWrapImports |
Whether to wrap JavaScript import/export statements.
Definition at line 2551 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::KeepEmptyLinesAtTheStartOfBlocks |
If true, the empty line at the start of blocks is kept.
Definition at line 2563 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
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/style-guide.md>
_
Definition at line 2634 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
LanguageKind clang::format::FormatStyle::Language |
Language, this format style is targeted at.
Definition at line 2601 of file Format.h.
Referenced by clang::format::BreakableBlockComment::getContentIndent(), clang::format::getGoogleStyle(), clang::format::ContinuationIndenter::getInitialState(), clang::format::getLLVMStyle(), clang::format::FormatTokenLexer::lex(), operator==(), and clang::format::RawStringFormatStyleManager::RawStringFormatStyleManager().
std::string clang::format::FormatStyle::MacroBlockBegin |
A regular expression matching macros that start a block.
Definition at line 2663 of file Format.h.
Referenced by operator==().
std::string clang::format::FormatStyle::MacroBlockEnd |
A regular expression matching macros that end a block.
Definition at line 2667 of file Format.h.
Referenced by operator==().
unsigned clang::format::FormatStyle::MaxEmptyLinesToKeep |
The maximum number of consecutive empty lines to keep.
Definition at line 2681 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
NamespaceIndentationKind clang::format::FormatStyle::NamespaceIndentation |
The indentation used for namespaces.
Definition at line 2719 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
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:
For example: TESTSUITE
Definition at line 2212 of file Format.h.
Referenced by operator==().
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
.
Definition at line 2752 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::ObjCBlockIndentWidth |
The number of characters to use for indentation of ObjC blocks.
Definition at line 2763 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::ObjCBreakBeforeNestedBlockParam |
Break parameters list into lines when there is nested block parameters in a function call.
Definition at line 2792 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::ObjCSpaceAfterProperty |
Add a space after @property
in Objective-C, i.e.
use @property (readonly)
instead of @property(readonly)
.
Definition at line 2768 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
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>
.
Definition at line 2797 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
PackConstructorInitializersStyle clang::format::FormatStyle::PackConstructorInitializers |
The pack constructor initializers style to use.
Definition at line 2119 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakAssignment |
The penalty for breaking around an assignment operator.
Definition at line 2801 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakBeforeFirstCallParameter |
The penalty for breaking a function call after call(
.
Definition at line 2805 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakComment |
The penalty for each line break introduced inside a comment.
Definition at line 2809 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakFirstLessLess |
The penalty for breaking before the first <<
.
Definition at line 2813 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakOpenParenthesis |
The penalty for breaking after (
.
Definition at line 2817 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakString |
The penalty for each line break introduced inside a string literal.
Definition at line 2821 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakTemplateDeclaration |
The penalty for breaking after template declaration.
Definition at line 2825 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::PenaltyExcessCharacter |
The penalty for each character outside of the column limit.
Definition at line 2829 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::PenaltyIndentedWhitespace |
Penalty for each character of whitespace indentation (counted relative to leading non-whitespace column).
Definition at line 2839 of file Format.h.
Referenced by clang::format::getLLVMStyle().
unsigned clang::format::FormatStyle::PenaltyReturnTypeOnItsOwnLine |
Penalty for putting the return type of a function onto its own line.
Definition at line 2834 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
PointerAlignmentStyle clang::format::FormatStyle::PointerAlignment |
Pointer and reference alignment style.
Definition at line 2862 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
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.
Definition at line 2877 of file Format.h.
Referenced by clang::format::getLLVMStyle().
QualifierAlignmentStyle clang::format::FormatStyle::QualifierAlignment |
Different ways to arrange specifiers and qualifiers (e.g.
const/volatile).
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 Definition at line 1798 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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:
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.
Definition at line 1820 of file Format.h.
Referenced by operator==().
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:
Definition at line 2937 of file Format.h.
Referenced by clang::format::getGoogleStyle(), operator==(), and clang::format::RawStringFormatStyleManager::RawStringFormatStyleManager().
ReferenceAlignmentStyle clang::format::FormatStyle::ReferenceAlignment |
Reference alignment style (overrides PointerAlignment
for references).
Definition at line 2963 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::ReflowComments |
If true
, clang-format will attempt to re-flow comments.
Definition at line 2979 of file Format.h.
Referenced by clang::format::getLLVMStyle().
bool clang::format::FormatStyle::RemoveBracesLLVM |
Remove optional braces of control statements (if
, else
, for
, and while
) in C++ according to the LLVM coding style.
true
could lead to incorrect code formatting due to clang-format's lack of complete semantic information. As such, extra care should be taken to review code changes made by this option. \endwarning Definition at line 3034 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
RequiresClausePositionStyle clang::format::FormatStyle::RequiresClausePosition |
The position of the requires
clause.
Definition at line 3115 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
SeparateDefinitionStyle clang::format::FormatStyle::SeparateDefinitionBlocks |
Specifies the use of empty lines to separate definition blocks, including classes, structs, enums, and functions.
Definition at line 3173 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 3195 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 3235 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), clang::format::getNoStyle(), and operator==().
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.
Definition at line 3259 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 3276 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and clang::format::getNoStyle().
bool clang::format::FormatStyle::SpaceAfterCStyleCast |
If true
, a space is inserted after C style casts.
Definition at line 3284 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceAfterLogicalNot |
If true
, a space is inserted after the logical not operator (!
).
Definition at line 3292 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceAfterTemplateKeyword |
If true
, a space will be inserted after the 'template' keyword.
Definition at line 3300 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and operator==().
SpaceAroundPointerQualifiersStyle clang::format::FormatStyle::SpaceAroundPointerQualifiers |
Defines in which cases to put a space before or after pointer qualifiers.
Definition at line 3333 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceBeforeAssignmentOperators |
If false
, spaces will be removed before assignment operators.
Definition at line 3342 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceBeforeCaseColon |
If false
, spaces will be removed before case colon.
Definition at line 3352 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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).
Definition at line 3364 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceBeforeCtorInitializerColon |
If false
, spaces will be removed before constructor initializer colon.
Definition at line 3373 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceBeforeInheritanceColon |
If false
, spaces will be removed before inheritance colon.
Definition at line 3381 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
SpaceBeforeParensStyle clang::format::FormatStyle::SpaceBeforeParens |
Defines in which cases to put a space before opening parentheses.
Definition at line 3447 of file Format.h.
Referenced by clang::format::expandPresetsSpaceBeforeParens(), clang::format::getLLVMStyle(), and operator==().
SpaceBeforeParensCustom clang::format::FormatStyle::SpaceBeforeParensOptions |
Control of individual space before parentheses.
If SpaceBeforeParens
is set to Custom
, use this to specify how each individual space before parentheses case should be handled. Otherwise, this is ignored.
Definition at line 3563 of file Format.h.
Referenced by clang::format::expandPresetsSpaceBeforeParens(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceBeforeRangeBasedForLoopColon |
If false
, spaces will be removed before range-based for loop colon.
Definition at line 3572 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceBeforeSquareBrackets |
If true
, spaces will be before [
.
Lambdas will not be affected. Only the first [
will get a space added.
Definition at line 3731 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceInEmptyBlock |
If true
, spaces will be inserted into {}
.
Definition at line 3581 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpaceInEmptyParentheses |
If true
, spaces may be inserted into ()
.
Definition at line 3594 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 3611 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
SpacesInAnglesStyle clang::format::FormatStyle::SpacesInAngles |
The SpacesInAnglesStyle to use for template argument lists.
Definition at line 3634 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpacesInConditionalStatement |
If true
, spaces will be inserted around if/for/switch/while conditions.
Definition at line 3644 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpacesInContainerLiterals |
If true
, spaces are inserted inside container literals (e.g.
ObjC and Javascript array and dict literals).
Definition at line 3654 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpacesInCStyleCastParentheses |
If true
, spaces may be inserted into C style casts.
Definition at line 3662 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Note that in line comment sections the relative indent of the subsequent lines is kept, that means the following:
Definition at line 3702 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
bool clang::format::FormatStyle::SpacesInParentheses |
If true
, spaces will be inserted after (
and before )
.
Definition at line 3710 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 3721 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
LanguageStandard clang::format::FormatStyle::Standard |
Parse and format C++ constructs compatible with this standard.
Definition at line 3795 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and operator==().
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.
Definition at line 3812 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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
Definition at line 2199 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
unsigned clang::format::FormatStyle::TabWidth |
The number of columns used for tab stops.
Definition at line 3816 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::BreakableBlockComment::getRangeLength(), clang::format::BreakableLineCommentSection::getRangeLength(), clang::format::BreakableStringLiteral::getRemainingLength(), clang::format::BreakableStringLiteral::getSplit(), clang::format::BreakableComment::getSplit(), clang::format::BreakableBlockComment::getSplit(), and operator==().
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:
In the .clang-format configuration file, this can be configured like:
For example: OpenSSL STACK_OF, BSD LIST_ENTRY.
Definition at line 2188 of file Format.h.
Referenced by operator==().
bool clang::format::FormatStyle::UseCRLF |
Use \r\n
instead of \n
for line breaks.
Also used as fallback if DeriveLineEnding
is true.
Definition at line 3838 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
UseTabStyle clang::format::FormatStyle::UseTab |
The way to use tab characters in the resulting file.
Definition at line 3842 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and operator==().
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:
In the .clang-format configuration file, this can be configured like:
For example: BOOST_PP_STRINGIZE
Definition at line 2229 of file Format.h.
Referenced by clang::format::getLLVMStyle().