clang
3.9.0
|
The FormatStyle
is used to configure the formatting to follow specific guidelines.
More...
#include <Format.h>
Classes | |
struct | BraceWrappingFlags |
Precise control over the wrapping of braces. More... | |
struct | IncludeCategory |
See documentation of IncludeCategories . More... | |
Public Types | |
enum | BracketAlignmentStyle { BAS_Align, BAS_DontAlign, BAS_AlwaysBreak } |
Different styles for aligning after open brackets. More... | |
enum | ShortFunctionStyle { SFS_None, SFS_Empty, SFS_Inline, SFS_All } |
Different styles for merging short functions containing at most one statement. More... | |
enum | DefinitionReturnTypeBreakingStyle { DRTBS_None, DRTBS_All, DRTBS_TopLevel } |
Different ways to break after the function definition return type. More... | |
enum | ReturnTypeBreakingStyle { RTBS_None, RTBS_All, RTBS_TopLevel, RTBS_AllDefinitions, RTBS_TopLevelDefinitions } |
Different ways to break after the function definition or declaration return type. More... | |
enum | BinaryOperatorStyle { BOS_None, BOS_NonAssignment, BOS_All } |
The style of breaking before or after binary operators. More... | |
enum | BraceBreakingStyle { BS_Attach, BS_Linux, BS_Mozilla, BS_Stroustrup, BS_Allman, BS_GNU, BS_WebKit, BS_Custom } |
Different ways to attach braces to their surrounding context. More... | |
enum | JavaScriptQuoteStyle { JSQS_Leave, JSQS_Single, JSQS_Double } |
Quotation styles for JavaScript strings. More... | |
enum | LanguageKind { LK_None, LK_Cpp, LK_Java, LK_JavaScript, LK_Proto, LK_TableGen } |
Supported languages. More... | |
enum | NamespaceIndentationKind { NI_None, NI_Inner, NI_All } |
Different ways to indent namespace contents. More... | |
enum | PointerAlignmentStyle { PAS_Left, PAS_Right, PAS_Middle } |
The & and * alignment style. More... | |
enum | SpaceBeforeParensOptions { SBPO_Never, SBPO_ControlStatements, SBPO_Always } |
Different ways to put a space before opening parentheses. More... | |
enum | LanguageStandard { LS_Cpp03, LS_Cpp11, LS_Auto } |
Supported language standards. More... | |
enum | UseTabStyle { UT_Never, UT_ForIndentation, UT_ForContinuationAndIndentation, UT_Always } |
Different ways to use tab in formatting. More... | |
Public Member Functions | |
bool | operator== (const FormatStyle &R) const |
Public Attributes | |
int | AccessModifierOffset |
The extra indent or outdent of access modifiers, e.g. public: . More... | |
BracketAlignmentStyle | AlignAfterOpenBracket |
If true , horizontally aligns arguments after an open bracket. More... | |
bool | AlignConsecutiveAssignments |
If true , aligns consecutive assignments. More... | |
bool | AlignConsecutiveDeclarations |
If true , aligns consecutive declarations. More... | |
bool | AlignEscapedNewlinesLeft |
If true , aligns escaped newlines as far left as possible. More... | |
bool | AlignOperands |
If true , horizontally align operands of binary and ternary expressions. More... | |
bool | AlignTrailingComments |
If true , aligns trailing comments. More... | |
bool | AllowAllParametersOfDeclarationOnNextLine |
Allow putting all parameters of a function declaration onto the next line even if BinPackParameters is false . More... | |
bool | AllowShortBlocksOnASingleLine |
Allows contracting simple braced statements to 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... | |
bool | AllowShortIfStatementsOnASingleLine |
If true , if (a) return; 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... | |
bool | AlwaysBreakTemplateDeclarations |
If true , always break after the template<...> of a template declaration. 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... | |
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 | BreakBeforeTernaryOperators |
If true , ternary operators will be placed after line breaks. More... | |
bool | BreakConstructorInitializersBeforeComma |
Always break constructor initializers before commas and align the commas with the colon. 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... | |
bool | ConstructorInitializerAllOnOneLineOrOnePerLine |
If the constructor initializers don't fit on a line, put each initializer on its own line. More... | |
unsigned | ConstructorInitializerIndentWidth |
The number of characters to use for indentation of constructor initializer 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 | DerivePointerAlignment |
If true , analyze the formatted file for the most common alignment of & and * . More... | |
bool | DisableFormat |
Disables formatting completely. More... | |
bool | ExperimentalAutoDetectBinPacking |
If true , clang-format detects whether function calls and definitions are formatted with one parameter per line. 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< IncludeCategory > | IncludeCategories |
Regular expressions denoting the different #include categories used for ordering #includes . More... | |
std::string | IncludeIsMainRegex |
Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping. More... | |
bool | IndentCaseLabels |
Indent case labels one level from the switch statement. 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... | |
JavaScriptQuoteStyle | JavaScriptQuotes |
The JavaScriptQuoteStyle to use for JavaScript strings. More... | |
bool | JavaScriptWrapImports |
Whether to wrap JavaScript import/export statements. More... | |
bool | KeepEmptyLinesAtTheStartOfBlocks |
If true, empty lines at the start of blocks are kept. More... | |
LanguageKind | Language |
Language, this format style is targeted at. 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... | |
unsigned | ObjCBlockIndentWidth |
The number of characters to use for indentation of ObjC blocks. More... | |
bool | ObjCSpaceAfterProperty |
bool | ObjCSpaceBeforeProtocolList |
Add a space in front of an Objective-C protocol list, i.e. 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 | 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... | |
PointerAlignmentStyle | PointerAlignment |
Pointer and reference alignment style. More... | |
bool | ReflowComments |
If true , clang-format will attempt to re-flow comments. More... | |
bool | SortIncludes |
If true , clang-format will sort #includes . More... | |
bool | SpaceAfterCStyleCast |
If true , a space may be inserted after C style casts. More... | |
bool | SpaceBeforeAssignmentOperators |
If false , spaces will be removed before assignment operators. More... | |
SpaceBeforeParensOptions | SpaceBeforeParens |
Defines in which cases to put a space before opening parentheses. More... | |
bool | SpaceInEmptyParentheses |
If true , spaces may be inserted into () . More... | |
unsigned | SpacesBeforeTrailingComments |
The number of spaces before trailing line comments (// - comments). More... | |
bool | SpacesInAngles |
If true , spaces will be inserted after < and before > in template argument lists. 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... | |
bool | SpacesInParentheses |
If true , spaces will be inserted after ( and before ) . More... | |
bool | SpacesInSquareBrackets |
If true , spaces will be inserted after [ and before ] . More... | |
LanguageStandard | Standard |
Format compatible with this standard, e.g. More... | |
unsigned | TabWidth |
The number of columns used for tab stops. More... | |
UseTabStyle | UseTab |
The way to use tab characters in the resulting file. More... | |
The FormatStyle
is used to configure the formatting to follow specific guidelines.
Different ways to attach braces to their surrounding context.
Different styles for aligning after open brackets.
Different ways to break after the function definition return type.
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++, ObjectiveC, ObjectiveC++. |
LK_Java |
Should be used for Java. |
LK_JavaScript |
Should be used for JavaScript. |
LK_Proto |
Should be used for Protocol Buffers (https://developers.google.com/protocol-buffers/). |
LK_TableGen |
Should be used for TableGen code. |
Different ways to break after the function definition or declaration return type.
Different styles for merging short functions containing at most one statement.
Different ways to put a space before opening parentheses.
Different ways to use tab in formatting.
|
inline |
Definition at line 633 of file Format.h.
References AccessModifierOffset, AlignAfterOpenBracket, AlignConsecutiveAssignments, AlignConsecutiveDeclarations, AlignEscapedNewlinesLeft, AlignOperands, AlignTrailingComments, AllowAllParametersOfDeclarationOnNextLine, AllowShortBlocksOnASingleLine, AllowShortCaseLabelsOnASingleLine, AllowShortFunctionsOnASingleLine, AllowShortIfStatementsOnASingleLine, AllowShortLoopsOnASingleLine, AlwaysBreakAfterReturnType, AlwaysBreakBeforeMultilineStrings, AlwaysBreakTemplateDeclarations, BinPackArguments, BinPackParameters, BreakAfterJavaFieldAnnotations, BreakBeforeBinaryOperators, BreakBeforeBraces, BreakBeforeTernaryOperators, BreakConstructorInitializersBeforeComma, BreakStringLiterals, ColumnLimit, CommentPragmas, ConstructorInitializerAllOnOneLineOrOnePerLine, ConstructorInitializerIndentWidth, ContinuationIndentWidth, Cpp11BracedListStyle, DerivePointerAlignment, DisableFormat, ExperimentalAutoDetectBinPacking, ForEachMacros, IncludeCategories, IndentCaseLabels, IndentWidth, IndentWrappedFunctionNames, JavaScriptQuotes, JavaScriptWrapImports, KeepEmptyLinesAtTheStartOfBlocks, Language, MacroBlockBegin, MacroBlockEnd, MaxEmptyLinesToKeep, NamespaceIndentation, ObjCBlockIndentWidth, ObjCSpaceAfterProperty, ObjCSpaceBeforeProtocolList, PenaltyBreakBeforeFirstCallParameter, PenaltyBreakComment, PenaltyBreakFirstLessLess, PenaltyBreakString, PenaltyExcessCharacter, PenaltyReturnTypeOnItsOwnLine, PointerAlignment, SpaceAfterCStyleCast, SpaceBeforeAssignmentOperators, SpaceBeforeParens, SpaceInEmptyParentheses, SpacesBeforeTrailingComments, SpacesInAngles, SpacesInContainerLiterals, SpacesInCStyleCastParentheses, SpacesInParentheses, SpacesInSquareBrackets, Standard, TabWidth, and UseTab.
int clang::format::FormatStyle::AccessModifierOffset |
The extra indent or outdent of access modifiers, e.g. public:
.
Definition at line 48 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 77 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), operator==(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
bool clang::format::FormatStyle::AlignConsecutiveAssignments |
If true
, aligns consecutive assignments.
This will align the assignment operators of consecutive lines. This will result in formattings like
Definition at line 88 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::AlignConsecutiveDeclarations |
If true
, aligns consecutive declarations.
This will align the declaration names of consecutive lines. This will result in formattings like
Definition at line 99 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::AlignEscapedNewlinesLeft |
If true
, aligns escaped newlines as far left as possible.
Otherwise puts them into the right-most column.
Definition at line 103 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::AlignOperands |
If true
, 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.:
Definition at line 114 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::AlignTrailingComments |
If true
, aligns trailing comments.
Definition at line 117 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::AllowAllParametersOfDeclarationOnNextLine |
Allow putting all parameters of a function declaration onto the next line even if BinPackParameters
is false
.
Definition at line 121 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::AllowShortBlocksOnASingleLine |
Allows contracting simple braced statements to a single line.
E.g., this allows if (a) { return; }
to be put on a single line.
Definition at line 126 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::AllowShortCaseLabelsOnASingleLine |
If true
, short case labels will be contracted to a single line.
Definition at line 129 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 146 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::ContinuationIndenter::mustBreak(), and operator==().
bool clang::format::FormatStyle::AllowShortIfStatementsOnASingleLine |
If true
, if (a) return;
can be put on a single line.
Definition at line 149 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::AllowShortLoopsOnASingleLine |
If true
, while (true) continue;
can be put on a single line.
Definition at line 153 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 184 of file Format.h.
Referenced by clang::format::getGNUStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), and llvm::yaml::MappingTraits< FormatStyle >::mapping().
ReturnTypeBreakingStyle clang::format::FormatStyle::AlwaysBreakAfterReturnType |
The function declaration return type breaking style to use.
Definition at line 187 of file Format.h.
Referenced by clang::format::ContinuationIndenter::canBreak(), clang::format::getGNUStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 195 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::ContinuationIndenter::mustBreak(), and operator==().
bool clang::format::FormatStyle::AlwaysBreakTemplateDeclarations |
If true
, always break after the template<...>
of a template declaration.
Definition at line 199 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 203 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 207 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::ContinuationIndenter::mustBreak(), 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 280 of file Format.h.
Referenced by clang::format::CompoundStatementIndenter::CompoundStatementIndenter(), clang::format::expandPresets(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and clang::format::ShouldBreakBeforeBrace().
bool clang::format::FormatStyle::BreakAfterJavaFieldAnnotations |
Break after each annotation on a field in Java files.
Definition at line 290 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
BinaryOperatorStyle clang::format::FormatStyle::BreakBeforeBinaryOperators |
The way to wrap binary operators.
Definition at line 220 of file Format.h.
Referenced by clang::format::getGNUStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
BraceBreakingStyle clang::format::FormatStyle::BreakBeforeBraces |
The brace breaking style to use.
Definition at line 248 of file Format.h.
Referenced by clang::format::expandPresets(), clang::format::getGNUStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::BreakBeforeTernaryOperators |
If true
, ternary operators will be placed after line breaks.
Definition at line 283 of file Format.h.
Referenced by clang::format::getGNUStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::ContinuationIndenter::mustBreak(), and operator==().
bool clang::format::FormatStyle::BreakConstructorInitializersBeforeComma |
Always break constructor initializers before commas and align the commas with the colon.
Definition at line 287 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::ContinuationIndenter::mustBreak(), operator==(), and clang::format::startsNextParameter().
bool clang::format::FormatStyle::BreakStringLiterals |
Allow breaking string literals when formatting.
Definition at line 293 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 300 of file Format.h.
Referenced by clang::format::AlignTokens(), clang::format::CommaSeparatedList::formatAfterToken(), clang::format::ContinuationIndenter::getColumnLimit(), clang::format::getGNUStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::ContinuationIndenter::mustBreak(), operator==(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
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 304 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::ConstructorInitializerAllOnOneLineOrOnePerLine |
If the constructor initializers don't fit on a line, put each initializer on its own line.
Definition at line 308 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::ConstructorInitializerIndentWidth |
The number of characters to use for indentation of constructor initializer lists.
Definition at line 312 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::ContinuationIndentWidth |
Indent width for line continuations.
Definition at line 315 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::ContinuationIndenter::mustBreak(), 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 330 of file Format.h.
Referenced by clang::format::getGNUStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::FormatToken::opensBlockOrBlockTypeList(), operator==(), and clang::format::CommaSeparatedList::precomputeFormattingInfos().
bool clang::format::FormatStyle::DerivePointerAlignment |
If true
, analyze the formatted file for the most common alignment of &
and *
.
PointerAlignment
is then used only as fallback.
Definition at line 335 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::DisableFormat |
Disables formatting completely.
Definition at line 338 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getNoStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), operator==(), and clang::format::reformat().
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 350 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 367 of file Format.h.
Referenced by clang::format::FormatTokenLexer::FormatTokenLexer(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
std::vector<IncludeCategory> clang::format::FormatStyle::IncludeCategories |
Regular expressions denoting the different #include
categories used for ordering #includes
.
These regular expressions are matched against the filename of an include (including the <> or "") in order. The value belonging to the first matching regular expression is assigned and #includes
are sorted first according to increasing category number and then alphabetically within each category.
If none of the regular expressions match, INT_MAX is assigned as category. The main header for a source file automatically gets category 0. so that it is generally kept at the beginning of the #includes
(http://llvm.org/docs/CodingStandards.html#include-style). However, you can also assign negative priorities if you have certain headers that always need to be first.
To configure this in the .clang-format file, use:
Definition at line 406 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
std::string clang::format::FormatStyle::IncludeIsMainRegex |
Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping.
When guessing whether a #include is the "main" include (to assign category 0, see above), use this regex of allowed suffixes to the header stem. A partial match is done, so that:
For example, if configured to "(_test)?$", then a header a.h would be seen as the "main" include in both a.cc and a_test.cc.
Definition at line 419 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and llvm::yaml::MappingTraits< FormatStyle >::mapping().
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.
Definition at line 425 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::IndentWidth |
The number of columns to use for indentation.
Definition at line 428 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::IndentWrappedFunctionNames |
Indent if a function definition or declaration is wrapped after the type.
Definition at line 432 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
JavaScriptQuoteStyle clang::format::FormatStyle::JavaScriptQuotes |
The JavaScriptQuoteStyle to use for JavaScript strings.
Definition at line 446 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::JavaScriptWrapImports |
Whether to wrap JavaScript import/export statements.
Definition at line 449 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::KeepEmptyLinesAtTheStartOfBlocks |
If true, empty lines at the start of blocks are kept.
Definition at line 452 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
LanguageKind clang::format::FormatStyle::Language |
Language, this format style is targeted at.
Definition at line 476 of file Format.h.
Referenced by llvm::yaml::DocumentListTraits< std::vector< FormatStyle > >::element(), clang::format::getFormattingLangOpts(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getPredefinedStyle(), clang::format::getStyle(), clang::format::FormatTokenLexer::lex(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::ContinuationIndenter::mustBreak(), operator==(), clang::format::parseConfiguration(), clang::format::sortIncludes(), and clang::format::TokenAnalyzer::TokenAnalyzer().
std::string clang::format::FormatStyle::MacroBlockBegin |
A regular expression matching macros that start a block.
Definition at line 479 of file Format.h.
Referenced by llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
std::string clang::format::FormatStyle::MacroBlockEnd |
A regular expression matching macros that end a block.
Definition at line 482 of file Format.h.
Referenced by llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::MaxEmptyLinesToKeep |
The maximum number of consecutive empty lines to keep.
Definition at line 485 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
NamespaceIndentationKind clang::format::FormatStyle::NamespaceIndentation |
The indentation used for namespaces.
Definition at line 498 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::ObjCBlockIndentWidth |
The number of characters to use for indentation of ObjC blocks.
Definition at line 501 of file Format.h.
Referenced by clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::ObjCSpaceAfterProperty |
Definition at line 505 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 509 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakBeforeFirstCallParameter |
The penalty for breaking a function call after call(
.
Definition at line 512 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakComment |
The penalty for each line break introduced inside a comment.
Definition at line 515 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakFirstLessLess |
The penalty for breaking before the first <<
.
Definition at line 518 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::PenaltyBreakString |
The penalty for each line break introduced inside a string literal.
Definition at line 521 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::PenaltyExcessCharacter |
The penalty for each character outside of the column limit.
Definition at line 524 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::PenaltyReturnTypeOnItsOwnLine |
Penalty for putting the return type of a function onto its own line.
Definition at line 528 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
PointerAlignmentStyle clang::format::FormatStyle::PointerAlignment |
Pointer and reference alignment style.
Definition at line 541 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getMozillaStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::ReflowComments |
If true
, clang-format will attempt to re-flow comments.
Definition at line 544 of file Format.h.
Referenced by clang::format::getLLVMStyle(), and llvm::yaml::MappingTraits< FormatStyle >::mapping().
bool clang::format::FormatStyle::SortIncludes |
If true
, clang-format will sort #includes
.
Definition at line 547 of file Format.h.
Referenced by clang::format::getChromiumStyle(), clang::format::getLLVMStyle(), clang::format::getNoStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and clang::format::sortIncludes().
bool clang::format::FormatStyle::SpaceAfterCStyleCast |
If true
, a space may be inserted after C style casts.
Definition at line 550 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::SpaceBeforeAssignmentOperators |
If false
, spaces will be removed before assignment operators.
Definition at line 553 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
SpaceBeforeParensOptions clang::format::FormatStyle::SpaceBeforeParens |
Defines in which cases to put a space before opening parentheses.
Definition at line 570 of file Format.h.
Referenced by clang::format::getGNUStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::SpaceInEmptyParentheses |
If true
, spaces may be inserted into ()
.
Definition at line 573 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 581 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::SpacesInAngles |
If true
, spaces will be inserted after <
and before >
in template argument lists.
Definition at line 585 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), 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 589 of file Format.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::SpacesInCStyleCastParentheses |
If true
, spaces may be inserted into C style casts.
Definition at line 592 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::SpacesInParentheses |
If true
, spaces will be inserted after (
and before )
.
Definition at line 595 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
bool clang::format::FormatStyle::SpacesInSquareBrackets |
If true
, spaces will be inserted after [
and before ]
.
Definition at line 598 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
LanguageStandard clang::format::FormatStyle::Standard |
Format compatible with this standard, e.g.
use A<A<int> >
instead of A<A<int>>
for LS_Cpp03
.
Definition at line 612 of file Format.h.
Referenced by clang::format::getFormattingLangOpts(), clang::format::getGNUStyle(), clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::format::getWebKitStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
unsigned clang::format::FormatStyle::TabWidth |
The number of columns used for tab stops.
Definition at line 615 of file Format.h.
Referenced by clang::format::BreakableSingleLineToken::getLineLengthAfterSplit(), clang::format::BreakableBlockComment::getLineLengthAfterSplit(), clang::format::getLLVMStyle(), clang::format::BreakableStringLiteral::getSplit(), clang::format::BreakableLineComment::getSplit(), clang::format::BreakableBlockComment::getSplit(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().
UseTabStyle clang::format::FormatStyle::UseTab |
The way to use tab characters in the resulting file.
Definition at line 631 of file Format.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and operator==().