# 2613 Clang Format Style Options 57ebf225

> [Clang 22.0.0git documentation](https://clang.llvm.org/docs/index.html)

- Skill: `tools-only/2613-clang-format-style-options-57ebf225` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/2613-clang-format-style-options-57ebf225`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/2613-clang-format-style-options-57ebf225/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/tools-only/2613-clang-format-style-options-57ebf225

---

# [Clang 22.0.0git documentation](https://clang.llvm.org/docs/index.html)

## Clang-Format Style Options

« [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html) :: [Contents](https://clang.llvm.org/docs/index.html) :: [Clang Linker Wrapper](https://clang.llvm.org/docs/ClangLinkerWrapper.html) »

# Clang-Format Style Options [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#clang-format-style-options "Link to this heading")

[Clang-Format Style Options](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#) describes configurable formatting style options supported by [LibFormat](https://clang.llvm.org/docs/LibFormat.html) and [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html).

When using **clang-format** command line utility or `clang::format::reformat(...)` functions from code, one can either use one of the predefined styles (LLVM, Google, Chromium, Mozilla, WebKit, Microsoft) or create a custom style by configuring specific style options.

## Configuring Style with clang-format [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configuring-style-with-clang-format "Link to this heading")

**clang-format** supports two ways to provide custom style options: directly specify style configuration in the `-style=` command line option or use `-style=file` and put style configuration in the `.clang-format` or `_clang-format` file in the project directory.

When using `-style=file`, **clang-format** for each input file will try to find the `.clang-format` file located in the closest parent directory of the input file. When the standard input is used, the search is started from the current directory.

When using `-style=file:<format_file_path>`, **clang-format** for each input file will use the format file located at <format_file_path>. The path may be absolute or relative to the working directory.

The `.clang-format` file uses YAML format:

```yaml
key1: value1
key2: value2
# A comment.
```

The configuration file can consist of several sections each having different `Language:` parameter denoting the programming language this section of the configuration is targeted at. See the description of the **Language** option below for the list of supported languages. The first section may have no language set, it will set the default style options for all languages. Configuration sections for specific language will override options set in the default section.

When **clang-format** formats a file, it auto-detects the language using the file name. When formatting standard input or a file that doesn’t have the extension corresponding to its language, `-assume-filename=` option can be used to override the file name **clang-format** uses to detect the language.

An example of a configuration file for multiple languages:

```yaml
---
# We'll use defaults from the LLVM style, but with 4 columns indentation.
BasedOnStyle: LLVM
IndentWidth: 4
---
Language: Cpp
# Force pointers to the type for C++.
DerivePointerAlignment: false
PointerAlignment: Left
---
Language: JavaScript
# Use 100 columns for JS.
ColumnLimit: 100
---
Language: Proto
# Don't format .proto files.
DisableFormat: true
---
Language: CSharp
# Use 100 columns for C#.
ColumnLimit: 100
```

An easy way to get a valid `.clang-format` file containing all configuration options of a certain predefined style is:

```bash
clang-format -style=llvm -dump-config > .clang-format

```

When specifying configuration in the `-style=` option, the same configuration is applied for all input files. The format of the configuration is:

```bash
-style='{key1: value1, key2: value2, ...}'

```

## Disabling Formatting on a Piece of Code [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code "Link to this heading")

Clang-format understands also special comments that switch formatting in a delimited range. The code between a comment `// clang-format off` or `/* clang-format off */` up to a comment `// clang-format on` or `/* clang-format on */` will not be formatted. The comments themselves will be formatted (aligned) normally. Also, a colon ( `:`) and additional text may follow `// clang-format off` or `// clang-format on` to explain why clang-format is turned off or back on.

```cpp
int formatted_code;
// clang-format off
    void    unformatted_code  ;
// clang-format on
void formatted_code_again;

```

In addition, the `OneLineFormatOffRegex` option gives you a concise way to disable formatting for all of the lines that match the regular expression.

## Configuring Style in Code [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configuring-style-in-code "Link to this heading")

When using `clang::format::reformat(...)` functions, the format is specified by supplying the [clang::format::FormatStyle](https://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html) structure.

## Configurable Format Style Options [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options "Link to this heading")

This section lists the supported style options. Value type is specified for each option. For enumeration types possible values are specified both as a C++ enumeration member (with a prefix, e.g. `LS_Auto`), and as a value usable in the configuration (without a prefix: `Auto`).

**BasedOnStyle** ( `String`) [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#basedonstyle)

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

This option is supported only in the **clang-format** configuration (both within `-style='{...}'` and the `.clang-format` file).

Possible values:

- `LLVM` A style complying with the [LLVM coding standards](https://llvm.org/docs/CodingStandards.html)

- `Google` A style complying with [Google’s C++ style guide](https://google.github.io/styleguide/cppguide.html)

- `Chromium` A style complying with [Chromium’s style guide](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md)

- `Mozilla` A style complying with [Mozilla’s style guide](https://firefox-source-docs.mozilla.org/code-quality/coding-style/index.html)

- `WebKit` A style complying with [WebKit’s style guide](https://www.webkit.org/coding/coding-style.html)

- `Microsoft` A style complying with [Microsoft’s style guide](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference)

- `GNU` A style complying with the [GNU coding standards](https://www.gnu.org/prep/standards/standards.html)

- `InheritParentConfig` Not a real style, but allows to use the `.clang-format` file from the parent directory (or its parent if there is none). If there is no parent file found it falls back to the `fallback` style, and applies the changes to that.

With this option you can overwrite some parts of your main style for your subdirectories. This is also possible through the command line, e.g.: `--style={BasedOnStyle: InheritParentConfig, ColumnLimit: 20}`

**AccessModifierOffset** ( `Integer`) clang-format 3.3 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#accessmodifieroffset)

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

**AlignAfterOpenBracket** ( `BracketAlignmentStyle`) clang-format 3.8 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignafteropenbracket)

If `true`, horizontally aligns arguments after an open bracket.

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

Possible values:

- `BAS_Align` (in configuration: `Align`) Align parameters on the open bracket, e.g.:

```cpp
someLongFunction(argument1,
                   argument2);

```

- `BAS_DontAlign` (in configuration: `DontAlign`) Don’t align, instead use `ContinuationIndentWidth`, e.g.:

```cpp
someLongFunction(argument1,
      argument2);

```

- `BAS_AlwaysBreak` (in configuration: `AlwaysBreak`) Always break after an open bracket, if the parameters don’t fit on a single line, e.g.:

```cpp
someLongFunction(
      argument1, argument2);

```

- `BAS_BlockIndent` (in configuration: `BlockIndent`) Always break after an open bracket, if the parameters don’t fit on a single line. Closing brackets will be placed on a new line. E.g.:

```cpp
someLongFunction(
      argument1, argument2
)

```

Note

This currently only applies to braced initializer lists (when `Cpp11BracedListStyle` is not `Block`) and parentheses.

**AlignArrayOfStructures** ( `ArrayInitializerAlignmentStyle`) clang-format 13 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#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.

Possible values:

- `AIAS_Left` (in configuration: `Left`) Align array column and left justify the columns e.g.:

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

```

- `AIAS_Right` (in configuration: `Right`) Align array column and right justify the columns e.g.:

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

```

- `AIAS_None` (in configuration: `None`) Don’t align array initializer columns.

**AlignConsecutiveAssignments** ( `AlignConsecutiveStyle`) clang-format 3.8 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignconsecutiveassignments)

Style of aligning consecutive assignments.

`Consecutive` will result in formattings like:

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

```

Nested configuration flags:

Alignment options.

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

- `None`

- `Consecutive`

- `AcrossEmptyLines`

- `AcrossComments`

- `AcrossEmptyLinesAndComments`

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

```yaml
AlignConsecutiveAssignments: AcrossEmptyLines

AlignConsecutiveAssignments:
  Enabled: true
  AcrossEmptyLines: true
  AcrossComments: false

```

- `bool Enabled` Whether aligning is enabled.

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

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

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

int         aaaa = 12;
float       b = 23;
std::string ccc;

```

- `bool AcrossEmptyLines` Whether to align across empty lines.

```yaml
true:
int a            = 1;
int somelongname = 2;
double c         = 3;

int d            = 3;

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

int d = 3;

```

- `bool AcrossComments` Whether to align across comments.

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

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

```

- `bool AlignCompound` Only for `AlignConsecutiveAssignments`. Whether compound assignments like `+=` are aligned along with `=`.

```yaml
true:
a   &= 2;
bbb  = 2;

false:
a &= 2;
bbb = 2;

```

- `bool AlignFunctionDeclarations` Only for `AlignConsecutiveDeclarations`. Whether function declarations are aligned.

```yaml
true:
unsigned int f1(void);
void         f2(void);
size_t       f3(void);

false:
unsigned int f1(void);
void f2(void);
size_t f3(void);

```

- `bool AlignFunctionPointers` Only for `AlignConsecutiveDeclarations`. Whether function pointers are aligned.

```yaml
true:
unsigned i;
int     &r;
int     *p;
int      (*f)();

false:
unsigned i;
int     &r;
int     *p;
int (*f)();

```

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

```yaml
true:
a   >>= 2;
bbb   = 2;

a     = 2;
bbb >>= 2;

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

a     = 2;
bbb >>= 2;

```

**AlignConsecutiveBitFields** ( `AlignConsecutiveStyle`) clang-format 11 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignconsecutivebitfields)

Style of aligning consecutive bit fields.

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

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

```

Nested configuration flags:

Alignment options.

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

- `None`

- `Consecutive`

- `AcrossEmptyLines`

- `AcrossComments`

- `AcrossEmptyLinesAndComments`

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

```yaml
AlignConsecutiveBitFields: AcrossEmptyLines

AlignConsecutiveBitFields:
  Enabled: true
  AcrossEmptyLines: true
  AcrossComments: false

```

- `bool Enabled` Whether aligning is enabled.

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

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

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

int         aaaa = 12;
float       b = 23;
std::string ccc;

```

- `bool AcrossEmptyLines` Whether to align across empty lines.

```yaml
true:
int a            = 1;
int somelongname = 2;
double c         = 3;

int d            = 3;

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

int d = 3;

```

- `bool AcrossComments` Whether to align across comments.

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

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

```

- `bool AlignCompound` Only for `AlignConsecutiveAssignments`. Whether compound assignments like `+=` are aligned along with `=`.

```yaml
true:
a   &= 2;
bbb  = 2;

false:
a &= 2;
bbb = 2;

```

- `bool AlignFunctionDeclarations` Only for `AlignConsecutiveDeclarations`. Whether function declarations are aligned.

```yaml
true:
unsigned int f1(void);
void         f2(void);
size_t       f3(void);

false:
unsigned int f1(void);
void f2(void);
size_t f3(void);

```

- `bool AlignFunctionPointers` Only for `AlignConsecutiveDeclarations`. Whether function pointers are aligned.

```yaml
true:
unsigned i;
int     &r;
int     *p;
int      (*f)();

false:
unsigned i;
int     &r;
int     *p;
int (*f)();

```

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

```yaml
true:
a   >>= 2;
bbb   = 2;

a     = 2;
bbb >>= 2;

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

a     = 2;
bbb >>= 2;

```

**AlignConsecutiveDeclarations** ( `AlignConsecutiveStyle`) clang-format 3.8 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignconsecutivedeclarations)

Style of aligning consecutive declarations.

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

```cpp
int         aaaa = 12;
float       b = 23;
std::string ccc;

```

Nested configuration flags:

Alignment options.

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

- `None`

- `Consecutive`

- `AcrossEmptyLines`

- `AcrossComments`

- `AcrossEmptyLinesAndComments`

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

```yaml
AlignConsecutiveDeclarations: AcrossEmptyLines

AlignConsecutiveDeclarations:
  Enabled: true
  AcrossEmptyLines: true
  AcrossComments: false

```

- `bool Enabled` Whether aligning is enabled.

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

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

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

int         aaaa = 12;
float       b = 23;
std::string ccc;

```

- `bool AcrossEmptyLines` Whether to align across empty lines.

```yaml
true:
int a            = 1;
int somelongname = 2;
double c         = 3;

int d            = 3;

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

int d = 3;

```

- `bool AcrossComments` Whether to align across comments.

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

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

```

- `bool AlignCompound` Only for `AlignConsecutiveAssignments`. Whether compound assignments like `+=` are aligned along with `=`.

```yaml
true:
a   &= 2;
bbb  = 2;

false:
a &= 2;
bbb = 2;

```

- `bool AlignFunctionDeclarations` Only for `AlignConsecutiveDeclarations`. Whether function declarations are aligned.

```yaml
true:
unsigned int f1(void);
void         f2(void);
size_t       f3(void);

false:
unsigned int f1(void);
void f2(void);
size_t f3(void);

```

- `bool AlignFunctionPointers` Only for `AlignConsecutiveDeclarations`. Whether function pointers are aligned.

```yaml
true:
unsigned i;
int     &r;
int     *p;
int      (*f)();

false:
unsigned i;
int     &r;
int     *p;
int (*f)();

```

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

```yaml
true:
a   >>= 2;
bbb   = 2;

a     = 2;
bbb >>= 2;

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

a     = 2;
bbb >>= 2;

```

**AlignConsecutiveMacros** ( `AlignConsecutiveStyle`) clang-format 9 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignconsecutivemacros)

Style of aligning consecutive macro definitions.

`Consecutive` will result in formattings like:

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

```

Nested configuration flags:

Alignment options.

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

- `None`

- `Consecutive`

- `AcrossEmptyLines`

- `AcrossComments`

- `AcrossEmptyLinesAndComments`

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

```yaml
AlignConsecutiveMacros: AcrossEmptyLines

AlignConsecutiveMacros:
  Enabled: true
  AcrossEmptyLines: true
  AcrossComments: false

```

- `bool Enabled` Whether aligning is enabled.

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

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

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

int         aaaa = 12;
float       b = 23;
std::string ccc;

```

- `bool AcrossEmptyLines` Whether to align across empty lines.

```yaml
true:
int a            = 1;
int somelongname = 2;
double c         = 3;

int d            = 3;

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

int d = 3;

```

- `bool AcrossComments` Whether to align across comments.

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

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

```

- `bool AlignCompound` Only for `AlignConsecutiveAssignments`. Whether compound assignments like `+=` are aligned along with `=`.

```yaml
true:
a   &= 2;
bbb  = 2;

false:
a &= 2;
bbb = 2;

```

- `bool AlignFunctionDeclarations` Only for `AlignConsecutiveDeclarations`. Whether function declarations are aligned.

```yaml
true:
unsigned int f1(void);
void         f2(void);
size_t       f3(void);

false:
unsigned int f1(void);
void f2(void);
size_t f3(void);

```

- `bool AlignFunctionPointers` Only for `AlignConsecutiveDeclarations`. Whether function pointers are aligned.

```yaml
true:
unsigned i;
int     &r;
int     *p;
int      (*f)();

false:
unsigned i;
int     &r;
int     *p;
int (*f)();

```

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

```yaml
true:
a   >>= 2;
bbb   = 2;

a     = 2;
bbb >>= 2;

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

a     = 2;
bbb >>= 2;

```

**AlignConsecutiveShortCaseStatements** ( `ShortCaseStatementsAlignmentStyle`) clang-format 17 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignconsecutiveshortcasestatements)

Style of aligning consecutive short case labels. Only applies if `AllowShortCaseExpressionOnASingleLine` or `AllowShortCaseLabelsOnASingleLine` is `true`.

```yaml
# Example of usage:
AlignConsecutiveShortCaseStatements:
  Enabled: true
  AcrossEmptyLines: true
  AcrossComments: true
  AlignCaseColons: false
```

Nested configuration flags:

Alignment options.

- `bool Enabled` Whether aligning is enabled.

```yaml
true:
switch (level) {
case log::info:    return "info:";
case log::warning: return "warning:";
default:           return "";
}

false:
switch (level) {
case log::info: return "info:";
case log::warning: return "warning:";
default: return "";
}

```

- `bool AcrossEmptyLines` Whether to align across empty lines.

```yaml
true:
switch (level) {
case log::info:    return "info:";
case log::warning: return "warning:";

default:           return "";
}

false:
switch (level) {
case log::info:    return "info:";
case log::warning: return "warning:";

default: return "";
}

```

- `bool AcrossComments` Whether to align across comments.

```yaml
true:
switch (level) {
case log::info:    return "info:";
case log::warning: return "warning:";
/* A comment. */
default:           return "";
}

false:
switch (level) {
case log::info:    return "info:";
case log::warning: return "warning:";
/* A comment. */
default: return "";
}

```

- `bool AlignCaseArrows` Whether to align the case arrows when aligning short case expressions.

```yaml
true:
i = switch (day) {
    case THURSDAY, SATURDAY -> 8;
    case WEDNESDAY          -> 9;
    default                 -> 0;
};

false:
i = switch (day) {
    case THURSDAY, SATURDAY -> 8;
    case WEDNESDAY ->          9;
    default ->                 0;
};

```

- `bool AlignCaseColons` Whether aligned case labels are aligned on the colon, or on the tokens after the colon.

```yaml
true:
switch (level) {
case log::info   : return "info:";
case log::warning: return "warning:";
default          : return "";
}

false:
switch (level) {
case log::info:    return "info:";
case log::warning: return "warning:";
default:           return "";
}

```

**AlignConsecutiveTableGenBreakingDAGArgColons** ( `AlignConsecutiveStyle`) clang-format 19 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignconsecutivetablegenbreakingdagargcolons)

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.

```cpp
let dagarg = (ins
    a  :$src1,
    aa :$src2,
    aaa:$src3
)

```

Nested configuration flags:

Alignment options.

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

- `None`

- `Consecutive`

- `AcrossEmptyLines`

- `AcrossComments`

- `AcrossEmptyLinesAndComments`

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

```yaml
AlignConsecutiveTableGenBreakingDAGArgColons: AcrossEmptyLines

AlignConsecutiveTableGenBreakingDAGArgColons:
  Enabled: true
  AcrossEmptyLines: true
  AcrossComments: false

```

- `bool Enabled` Whether aligning is enabled.

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

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

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

int         aaaa = 12;
float       b = 23;
std::string ccc;

```

- `bool AcrossEmptyLines` Whether to align across empty lines.

```yaml
true:
int a            = 1;
int somelongname = 2;
double c         = 3;

int d            = 3;

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

int d = 3;

```

- `bool AcrossComments` Whether to align across comments.

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

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

```

- `bool AlignCompound` Only for `AlignConsecutiveAssignments`. Whether compound assignments like `+=` are aligned along with `=`.

```yaml
true:
a   &= 2;
bbb  = 2;

false:
a &= 2;
bbb = 2;

```

- `bool AlignFunctionDeclarations` Only for `AlignConsecutiveDeclarations`. Whether function declarations are aligned.

```yaml
true:
unsigned int f1(void);
void         f2(void);
size_t       f3(void);

false:
unsigned int f1(void);
void f2(void);
size_t f3(void);

```

- `bool AlignFunctionPointers` Only for `AlignConsecutiveDeclarations`. Whether function pointers are aligned.

```yaml
true:
unsigned i;
int     &r;
int     *p;
int      (*f)();

false:
unsigned i;
int     &r;
int     *p;
int (*f)();

```

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

```yaml
true:
a   >>= 2;
bbb   = 2;

a     = 2;
bbb >>= 2;

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

a     = 2;
bbb >>= 2;

```

**AlignConsecutiveTableGenCondOperatorColons** ( `AlignConsecutiveStyle`) clang-format 19 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignconsecutivetablegencondoperatorcolons)

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

```cpp
!cond(!eq(size, 1) : 1,
      !eq(size, 16): 1,
      true         : 0)

```

Nested configuration flags:

Alignment options.

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

- `None`

- `Consecutive`

- `AcrossEmptyLines`

- `AcrossComments`

- `AcrossEmptyLinesAndComments`

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

```yaml
AlignConsecutiveTableGenCondOperatorColons: AcrossEmptyLines

AlignConsecutiveTableGenCondOperatorColons:
  Enabled: true
  AcrossEmptyLines: true
  AcrossComments: false

```

- `bool Enabled` Whether aligning is enabled.

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

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

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

int         aaaa = 12;
float       b = 23;
std::string ccc;

```

- `bool AcrossEmptyLines` Whether to align across empty lines.

```yaml
true:
int a            = 1;
int somelongname = 2;
double c         = 3;

int d            = 3;

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

int d = 3;

```

- `bool AcrossComments` Whether to align across comments.

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

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

```

- `bool AlignCompound` Only for `AlignConsecutiveAssignments`. Whether compound assignments like `+=` are aligned along with `=`.

```yaml
true:
a   &= 2;
bbb  = 2;

false:
a &= 2;
bbb = 2;

```

- `bool AlignFunctionDeclarations` Only for `AlignConsecutiveDeclarations`. Whether function declarations are aligned.

```yaml
true:
unsigned int f1(void);
void         f2(void);
size_t       f3(void);

false:
unsigned int f1(void);
void f2(void);
size_t f3(void);

```

- `bool AlignFunctionPointers` Only for `AlignConsecutiveDeclarations`. Whether function pointers are aligned.

```yaml
true:
unsigned i;
int     &r;
int     *p;
int      (*f)();

false:
unsigned i;
int     &r;
int     *p;
int (*f)();

```

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

```yaml
true:
a   >>= 2;
bbb   = 2;

a     = 2;
bbb >>= 2;

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

a     = 2;
bbb >>= 2;

```

**AlignConsecutiveTableGenDefinitionColons** ( `AlignConsecutiveStyle`) clang-format 19 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignconsecutivetablegendefinitioncolons)

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

```cpp
def Def       : Parent {}
def DefDef    : Parent {}
def DefDefDef : Parent {}

```

Nested configuration flags:

Alignment options.

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

- `None`

- `Consecutive`

- `AcrossEmptyLines`

- `AcrossComments`

- `AcrossEmptyLinesAndComments`

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

```yaml
AlignConsecutiveTableGenDefinitionColons: AcrossEmptyLines

AlignConsecutiveTableGenDefinitionColons:
  Enabled: true
  AcrossEmptyLines: true
  AcrossComments: false

```

- `bool Enabled` Whether aligning is enabled.

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

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

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

int         aaaa = 12;
float       b = 23;
std::string ccc;

```

- `bool AcrossEmptyLines` Whether to align across empty lines.

```yaml
true:
int a            = 1;
int somelongname = 2;
double c         = 3;

int d            = 3;

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

int d = 3;

```

- `bool AcrossComments` Whether to align across comments.

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

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

```

- `bool AlignCompound` Only for `AlignConsecutiveAssignments`. Whether compound assignments like `+=` are aligned along with `=`.

```yaml
true:
a   &= 2;
bbb  = 2;

false:
a &= 2;
bbb = 2;

```

- `bool AlignFunctionDeclarations` Only for `AlignConsecutiveDeclarations`. Whether function declarations are aligned.

```yaml
true:
unsigned int f1(void);
void         f2(void);
size_t       f3(void);

false:
unsigned int f1(void);
void f2(void);
size_t f3(void);

```

- `bool AlignFunctionPointers` Only for `AlignConsecutiveDeclarations`. Whether function pointers are aligned.

```yaml
true:
unsigned i;
int     &r;
int     *p;
int      (*f)();

false:
unsigned i;
int     &r;
int     *p;
int (*f)();

```

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

```yaml
true:
a   >>= 2;
bbb   = 2;

a     = 2;
bbb >>= 2;

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

a     = 2;
bbb >>= 2;

```

**AlignEscapedNewlines** ( `EscapedNewlineAlignmentStyle`) clang-format 5 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignescapednewlines)

Options for aligning backslashes in escaped newlines.

Possible values:

- `ENAS_DontAlign` (in configuration: `DontAlign`) Don’t align escaped newlines.

```cpp
#define A
    int aaaa;
    int b;
    int dddddddddd;

```

- `ENAS_Left` (in configuration: `Left`) Align escaped newlines as far left as possible.

```cpp
#define A
    int aaaa;
    int b;
    int dddddddddd;

```

- `ENAS_LeftWithLastLine` (in configuration: `LeftWithLastLine`) Align escaped newlines as far left as possible, using the last line of the preprocessor directive as the reference if it’s the longest.

```cpp
#define A
    int aaaa;
    int b;
    int dddddddddd;

```

- `ENAS_Right` (in configuration: `Right`) Align escaped newlines in the right-most column.

```cpp
#define A
    int aaaa;
    int b;
    int dddddddddd;

```

**AlignOperands** ( `OperandAlignmentStyle`) clang-format 3.5 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignoperands)

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

Possible values:

- `OAS_DontAlign` (in configuration: `DontAlign`) Do not align operands of binary and ternary expressions. The wrapped lines are indented `ContinuationIndentWidth` spaces from the start of the line.

- `OAS_Align` (in configuration: `Align`) Horizontally align operands of binary and ternary expressions.

Specifically, this aligns operands of a single expression that needs to be split over multiple lines, e.g.:

```cpp
int aaa = bbbbbbbbbbbbbbb +
            ccccccccccccccc;

```

When `BreakBeforeBinaryOperators` is set, the wrapped operator is aligned with the operand on the first line.

```cpp
int aaa = bbbbbbbbbbbbbbb
            + ccccccccccccccc;

```

- `OAS_AlignAfterOperator` (in configuration: `AlignAfterOperator`) Horizontally align operands of binary and ternary expressions.

This is similar to `OAS_Align`, except when `BreakBeforeBinaryOperators` is set, the operator is un-indented so that the wrapped operand is aligned with the operand on the first line.

```cpp
int aaa = bbbbbbbbbbbbbbb
          + ccccccccccccccc;

```

**AlignTrailingComments** ( `TrailingCommentsAlignmentStyle`) clang-format 3.7 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#aligntrailingcomments)

Control of trailing comments.

The alignment stops at closing braces after a line break, and only followed by other closing braces, a ( `do-`) `while`, a lambda call, or a semicolon.

Note

As of clang-format 16 this option is not a bool but can be set to the options. Conventional bool options still can be parsed as before.

```cpp
# Example of usage:
AlignTrailingComments:
  Kind: Always
  OverEmptyLines: 2

```

Nested configuration flags:

Alignment options

- `TrailingCommentsAlignmentKinds Kind` Specifies the way to align trailing comments.

Possible values:

- `TCAS_Leave` (in configuration: `Leave`) Leave trailing comments as they are.

````cpp
    int a;    // comment
    int ab;       // comment

    int abc;  // comment
    int abcd;     // comment

    ```

- `TCAS_Always` (in configuration: `Always`)
    Align trailing comments.

```cpp
    int a;  // comment
    int ab; // comment

    int abc;  // comment
    int abcd; // comment

    ```

- `TCAS_Never` (in configuration: `Never`)
    Don’t align trailing comments but other formatter applies.

```cpp
    int a; // comment
    int ab; // comment

    int abc; // comment
    int abcd; // comment

    ```
- `unsigned OverEmptyLines` How many empty lines to apply alignment.
When both `MaxEmptyLinesToKeep` and `OverEmptyLines` are set to 2,
it formats like below.

```cpp
int a;      // all these

int ab;     // comments are


int abcdef; // aligned

````

When `MaxEmptyLinesToKeep` is set to 2 and `OverEmptyLines` is set to 1, it formats like below.

```cpp
int a;  // these are

int ab; // aligned


int abcdef; // but this isn't

```

**AllowAllArgumentsOnNextLine** ( `Boolean`) clang-format 9 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#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`.

```yaml
true:
callFunction(
    a, b, c, d);

false:
callFunction(a,
             b,
             c,
             d);

```

**AllowAllConstructorInitializersOnNextLine** ( `Boolean`) clang-format 9 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowallconstructorinitializersonnextline)

This option is **deprecated**. See `NextLine` of `PackConstructorInitializers`.

**AllowAllParametersOfDeclarationOnNextLine** ( `Boolean`) clang-format 3.3 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#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 `OnePerLine`.

```yaml
true:
void myFunction(
    int a, int b, int c, int d, int e);

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

```

**AllowBreakBeforeNoexceptSpecifier** ( `BreakBeforeNoexceptSpecifierStyle`) clang-format 18 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowbreakbeforenoexceptspecifier)

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

Possible values:

- `BBNSS_Never` (in configuration: `Never`) No line break allowed.

```cpp
void foo(int arg1,
           double arg2) noexcept;

void bar(int arg1, double arg2) noexcept(
      noexcept(baz(arg1)) &&
      noexcept(baz(arg2)));

```

- `BBNSS_OnlyWithParen` (in configuration: `OnlyWithParen`) For a simple `noexcept` there is no line break allowed, but when we have a condition it is.

```cpp
void foo(int arg1,
           double arg2) noexcept;

void bar(int arg1, double arg2)
      noexcept(noexcept(baz(arg1)) &&
               noexcept(baz(arg2)));

```

- `BBNSS_Always` (in configuration: `Always`) Line breaks are allowed. But note that because of the associated penalties `clang-format` often prefers not to break before the `noexcept`.

```cpp
void foo(int arg1,
           double arg2) noexcept;

void bar(int arg1, double arg2)
      noexcept(noexcept(baz(arg1)) &&
               noexcept(baz(arg2)));

```

**AllowBreakBeforeQtProperty** ( `Boolean`) clang-format 22 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowbreakbeforeqtproperty)

Allow breaking before `Q_Property` keywords `READ`, `WRITE`, etc. as if they were preceded by a comma ( `,`). This allows them to be formatted according to `BinPackParameters`.

**AllowShortBlocksOnASingleLine** ( `ShortBlockStyle`) clang-format 3.5 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowshortblocksonasingleline)

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

Possible values:

- `SBS_Never` (in configuration: `Never`) Never merge blocks into a single line.

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

```

- `SBS_Empty` (in configuration: `Empty`) Only merge empty blocks.

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

```

- `SBS_Always` (in configuration: `Always`) Always merge short blocks into a single line.

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

```

**AllowShortCaseExpressionOnASingleLine** ( `Boolean`) clang-format 19 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowshortcaseexpressiononasingleline)

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

```yaml
true:                               false:
switch (a) {           vs.          switch (a) {
case 1 -> 1;                        case 1 ->
default -> 0;                         1;
};                                  default ->
                                      0;
                                    };

```

**AllowShortCaseLabelsOnASingleLine** ( `Boolean`) clang-format 3.6 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowshortcaselabelsonasingleline)

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

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

```

**AllowShortCompoundRequirementOnASingleLine** ( `Boolean`) clang-format 18 [¶](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#allowshortcompoundrequirementonasingleline)

Allow short compound requirement on a single line.

```yaml
true:
template <typename T>
concept c = requires(T x) {
  { x + 1 } -> std::same_as<int>;
};

false:
template <typename T>
concept c = requires(T x)

…(truncated)
