Schema URL

Type: object

The .clang-format file is a YAML file defining formatting styles used by clang-format.

see https://clang.llvm.org/docs/ClangFormatStyleOptions.html

Properties

BasedOnStyle string

The style used for all options not specifically set in the configuration.

Values: "Chromium" "Google" "LLVM" "Mozilla" "WebKit" "Microsoft" "GNU" "InheritParentConfig" "chromium" "google" "llvm" "mozilla" "webkit" "microsoft" "gnu" "inheritparentconfig"
AccessModifierOffset integer

clang-format 3.3

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

AlignAfterOpenBracket string

clang-format 3.8

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

Values: "Align" "DontAlign" "AlwaysBreak" "BlockIndent"
AlignArrayOfStructures string

clang-format 13

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.

Values: "None" "Left" "Right"
AlignConsecutiveMacros string | object
AlignConsecutiveAssignments string | object
AlignConsecutiveBitFields string | object
AlignConsecutiveDeclarations string | object
AlignConsecutiveShortCaseStatements object

clang-format 17

Style of aligning consecutive short case labels.

5 nested properties
Enabled boolean

Whether aligning is enabled.

AcrossEmptyLines boolean

Whether to align across empty lines.

AcrossComments boolean

Whether to align across comments.

AlignCaseColons boolean

Whether aligned case labels are aligned on the colon or on the tokens after the colon.

AlignCaseArrows boolean

Whether to align the case arrows when aligning short case expressions.

AlignEscapedNewlines string

clang-format 5

Options for aligning backslashes in escaped newlines.

Values: "Left" "Right" "DontAlign" "LeftWithLastLine"
AlignOperands string

clang-format 3.5

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

Values: "Align" "DontAlign" "AlignAfterOperator"
AlignTrailingComments boolean | object

Control of trailing comments.

AllowAllArgumentsOnNextLine boolean

clang-format 9

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.

AllowAllConstructorInitializersOnNextLine boolean

clang-format 9

This option is deprecated in clang-format 15. See NextLine of PackConstructorInitializers.

If a constructor definition with a member initializer list doesn't fit on a single line, allow putting all member initializers onto the next line, if ConstructorInitializerAllOnOneLineOrOnePerLine is true. Note that this parameter has no effect if ConstructorInitializerAllOnOneLineOrOnePerLine is false.

AllowAllParametersOfDeclarationOnNextLine boolean

clang-format 3.3

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.

AllowBreakBeforeNoexceptSpecifier string

clang-format 18

Controls if there could be a line break before a noexcept specifier.

Values: "Never" "OnlyWithParen" "Always"
AllowShortEnumsOnASingleLine boolean

clang-format 11

Allow short enums on a single line.

AllowShortBlocksOnASingleLine string

clang-format 3.5

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

Values: "Never" "Empty" "Always"
AllowShortCaseLabelsOnASingleLine boolean

clang-format 3.6

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

AllowShortCompoundRequirementOnASingleLine boolean

clang-format 18

Allow short compound requirement on a single line.

AllowShortFunctionsOnASingleLine string

clang-format 3.5

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

Values: "All" "None" "Inline" "Empty" "InlineOnly"
AllowShortLambdasOnASingleLine string

clang-format 9

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

Values: "None" "Empty" "Inline" "All"
AllowShortIfStatementsOnASingleLine string

clang-format 3.3

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

Values: "AllIfsAndElse" "Never" "WithoutElse" "OnlyFirstIf"
AllowShortLoopsOnASingleLine boolean

clang-format 3.7

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

AlwaysBreakAfterDefinitionReturnType string

clang-format 3.7

This option is deprecated and is retained for backwards compatibility.

The function definition return type breaking style to use. This option is deprecated and is retained for backwards compatibility

Values: "None" "All" "TopLevel"
AlwaysBreakAfterReturnType string

clang-format 19

The function declaration return type breaking style to use.

Values: "Automatic" "ExceptShortType" "None" "All" "TopLevel" "AllDefinitions" "TopLevelDefinitions"
AlwaysBreakBeforeMultilineStrings boolean

clang-format 3.4

If true, always break before multiline string literals.

AlwaysBreakTemplateDeclarations string

clang-format 19

The template declaration breaking style to use.

Values: "Leave" "No" "MultiLine" "Yes"
AttributeMacros string[]

clang-format 12

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.

BinPackArguments boolean

clang-format 3.7

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

BinPackParameters string

clang-format 3.7

The bin pack parameters style to use.

Values: "BinPack" "OnePerLine" "AlwaysOnePerLine"
BitFieldColonSpacing string

clang-format 12

The BitFieldColonSpacingStyle to use for bitfields.

Values: "Both" "None" "Before" "After"
BraceWrapping object

clang-format 3.8

Control of individual brace wrapping cases. If BreakBeforeBraces is set to Custom, use this to specify how each individual brace case should be handled. Otherwise, this is ignored.

18 nested properties
AfterCaseLabel boolean

Wrap case labels.

AfterClass boolean

Wrap class definitions.

AfterControlStatement string

Wrap control statements (if/for/while/switch/...).

Values: "Never" "MultiLine" "Always"
AfterEnum boolean

Wrap enum definitions.

AfterFunction boolean

Wrap function definitions.

AfterNamespace boolean

Wrap namespace definitions.

AfterObjCDeclaration boolean

Wrap ObjC definitions (interfaces, implementations…). @autoreleasepool and @synchronized blocks are wrapped according to AfterControlStatement flag.

AfterStruct boolean

Wrap struct definitions.

AfterUnion boolean

Wrap union definitions.

AfterExternBlock boolean

Wrap extern blocks.

BeforeCatch boolean

Wrap before catch.

BeforeElse boolean

Wrap before else.

BeforeLambdaBody boolean

Wrap lambda block.

BeforeWhile boolean

Wrap before while.

IndentBraces boolean

Indent the wrapped braces themselves.

SplitEmptyFunction boolean

If false, empty function body can be put on a single line. This option is used only if the opening brace of the function has already been wrapped, i.e. the AfterFunction brace wrapping mode is set, and the function could/should not be put on a single line (as per AllowShortFunctionsOnASingleLine and constructor formatting options).

SplitEmptyRecord boolean

If false, empty record (e.g. class, struct or union) body can be put on a single line. This option is used only if the opening brace of the record has already been wrapped, i.e. the AfterClass (for classes) brace wrapping mode is set.

SplitEmptyNamespace boolean

If false, empty namespace body can be put on a single line. This option is used only if the opening brace of the namespace has already been wrapped, i.e. the AfterNamespace brace wrapping mode is set.

BracedInitializerIndentWidth integer

clang-format 17

The number of columns to use to indent the contents of braced init lists. If unset or negative, ContinuationIndentWidth is used.

BreakAdjacentStringLiterals boolean

clang-format 18

Break between adjacent string literals.

BreakAfterAttributes string

clang-format 16

Break after a group of C++11 attributes before a function declaration/definition name.

Values: "Always" "Leave" "Never"
BreakAfterJavaFieldAnnotations boolean

clang-format 3.8

Break after each annotation on a field in Java files.

BreakArrays boolean

clang-format 16

If true, clang-format will always break after a Json array [ otherwise it will scan until the closing ] to determine if it should add newlines between elements (prettier compatible).

BreakBeforeInlineASMColon string

clang-format 16

The inline ASM colon style to use..

Values: "Never" "OnlyMultiline" "Always"
BreakBeforeBinaryOperators string

clang-format 3.6

The way to wrap binary operators.

Values: "None" "NonAssignment" "All"
BreakBeforeBraces string

clang-format 3.7

The brace breaking style to use.

Values: "Attach" "Linux" "Mozilla" "Stroustrup" "Allman" "Whitesmiths" "GNU" "WebKit" "Custom"
BreakBeforeConceptDeclarations string

clang-format 12

The concept declaration style to use.

Values: "Never" "Allowed" "Always"
BreakBeforeTernaryOperators boolean

clang-format 3.7

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

BreakConstructorInitializers string

clang-format 5

The constructor initializers style to use.

Values: "BeforeColon" "BeforeComma" "AfterColon"
BreakInheritanceList string

clang-format 7

The inheritance list style to use.

Values: "BeforeColon" "BeforeComma" "AfterColon" "AfterComma"
BreakStringLiterals boolean

clang-format 3.9

Allow breaking string literals when formatting.

ColumnLimit integer

clang-format 3.7

The column limit.

min=0
CommentPragmas string

clang-format 3.7

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

CompactNamespaces boolean

clang-format 5

If true, consecutive namespace declarations will be on the same line. If false, each namespace is declared on a new line.

ConstructorInitializerAllOnOneLineOrOnePerLine boolean

clang-format 3.7

This option is deprecated. See CurrentLine of PackConstructorInitializers.

ConstructorInitializerIndentWidth integer

clang-format 3.7

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

min=0
ContinuationIndentWidth integer

clang-format 3.7

Indent width for line continuations.

min=0
Cpp11BracedListStyle boolean

clang-format 3.4

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

DeriveLineEnding boolean

clang-format 10

Deprecated. See DeriveLF and DeriveCRLF of LineEnding.

DerivePointerAlignment boolean

clang-format 3.7

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.

DisableFormat boolean

clang-format 3.7

Disables formatting completely.

EmptyLineAfterAccessModifier string

clang-format 13

Defines when to put an empty line after access modifiers. EmptyLineBeforeAccessModifier configuration handles the number of empty lines between two access modifiers.

Values: "Never" "Leave" "Always"
EmptyLineBeforeAccessModifier string

clang-format 12

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

Values: "LogicalBlock" "Never" "Leave" "Always"
ExperimentalAutoDetectBinPacking boolean

clang-format 3.7

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

FixNamespaceComments boolean

clang-format 5

If true, clang-format adds missing namespace end comments for namespaces and fixes invalid existing ones. This doesn't affect short namespaces, which are controlled by ShortNamespaceLines.

ForEachMacros string[]

clang-format 3.7

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

IfMacros string[]

clang-format 13

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

IncludeBlocks string

clang-format 6

Dependent on the value, multiple #include blocks can be sorted as one and divided based on category.

Values: "Regroup" "Preserve" "Merge"
IncludeCategories object[]

clang-format 3.8

Regular expressions denoting the different #include categories used for ordering #includes.

POSIX extended regular expressions are supported.

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 (https://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. There is a third and optional field SortPriority which can used while IncludeBlocks = IBS_Regroup to define the priority in which #includes should be ordered. The value of Priority defines the order of #include blocks and also allows the grouping of #includes of different priority. SortPriority is set to the value of Priority as default if it is not assigned.

Each regular expression can be marked as case sensitive with the field CaseSensitive, per default it is not.

IncludeIsMainRegex string

clang-format 3.9

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: - "" means "arbitrary suffix" - "$" means "no suffix" 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.

IncludeIsMainSourceRegex string

clang-format 10

Specify a regular expression for files being formatted that are allowed to be considered "main" in the file-to-main-include mapping. By default, clang-format considers files as "main" only when they end with: .c, .cc, .cpp, .c++, .cxx, .m or .mm extensions. For these files a guessing of "main" include takes place (to assign category 0, see above). This config option allows for additional suffixes and extensions for files to be considered as "main". By default, clang-format considers files as "main" only when they end with: .c, .cc, .cpp, .c++, .cxx, .m or .mm extensions. For these files a guessing of "main" include takes place (to assign category 0, see above). This config option allows for additional suffixes and extensions for files to be considered as "main".

IndentAccessModifiers boolean

clang-format 13

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.

IndentCaseBlocks boolean

clang-format 11

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.

IndentCaseLabels boolean

clang-format 3.3

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).

IndentExternBlock string

clang-format 11

IndentExternBlockStyle is the type of indenting of extern blocks.

Values: "AfterExternBlock" "NoIndent" "Indent"
IndentGotoLabels boolean

clang-format 10

Indent goto labels. When false, goto labels are flushed left.

IndentPPDirectives string

clang-format 6

The preprocessor directive indenting style to use.

Values: "None" "AfterHash" "BeforeHash"
IndentRequiresClause boolean

clang-format 15

Indent the requires clause in a template. This only applies when RequiresClausePosition is OwnLine, or WithFollowing.

IndentRequires boolean

clang-format 12-14

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.

IndentWidth integer

clang-format 3.7

The number of columns to use for indentation.

min=0
IndentWrappedFunctionNames boolean

clang-format 3.7

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

InsertBraces boolean

clang-format 15

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.

Warning: Setting this option to 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.

InsertNewlineAtEOF boolean

clang-format 16

Insert a newline at end of file if missing.

InsertTrailingCommas string

clang-format 11

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.

Values: "None" "Wrapped"
IntegerLiteralSeparator object

clang-format 16

Format integer literal separators (' for C++ and _ for C#, Java, and JavaScript).

Separator format of integer literals of different bases. If negative, remove separators. If 0, leave the literal as is. If positive, insert separators between digits starting from the rightmost digit.

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

6 nested properties
Binary integer

Format separators in binary literals.

BinaryMinDigits integer

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

Decimal integer

Format separators in decimal literals.

DecimalMinDigits integer

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

Hex integer

Format separators in hexadecimal literals

HexMinDigits integer

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

JavaScriptQuotes string

clang-format 3.9

The JavaScriptQuoteStyle to use for JavaScript strings.

Values: "Leave" "Single" "Double"
JavaScriptWrapImports boolean

clang-format 3.9

Whether to wrap JavaScript import/export statements.

KeepEmptyLinesAtEOF boolean

clang-format 17

This option is deprecated. See AtEndOfFile of KeepEmptyLines.

KeepEmptyLinesAtTheStartOfBlocks boolean

clang-format 3.7

This option is deprecated. See AtStartOfBlock of KeepEmptyLines.

LambdaBodyIndentation string

clang-format 13

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.

Values: "Signature" "OuterScope"
Language string

clang-format 3.5

Language, this format style is targeted at.

Values: "None" "C" "Cpp" "CSharp" "Java" "JavaScript" "Json" "ObjC" "Proto" "TableGen" "TextProto" "Verilog"
LineEnding string

clang-format 16

Line ending style (\n or \r\n) to use.

Values: "LF" "CRLF" "DeriveLF" "DeriveCRLF"
MacroBlockBegin string

clang-format 3.7

A regular expression matching macros that start a block.

Examples: "^NS_MAP_BEGIN|NS_TABLE_HEAD$"
MacroBlockEnd string

clang-format 3.7

A regular expression matching macros that end a block.

Examples: "^NS_MAP_END|NS_TABLE_.*_END$"
Macros string[]

clang-format 17

A list of macros of the form =.

Code will be parsed with macros expanded, in order to determine how to interpret and format the macro arguments.

MaxEmptyLinesToKeep integer

clang-format 3.7

The maximum number of consecutive empty lines to keep.

Default: 1
min=0
NamespaceIndentation string

clang-format 3.7

The indentation used for namespaces.

Values: "None" "Inner" "All"
NamespaceMacros string[]

clang-format 9

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

ObjCBinPackProtocolList string

clang-format 7

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.

Default: "Auto"
Values: "Never" "Auto" "Always"
ObjCBlockIndentWidth integer

clang-format 3.7

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

min=0
ObjCBreakBeforeNestedBlockParam boolean

clang-format 11

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

ObjCPropertyAttributeOrder string[]

clang-format 18

The order in which ObjC property attributes should appear.

Attributes in code will be sorted in the order specified. Any attributes encountered that are not mentioned in this array will be sorted last, in stable order. Comments between attributes will leave the attributes untouched.

ObjCSpaceAfterProperty boolean

clang-format 3.7

Add a space after @property in Objective-C, i.e. use @property (readonly) instead of @property(readonly).

ObjCSpaceBeforeProtocolList boolean

clang-format 3.7

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

PPIndentWidth integer

clang-format 13

The number of columns to use for indentation of preprocessor statements. When set to -1 (default) IndentWidth is used also for preprocessor statements.

Default: -1
PackConstructorInitializers string

clang-format 14

The pack constructor initializers style to use.

Values: "Never" "BinPack" "CurrentLine" "NextLine" "NextLineOnly"
PenaltyBreakAssignment integer

clang-format 5

The penalty for breaking around an assignment operator.

min=0
PenaltyBreakBeforeFirstCallParameter integer

clang-format 3.7

The penalty for breaking a function call after call(.

min=0
PenaltyBreakComment integer

clang-format 3.7

The penalty for each line break introduced inside a comment.

min=0
PenaltyBreakFirstLessLess integer

clang-format 3.7

The penalty for breaking before the first <<.

min=0
PenaltyBreakOpenParenthesis integer

clang-format 14

The penalty for breaking after (.

min=0
PenaltyBreakScopeResolution integer

clang-format 18

The penalty for breaking after ::.

min=0
PenaltyBreakString integer

clang-format 3.7

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

min=0
PenaltyBreakTemplateDeclaration integer

clang-format 7

The penalty for breaking after template declaration.

min=0
PenaltyExcessCharacter integer

clang-format 3.7

The penalty for each character outside of the column limit.

min=0
PenaltyIndentedWhitespace integer

clang-format 12

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

min=0
PenaltyReturnTypeOnItsOwnLine integer

clang-format 3.7

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

min=0
PointerAlignment string

clang-format 3.7

Pointer and reference alignment style.

Values: "Left" "Right" "Middle"
QualifierAlignment string

clang-format 14

Different ways to arrange specifiers and qualifiers (e.g. const/volatile).

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

Values: "Leave" "Left" "Right" "Custom"
QualifierOrder string[]

clang-format 14

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.

RawStringFormats object[]

clang-format 6

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

ReferenceAlignment string

clang-format 13

Reference alignment style (overrides PointerAlignment for references).

Values: "Pointer" "Left" "Right" "Middle"
ReflowComments string

clang-format 3.8

Comment reformatting style.

Values: "Never" "IndentOnly" "Always"
RemoveSemicolon boolean

clang-format 16

Remove semicolons after the closing brace of a non-empty function.

Warning: Setting this option to 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.

RemoveBracesLLVM boolean

clang-format 14

Remove optional braces of control statements (if, else, for, and while) in C++ according to the LLVM coding style.

Warning: This option will be renamed and expanded to support other styles.

Setting this option to 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.

RemoveParentheses string

clang-format 17

Remove redundant parentheses.

Warning: Setting this option to any value other than Leave 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.

Values: "Leave" "MultipleParentheses" "ReturnStatement"
RequiresClausePosition string

clang-format 15

The position of the requires clause.

Values: "OwnLine" "OwnLineWithBrace" "WithPreceding" "WithFollowing" "SingleLine"
RequiresExpressionIndentation string

clang-format 16

The indentation used for requires expression bodies.

Values: "OuterScope" "Keyword"
SeparateDefinitionBlocks string

clang-format 14

Specifies the use of empty lines to separate definition blocks, including classes, structs, enums, and functions.

Values: "Leave" "Always" "Never"
ShortNamespaceLines integer

clang-format 13

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

Default: 1
min=0
SkipMacroDefinitionBody boolean

clang-format 18

Do not format macro definition body.

SortIncludes object

clang-format 3.8

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

2 nested properties
Enabled boolean

If true, includes are sorted based on the other suboptions.

IgnoreCase boolean

Whether or not includes are sorted in a case-insensitive fashion.

SortJavaStaticImport string

clang-format 12

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.

Values: "Before" "After"
SortUsingDeclarations string

clang-format 5

Controls if and how clang-format will sort using declarations.

Values: "Never" "Lexicographic" "LexicographicNumeric"
SpaceAfterCStyleCast boolean

clang-format 3.5

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

SpaceAfterLogicalNot boolean

clang-format 9

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

SpaceAfterTemplateKeyword boolean

clang-format 4

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

SpaceAroundPointerQualifiers string

clang-format 12

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

Values: "Default" "Before" "After" "Both"
SpaceBeforeAssignmentOperators boolean

clang-format 3.7

If false, spaces will be removed before assignment operators.

SpaceBeforeCaseColon boolean

clang-format 12

If false, spaces will be removed before case colon.

SpaceBeforeCpp11BracedList boolean

clang-format 7

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

SpaceBeforeCtorInitializerColon boolean

clang-format 7

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

SpaceBeforeInheritanceColon boolean

clang-format 7

If false, spaces will be removed before inheritance colon.

SpaceBeforeJsonColon boolean

clang-format 17

If true, a space will be added before a JSON colon. For other languages, e.g. JavaScript, use SpacesInContainerLiterals instead.

SpaceBeforeParens string

clang-format 3.5

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

Values: "ControlStatements" "Never" "ControlStatementsExceptControlMacros" "NonEmptyParentheses" "Always" "Custom"
SpaceBeforeParensOptions object

clang-format 14

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.

11 nested properties
AfterControlStatements boolean

If true, put space between control statement keywords (for/if/while…) and opening parentheses.

AfterForeachMacros boolean

If true, put space between foreach macros and opening parentheses.

AfterFunctionDeclarationName boolean

If true, put a space between function declaration name and opening parentheses.

AfterFunctionDefinitionName boolean

If true, put a space between function definition name and opening parentheses.

AfterIfMacros boolean

If true, put space between if macros and opening parentheses.

AfterOverloadedOperator boolean

If true, put a space between operator overloading and opening parentheses.

AfterPlacementOperator boolean

If true, put a space between operator new/delete and opening parenthesis.

AfterRequiresInClause boolean

If true, put space between requires keyword in a requires clause and opening parentheses, if there is one.

AfterRequiresInExpression boolean

If true, put space between requires keyword in a requires expression and opening parentheses.

BeforeNonEmptyParentheses boolean

If true, put a space before opening parentheses only if the parentheses are not empty.

AfterNot boolean

If true, put a space between alternative operator not and the opening parenthesis.

SpaceBeforeRangeBasedForLoopColon boolean

clang-format 7

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

SpaceBeforeSquareBrackets boolean

clang-format 10

If true, spaces will be before [. Lambdas will not be affected. Only the first [ will get a space added.

SpaceInEmptyBlock boolean

clang-format 10

If true, spaces will be inserted into {}.

SpaceInEmptyParentheses boolean

clang-format 3.7

If true, spaces may be inserted into (). This option is deprecated in clang-format 17. See InEmptyParentheses of SpacesInParensOptions.

SpacesBeforeTrailingComments integer

clang-format 3.7

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. In the case of Verilog, it doesn't affect a comment right after the opening parenthesis in the port or parameter list in a module header, because it is probably for the port on the following line instead of the parenthesis it follows.

min=0
SpacesInAngles string

clang-format 3.4

The SpacesInAnglesStyle to use for template argument lists.

Values: "Never" "Always" "Leave"
SpacesInCStyleCastParentheses boolean

clang-format 3.7

If true, spaces may be inserted into C style casts. This option is deprecated in clang-format 17. See InCStyleCasts of SpacesInParensOptions.

SpacesInConditionalStatement boolean

clang-format 10

If true, spaces will be inserted around if/for/switch/while conditions. This option is deprecated in clang-format 17. See InConditionalStatements of SpacesInParensOptions.

SpacesInContainerLiterals boolean

clang-format 3.7

If true, spaces are inserted inside container literals (e.g. ObjC and Javascript array and dict literals). For JSON, use SpaceBeforeJsonColon instead.

SpacesInLineCommentPrefix object

clang-format 13

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.

In clang-format 16, this option has only effect if ReflowComments is set to true.

2 nested properties
Minimum integer
Default: 1
Maximum integer
Default: 1
SpacesInParens string

clang-format 17

Defines in which cases spaces will be inserted after ( and before ).

Values: "Never" "Custom"
SpacesInParensOptions object

clang-format 17

Control of individual spaces in parentheses.

If SpacesInParens is set to Custom, use this to specify how each individual space in parentheses case should be handled. Otherwise, this is ignored.

5 nested properties
InConditionalStatements boolean
InCStyleCasts boolean
InEmptyParentheses boolean
Other boolean
ExceptDoubleParentheses boolean

Override any of the following options to prevent addition of space when both opening and closing parentheses use multiple parentheses.

SpacesInParentheses boolean

clang-format 3.7

If true, spaces will be inserted after ( and before ). This option is deprecated in clang-format 17. The previous behavior is preserved by using SpacesInParens with Custom and by setting all SpacesInParensOptions to true except for InCStyleCasts and InEmptyParentheses.

SpacesInSquareBrackets boolean

clang-format 3.7

If true, spaces will be inserted after [ and before ]. Lambdas without arguments or unspecified size array declarations will not be affected.

Standard string

clang-format 3.7

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

Values: "Auto" "Latest" "c++03" "c++11" "c++14" "c++17" "c++20"
StatementAttributeLikeMacros string[]

clang-format 12

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.

StatementMacros string[]

clnag-format 8

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.

TabWidth integer

clang-format 3.7

The number of columns used for tab stops.

min=0
TypeNames string[]

clang-format 17

A vector of non-keyword identifiers that should be interpreted as type names.

A *, &, or && between a type name and another non-keyword identifier is annotated as a pointer or reference token instead of a binary operator.

TypenameMacros string[]

clang-format 9

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

For example: OpenSSL STACK_OF, BSD LIST_ENTRY.

UseCRLF boolean

clang-format 10

Use instead of for line breaks. Also used as fallback if DeriveLineEnding is true.

This option is deprecated in clang-format 16. See LF and CRLF of LineEnding.

UseTab string

clang-format 3.7

The way to use tab characters in the resulting file.

Values: "Never" "ForIndentation" "ForContinuationAndIndentation" "AlignWithSpaces" "Always"
VerilogBreakBetweenInstancePorts boolean

clang-format 17

For Verilog, put each port on its own line in module instantiations.

WhitespaceSensitiveMacros string[]

clang-format 11

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

For example: BOOST_PP_STRINGIZE

AlignConsecutiveTableGenBreakingDAGArgColons string | object

clang-format 19

Style of aligning consecutive TableGen DAGArg operator colons. If enabled, align the colon inside DAGArg which have line break inside. This works only when TableGenBreakInsideDAGArg is BreakElements or BreakAll and the DAGArg is not excepted by TableGenBreakingDAGArgOperators’s effect.

AlignConsecutiveTableGenCondOperatorColons string | object

clang-format 19

Style of aligning consecutive TableGen cond operator colons. Align the colons of cases inside !cond operators.

AlignConsecutiveTableGenDefinitionColons string | object

clang-format 19

Style of aligning consecutive TableGen definition colons. This aligns the inheritance colons of consecutive definitions.

AllowShortCaseExpressionOnASingleLine boolean

clang-format 19

Whether to merge a short switch labeled rule into a single line.

AllowShortNamespacesOnASingleLine boolean

clang-format 20

If true, namespace a { class b; } can be put on a single line.

BinPackLongBracedList boolean

clang-format 21

If BinPackLongBracedList is true it overrides BinPackArguments if there are 20 or more items in a braced initializer list.

BreakAfterReturnType string

clang-format 19

The function declaration return type breaking style to use.

Values: "Automatic" "ExceptShortType" "None" "All" "TopLevel" "AllDefinitions" "TopLevelDefinitions"
BreakBeforeTemplateCloser boolean

clang-format 21

If true, break before a template closing bracket (>) when there is a line break after the matching opening bracket (<).

BreakBinaryOperations string

clang-format 20

The break binary operations style to use.

Values: "Never" "OnePerLine" "RespectPrecedence"
BreakFunctionDefinitionParameters boolean

clang-format 19

If true, clang-format will always break before function definition parameters.

BreakTemplateDeclarations string

clang-format 19

The template declaration breaking style to use.

Values: "Leave" "No" "MultiLine" "Yes"
EnumTrailingComma string

clang-format 21

Insert a comma (if missing) or remove the comma at the end of an enum enumerator list.

Warning: Setting this option to any value other than Leave 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.

Values: "Leave" "Insert" "Remove"
IndentExportBlock boolean

clang-format 20

If true, clang-format will indent the body of an export { ... } block. This doesn’t affect the formatting of anything else related to exported declarations.

JavaImportGroups string[]

clang-format 8

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

KeepEmptyLines object

clang-format 19

Which empty lines are kept. See MaxEmptyLinesToKeep for how many consecutive empty lines are kept.

3 nested properties
AtEndOfFile boolean

Keep empty lines at end of file.

AtStartOfBlock boolean

Keep empty lines at start of a block.

AtStartOfFile boolean

Keep empty lines at start of file.

KeepFormFeed boolean

clang-format 20

Keep the form feed character if it's immediately preceded and followed by a newline.

MacrosSkippedByRemoveParentheses string[]

clang-format 21

A vector of function-like macros whose invocations should be skipped by RemoveParentheses.

MainIncludeChar string

clang-format 19

When guessing whether a #include is the "main" include, only the include directives that use the specified character are considered.

Values: "Quote" "AngleBracket" "Any"
OneLineFormatOffRegex string

clang-format 21

A regular expression that describes markers for turning formatting off for one line.

Examples: "^(// NOLINT|logger$)"
PenaltyBreakBeforeMemberAccess integer

clang-format 20

The penalty for breaking before a member access operator (., ->).

min=0
RemoveEmptyLinesInUnwrappedLines boolean

clang-format 20

Remove empty lines within unwrapped lines.

SpaceAfterOperatorKeyword boolean

clang-format 21

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

TableGenBreakInsideDAGArg string

clang-format 19

The styles of the line break inside the DAGArg in TableGen.

Values: "DontBreak" "BreakElements" "BreakAll"
TableGenBreakingDAGArgOperators string[]

clang-format 19

Works only when TableGenBreakInsideDAGArg is not DontBreak. If any identifier is specified, this limits the line breaks by TableGenBreakInsideDAGArg option only on DAGArg values beginning with the specified identifiers.

TemplateNames string[]

clang-format 20

A vector of non-keyword identifiers that should be interpreted as template names.

A < after a template name is annotated as a template opener instead of a binary operator.

VariableTemplates string[]

clang-format 20

A vector of non-keyword identifiers that should be interpreted as variable template names.

A ) after a variable template instantiation is not annotated as the closing parenthesis of C-style cast operator.

WrapNamespaceBodyWithEmptyLines string

clang-format 20

Wrap namespace body with empty lines.

Values: "Never" "Always" "Leave"