<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/clang/unittests/Format/FormatTest.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[clang-format] Align trailing comments for function parameters (#164458)</title>
<updated>2025-11-13T23:30:28+00:00</updated>
<author>
<name>sstwcw</name>
<email>su3e8a96kzlver@posteo.net</email>
</author>
<published>2025-11-13T23:30:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3a2de951a40877e3d17aa87abb35565da1040612'/>
<id>3a2de951a40877e3d17aa87abb35565da1040612</id>
<content type='text'>
before

```C++
void foo(int   name, // name
         float name, // name
         int   name)   // name
{}
```

after

```C++
void foo(int   name, // name
         float name, // name
         int   name) // name
{}
```

Fixes #85123.

As the bug report explained, the procedure for aligning the function
parameters previously failed to update `StartOfTokenColumn`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
before

```C++
void foo(int   name, // name
         float name, // name
         int   name)   // name
{}
```

after

```C++
void foo(int   name, // name
         float name, // name
         int   name) // name
{}
```

Fixes #85123.

As the bug report explained, the procedure for aligning the function
parameters previously failed to update `StartOfTokenColumn`.
</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Fix a crash in AlignArrayOfStructures (#167099)</title>
<updated>2025-11-10T01:35:54+00:00</updated>
<author>
<name>owenca</name>
<email>owenpiano@gmail.com</email>
</author>
<published>2025-11-10T01:35:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=836919bb34493333767fc1734e402d3ebf989acb'/>
<id>836919bb34493333767fc1734e402d3ebf989acb</id>
<content type='text'>
Fixes #157405</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #157405</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Fix ColumnLimit violation while aligning (#165627)</title>
<updated>2025-11-03T19:19:34+00:00</updated>
<author>
<name>Björn Schäpers</name>
<email>bjoern@hazardy.de</email>
</author>
<published>2025-11-03T19:19:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ca69a8d2f403de3617970dcfa2f84756f7f336dd'/>
<id>ca69a8d2f403de3617970dcfa2f84756f7f336dd</id>
<content type='text'>
It did compute the length only on the first line, and thus the following
lines could be (and in the test example were) moved over the column
limit, when the = was aligned.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It did compute the length only on the first line, and thus the following
lines could be (and in the test example were) moved over the column
limit, when the = was aligned.</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Add BreakAfterOpenBracket* and BreakBeforeCloseBracket* (#108332)</title>
<updated>2025-10-30T19:24:44+00:00</updated>
<author>
<name>Gedare Bloom</name>
<email>gedare@rtems.org</email>
</author>
<published>2025-10-30T19:24:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8067b5cff73ea96189b5bbca1110cfe4dce03552'/>
<id>8067b5cff73ea96189b5bbca1110cfe4dce03552</id>
<content type='text'>
Replace the `AlwaysBreak` and `BlockIndent` suboptions of
`AlignAfterOpenBracket` with new style options `BreakAfterOpenBracket*`
and `BreakBeforeCloseBracket*` for `*` in `BracedList` for braced list
initializers, `if` for if conditional statements, `Loop` for loop
control statements (for/while), `Switch` for switch statements, and
`Function` for function calls/declarations/definitions.

Deprecates `AlwaysBreak` and `BlockIndent`.
 
Fixes #67738 
Fixes #79176 
Fixes #80123 
Fixes #151844
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace the `AlwaysBreak` and `BlockIndent` suboptions of
`AlignAfterOpenBracket` with new style options `BreakAfterOpenBracket*`
and `BreakBeforeCloseBracket*` for `*` in `BracedList` for braced list
initializers, `if` for if conditional statements, `Loop` for loop
control statements (for/while), `Switch` for switch statements, and
`Function` for function calls/declarations/definitions.

Deprecates `AlwaysBreak` and `BlockIndent`.
 
Fixes #67738 
Fixes #79176 
Fixes #80123 
Fixes #151844
</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Align comments following continued aligned lines (#164687)</title>
<updated>2025-10-27T18:41:09+00:00</updated>
<author>
<name>sstwcw</name>
<email>su3e8a96kzlver@posteo.net</email>
</author>
<published>2025-10-27T18:41:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f8a0599d761e4283b3877f0bf4043e01722dc448'/>
<id>f8a0599d761e4283b3877f0bf4043e01722dc448</id>
<content type='text'>
new

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};  //
auto b                     = [] { //
  return;                         //
};

auto aaaaaaaaaaaaaaaaaaaaa = {};  //
auto b                     = [] { //
  return aaaaaaaaaaaaaaaaaaaaa;   //
};
```

old

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};  //
auto b                     = [] { //
  return;     //
};

auto aaaaaaaaaaaaaaaaaaaaa = {};                    //
auto b                     = [] {                   //
  return aaaaaaaaaaaaaaaaaaaaa; //
};
```

Aligning a line to another line involves keeping track of the tokens'
positions. Previously the shift was incorrectly added to some tokens
that did not move. Then the comments would end up in the wrong places.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
new

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};  //
auto b                     = [] { //
  return;                         //
};

auto aaaaaaaaaaaaaaaaaaaaa = {};  //
auto b                     = [] { //
  return aaaaaaaaaaaaaaaaaaaaa;   //
};
```

old

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};  //
auto b                     = [] { //
  return;     //
};

auto aaaaaaaaaaaaaaaaaaaaa = {};                    //
auto b                     = [] {                   //
  return aaaaaaaaaaaaaaaaaaaaa; //
};
```

Aligning a line to another line involves keeping track of the tokens'
positions. Previously the shift was incorrectly added to some tokens
that did not move. Then the comments would end up in the wrong places.
</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Respect ColumnLimit while aligning multiline expressions (#163863)</title>
<updated>2025-10-20T20:11:11+00:00</updated>
<author>
<name>Björn Schäpers</name>
<email>bjoern@hazardy.de</email>
</author>
<published>2025-10-20T20:11:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c318f82a4ad4c91401daa177b8c8ab546901bb4d'/>
<id>c318f82a4ad4c91401daa177b8c8ab546901bb4d</id>
<content type='text'>
Before the patch the added test case would indent the function and
moving its second line beyond the column limit.

Fixes #68122.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before the patch the added test case would indent the function and
moving its second line beyond the column limit.

Fixes #68122.</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Reuse AlignTokens for aligning macros (#164120)</title>
<updated>2025-10-19T22:04:42+00:00</updated>
<author>
<name>Björn Schäpers</name>
<email>bjoern@hazardy.de</email>
</author>
<published>2025-10-19T22:04:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=dd6a6bac708235fe2ed80670cd873258430264c2'/>
<id>dd6a6bac708235fe2ed80670cd873258430264c2</id>
<content type='text'>
Fixes #52985.

This leaves aligning short case statements with its own logic. But that
is harder to port, because it aligns even with no content of the right
hand side of the :.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #52985.

This leaves aligning short case statements with its own logic. But that
is harder to port, because it aligns even with no content of the right
hand side of the :.</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Remove special handling of comments after brace/paren (#71672)</title>
<updated>2025-10-18T22:25:28+00:00</updated>
<author>
<name>Björn Schäpers</name>
<email>bjoern@hazardy.de</email>
</author>
<published>2025-10-18T22:25:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cf28a476fb0fae2b19112ce0532b308e79d7bf39'/>
<id>cf28a476fb0fae2b19112ce0532b308e79d7bf39</id>
<content type='text'>
Fixes http://llvm.org/PR55487 (#55487)

The code did not match the documentation about Cpp11BracedListStyle.
Changed handling of comments after opening braces, which are supposedly
function call like to behave exactly like their parenthesis counter
part.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes http://llvm.org/PR55487 (#55487)

The code did not match the documentation about Cpp11BracedListStyle.
Changed handling of comments after opening braces, which are supposedly
function call like to behave exactly like their parenthesis counter
part.</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Continue aligned lines better (#161903)</title>
<updated>2025-10-15T15:18:11+00:00</updated>
<author>
<name>sstwcw</name>
<email>su3e8a96kzlver@posteo.net</email>
</author>
<published>2025-10-15T15:18:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a0b8261610395c3ef121958417251f552d6c1bb5'/>
<id>a0b8261610395c3ef121958417251f552d6c1bb5</id>
<content type='text'>
Fixes #53497.

Fixes #56078.

after with config `{AlignConsecutiveAssignments: true}`

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b                     = [] {
  x = {.one_foooooooooooooooo = 2, //
       .two_fooooooooooooo    = 3, //
       .three_fooooooooooooo  = 4};
};

A B          = {"Hello "
                "World"};
BYTE payload = 2;

float i2 = 0;
auto v   = type{i2 = 1, //
                i  = 3};
```

before

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b                     = [] {
  x = {.one_foooooooooooooooo = 2, //
                           .two_fooooooooooooo    = 3, //
                           .three_fooooooooooooo  = 4};
};

A B          = {"Hello "
                         "World"};
BYTE payload = 2;

float i2 = 0;
auto v   = type{i2 = 1, //
              i  = 3};
```

When a line gets aligned, the following lines may need to move with it.
This patch replaces the old algorithm with a simpler one.  It uses the
`IsAligned` attribute.  It makes most of the scope stack irrelevant.
Now the stack only needs to keep track of 2 levels.

The old algorithm had problems like these.

- Whether lines inside a braced list moved depended on whether there was
  a type at the start.  It should depend on whether the inside was
  aligned to the brace.  The first case that came up with a type name at
  the start happened to have a comma at the end of the list so the
  inside was not aligned to the brace.

- Excluding lines inside closures did not always work.

- A continued string could move twice as much as it should.

The following problems are not fixed yet.

A token that opens a scope is needed.  Operator precedence is not
enough.

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b                     = 0 + //
         0;
```

The algorithm has trouble when things that should not move and things
that should move are nested.  This is related to the `IsAligned`
attribute being a boolean.  It also affects how spaces and tabs are
selected.

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b                     = {.a = {
              .a = 0,
          }};
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #53497.

Fixes #56078.

after with config `{AlignConsecutiveAssignments: true}`

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b                     = [] {
  x = {.one_foooooooooooooooo = 2, //
       .two_fooooooooooooo    = 3, //
       .three_fooooooooooooo  = 4};
};

A B          = {"Hello "
                "World"};
BYTE payload = 2;

float i2 = 0;
auto v   = type{i2 = 1, //
                i  = 3};
```

before

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b                     = [] {
  x = {.one_foooooooooooooooo = 2, //
                           .two_fooooooooooooo    = 3, //
                           .three_fooooooooooooo  = 4};
};

A B          = {"Hello "
                         "World"};
BYTE payload = 2;

float i2 = 0;
auto v   = type{i2 = 1, //
              i  = 3};
```

When a line gets aligned, the following lines may need to move with it.
This patch replaces the old algorithm with a simpler one.  It uses the
`IsAligned` attribute.  It makes most of the scope stack irrelevant.
Now the stack only needs to keep track of 2 levels.

The old algorithm had problems like these.

- Whether lines inside a braced list moved depended on whether there was
  a type at the start.  It should depend on whether the inside was
  aligned to the brace.  The first case that came up with a type name at
  the start happened to have a comma at the end of the list so the
  inside was not aligned to the brace.

- Excluding lines inside closures did not always work.

- A continued string could move twice as much as it should.

The following problems are not fixed yet.

A token that opens a scope is needed.  Operator precedence is not
enough.

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b                     = 0 + //
         0;
```

The algorithm has trouble when things that should not move and things
that should move are nested.  This is related to the `IsAligned`
attribute being a boolean.  It also affects how spaces and tabs are
selected.

```C++
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b                     = {.a = {
              .a = 0,
          }};
```
</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Fix a bug in OneLineFormatOffRegex (#162961)</title>
<updated>2025-10-11T21:40:26+00:00</updated>
<author>
<name>owenca</name>
<email>owenpiano@gmail.com</email>
</author>
<published>2025-10-11T21:40:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=72d6d6e25a33bdea389002c699734e5ee68fe75a'/>
<id>72d6d6e25a33bdea389002c699734e5ee68fe75a</id>
<content type='text'>
Fixes #162402</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #162402</pre>
</div>
</content>
</entry>
</feed>
