<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/clang/lib/Format/FormatTokenLexer.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] Recognize Verilog followed-by operators (#165594)</title>
<updated>2025-11-03T03:55:53+00:00</updated>
<author>
<name>sstwcw</name>
<email>su3e8a96kzlver@posteo.net</email>
</author>
<published>2025-11-03T03:55:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=43177bf777f6a44c058277e9b504687bdc0370cc'/>
<id>43177bf777f6a44c058277e9b504687bdc0370cc</id>
<content type='text'>
When formatting Verilog code, the program changes the hash to
`kw_verilogHash` and the backtick to `tok::hash`. The developer did not
take that into account when writing the part for recognizing the `#-#`
and `#=#` operators. The part did not work. The program would add a
space within the operator.

after

```SystemVerilog
##[0 : 5] done #-# always !rst;
```

before

```SystemVerilog
##[0 : 5] done #- #always !rst;
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When formatting Verilog code, the program changes the hash to
`kw_verilogHash` and the backtick to `tok::hash`. The developer did not
take that into account when writing the part for recognizing the `#-#`
and `#=#` operators. The part did not work. The program would add a
space within the operator.

after

```SystemVerilog
##[0 : 5] done #-# always !rst;
```

before

```SystemVerilog
##[0 : 5] done #- #always !rst;
```
</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>
<entry>
<title>[clang-format][NFC] Introduce isNoneOf (#161021)</title>
<updated>2025-10-02T18:52:45+00:00</updated>
<author>
<name>Björn Schäpers</name>
<email>bjoern@hazardy.de</email>
</author>
<published>2025-10-02T18:52:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=847e1e18902d1bedb9d7df8cbec84dbda8042e47'/>
<id>847e1e18902d1bedb9d7df8cbec84dbda8042e47</id>
<content type='text'>
And apply throughout the code base.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
And apply throughout the code base.</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Remove code related to trigraphs (#148640)</title>
<updated>2025-07-21T15:40:28+00:00</updated>
<author>
<name>sstwcw</name>
<email>su3e8a96kzlver@posteo.net</email>
</author>
<published>2025-07-21T15:40:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=12a3afe47d4e5fcc97eb44271c00ace7cc8e4ff2'/>
<id>12a3afe47d4e5fcc97eb44271c00ace7cc8e4ff2</id>
<content type='text'>
When reviewing #147156, the reviewers pointed out that we didn't need to
support the trigraph. The code never handled it right.

In the debug build, this kind of input caused the assertion in the
function `countLeadingWhitespace` to fail. The release build without
assertions outputted `?` `?` `/` separated by spaces.

```C
#define A ??/
  int i;
```

This is because the code in `countLeadingWhitespace` assumed that the
underlying lexer recognized the entire `??/` sequence as a single token.
In fact, the lexer recognized it as 3 separate tokens. The flag to make
the lexer recognize trigraphs was never enabled.

This patch enables the flag in the underlying lexer. This way, the
program now either turns the trigraph into a single `\` or removes it
altogether if the line is short enough. There are operators like the
`??=` in C#. So the flag is not enabled for all input languages. Instead
the check for the token size is moved from the assert line into the if
line.

The problem was introduced by my own patch 370bee480139 from about 3
years ago. I added code to count the number of characters in the escape
sequence probably just because the block of code used to have a comment
saying someone should add the feature. Maybe I forgot to enable
assertions when I ran the code. I found the problem because reviewing
pull request 145243 made me look at the code again.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When reviewing #147156, the reviewers pointed out that we didn't need to
support the trigraph. The code never handled it right.

In the debug build, this kind of input caused the assertion in the
function `countLeadingWhitespace` to fail. The release build without
assertions outputted `?` `?` `/` separated by spaces.

```C
#define A ??/
  int i;
```

This is because the code in `countLeadingWhitespace` assumed that the
underlying lexer recognized the entire `??/` sequence as a single token.
In fact, the lexer recognized it as 3 separate tokens. The flag to make
the lexer recognize trigraphs was never enabled.

This patch enables the flag in the underlying lexer. This way, the
program now either turns the trigraph into a single `\` or removes it
altogether if the line is short enough. There are operators like the
`??=` in C#. So the flag is not enabled for all input languages. Instead
the check for the token size is moved from the assert line into the if
line.

The problem was introduced by my own patch 370bee480139 from about 3
years ago. I added code to count the number of characters in the escape
sequence probably just because the block of code used to have a comment
saying someone should add the feature. Maybe I forgot to enable
assertions when I ran the code. I found the problem because reviewing
pull request 145243 made me look at the code again.</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Add MacrosSkippedByRemoveParentheses option (#148345)</title>
<updated>2025-07-13T21:29:51+00:00</updated>
<author>
<name>Owen Pan</name>
<email>owenpiano@gmail.com</email>
</author>
<published>2025-07-13T21:29:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c384ec431dd7f771c9dd7c462cec5301ac0f32bb'/>
<id>c384ec431dd7f771c9dd7c462cec5301ac0f32bb</id>
<content type='text'>
This allows RemoveParentheses to skip the invocations of function-like
macros.

Fixes #68354.
Fixes #147780.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This allows RemoveParentheses to skip the invocations of function-like
macros.

Fixes #68354.
Fixes #147780.</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Split line comments separated by backslashes (#147648)</title>
<updated>2025-07-11T01:14:45+00:00</updated>
<author>
<name>Owen Pan</name>
<email>owenpiano@gmail.com</email>
</author>
<published>2025-07-11T01:14:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cb52efb8936c0da0a03958daa95d45eaaf8806fb'/>
<id>cb52efb8936c0da0a03958daa95d45eaaf8806fb</id>
<content type='text'>
Fixes #147341</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #147341</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format][NFC] Use `empty()` instead of comparing size() to 0 or 1</title>
<updated>2025-07-07T06:54:00+00:00</updated>
<author>
<name>Owen Pan</name>
<email>owenpiano@gmail.com</email>
</author>
<published>2025-07-07T06:50:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a5af8745039f906c4fc4184a1fe0d35d42355f52'/>
<id>a5af8745039f906c4fc4184a1fe0d35d42355f52</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format][NFC] Replace size() with empty() (#147164)</title>
<updated>2025-07-06T21:19:30+00:00</updated>
<author>
<name>Owen Pan</name>
<email>owenpiano@gmail.com</email>
</author>
<published>2025-07-06T21:19:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5ccbea9f480d5c387c7f21aa101e72774c91f1d3'/>
<id>5ccbea9f480d5c387c7f21aa101e72774c91f1d3</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (#145243)</title>
<updated>2025-06-25T16:13:00+00:00</updated>
<author>
<name>Naveen Seth Hanig</name>
<email>naveen.hanig@outlook.com</email>
</author>
<published>2025-06-25T16:13:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=dd47b845a62cdaf4a1b0aba354cd80a4eabd9570'/>
<id>dd47b845a62cdaf4a1b0aba354cd80a4eabd9570</id>
<content type='text'>
Fixes #145226.

Implement
[P2223R2](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2223r2.pdf)
in clang-format to correctly handle cases where a backslash '\\' is
followed by trailing whitespace before the newline.
Previously, `clang-format` failed to properly detect and handle such
cases, leading to misformatted code.

With this, `clang-format` matches the behavior already implemented in
Clang's lexer and `DependencyDirectivesScanner.cpp`, which allow
trailing whitespace after a line continuation in any C++ standard.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #145226.

Implement
[P2223R2](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2223r2.pdf)
in clang-format to correctly handle cases where a backslash '\\' is
followed by trailing whitespace before the newline.
Previously, `clang-format` failed to properly detect and handle such
cases, leading to misformatted code.

With this, `clang-format` matches the behavior already implemented in
Clang's lexer and `DependencyDirectivesScanner.cpp`, which allow
trailing whitespace after a line continuation in any C++ standard.</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-format] Handle Java text blocks (#141334)</title>
<updated>2025-05-25T22:40:45+00:00</updated>
<author>
<name>Owen Pan</name>
<email>owenpiano@gmail.com</email>
</author>
<published>2025-05-25T22:40:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b7f5950bb3b97eac979925a3bbf015530c26962e'/>
<id>b7f5950bb3b97eac979925a3bbf015530c26962e</id>
<content type='text'>
Fix #61954</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix #61954</pre>
</div>
</content>
</entry>
</feed>
