History log of /llvm-project/clang/lib/Format/FormatTokenLexer.cpp (Results 26 – 50 of 119)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-18.1.0-rc1, llvmorg-19-init
# fcb6737f 20-Jan-2024 Hirofumi Nakamura <k.nakamura.hirofumi@gmail.com>

[clang-format] Support of TableGen identifiers beginning with a number. (#78571)

TableGen allows the identifiers beginning with a number.
This patch add the support of the recognition of such ident

[clang-format] Support of TableGen identifiers beginning with a number. (#78571)

TableGen allows the identifiers beginning with a number.
This patch add the support of the recognition of such identifiers.

show more ...


# e3702f62 17-Jan-2024 Hirofumi Nakamura <k.nakamura.hirofumi@gmail.com>

[clang-format] TableGen multi line string support. (#78032)

Support the handling of TableGen's multiline string (code) literal.
That has the form,
[{ this is the string possibly with multi line..

[clang-format] TableGen multi line string support. (#78032)

Support the handling of TableGen's multiline string (code) literal.
That has the form,
[{ this is the string possibly with multi line... }]

show more ...


# 0cc31579 11-Jan-2024 Hirofumi Nakamura <k.nakamura.hirofumi@gmail.com>

[clang-format] TableGen keywords support. (#77477)

Add TableGen keywords to the additional keyword list of the formatter.

This pull request is the splited part from
https://github.com/llvm/llvm-

[clang-format] TableGen keywords support. (#77477)

Add TableGen keywords to the additional keyword list of the formatter.

This pull request is the splited part from
https://github.com/llvm/llvm-project/pull/76059 .

show more ...


# f3dcc235 13-Dec-2023 Kazu Hirata <kazu@google.com>

[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}:

[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.

show more ...


# 4c174520 29-Nov-2023 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Extend isProto() to also cover LK_TextProto (#73582)


# 3af82b39 29-Nov-2023 sstwcw <su3e8a96kzlver@posteo.net>

[clang-format] Add spaces around the Verilog implication operator (#71352)

The Verilog implication operator `->` is a binary operator meaning
either the left hand side is false or the right hand si

[clang-format] Add spaces around the Verilog implication operator (#71352)

The Verilog implication operator `->` is a binary operator meaning
either the left hand side is false or the right hand side is true.
Previously it was treated as the C++ struct member operator.

I didn't even know it existed when I added the operator formatting part.
And I didn't check all the tests for all the operators I added. That is
how the bad test got in.

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4
# 91c4db00 24-Aug-2023 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Replace !is() with isNot()

Differential Revision: https://reviews.llvm.org/D158571


Revision tags: llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# 5c106f7b 14-Jul-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Add TypeNames option to disambiguate types/objects

If a non-keyword identifier is found in TypeNames, then a *, &, or && that
follows it is annotated as TT_PointerOrReference.

Differ

[clang-format] Add TypeNames option to disambiguate types/objects

If a non-keyword identifier is found in TypeNames, then a *, &, or && that
follows it is annotated as TT_PointerOrReference.

Differential Revision: https://reviews.llvm.org/D155273

show more ...


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3
# 682808d9 10-Feb-2023 Owen Pan <owenpiano@gmail.com>

Reland [clang-format] Add a space between an overloaded operator and '>'

The token annotator doesn't annotate the template opener and closer
as such if they enclose an overloaded operator. This caus

Reland [clang-format] Add a space between an overloaded operator and '>'

The token annotator doesn't annotate the template opener and closer
as such if they enclose an overloaded operator. This causes the
space between the operator and the closer to be removed, resulting
in invalid C++ code.

Fixes #58602.

Differential Revision: https://reviews.llvm.org/D143755

show more ...


# 696f8b32 20-Mar-2023 Kadir Cetinkaya <kadircet@google.com>

Revert "[clang-format] Add a space between an overloaded operator and '>'"

This reverts commit b05dc1b8766a47482cae432011fd2faa04c83a3e.

Makes clang-format crash on `struct Foo { operator enum foo{

Revert "[clang-format] Add a space between an overloaded operator and '>'"

This reverts commit b05dc1b8766a47482cae432011fd2faa04c83a3e.

Makes clang-format crash on `struct Foo { operator enum foo{} };`

show more ...


# b05dc1b8 10-Feb-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Add a space between an overloaded operator and '>'

The token annotator doesn't annotate the template opener and closer
as such if they enclose an overloaded operator. This causes the

[clang-format] Add a space between an overloaded operator and '>'

The token annotator doesn't annotate the template opener and closer
as such if they enclose an overloaded operator. This causes the
space between the operator and the closer to be removed, resulting
in invalid C++ code.

Fixes #58602.

Differential Revision: https://reviews.llvm.org/D143755

show more ...


Revision tags: llvmorg-16.0.0-rc2
# 25e2d0f3 28-Jan-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Support clang-format on/off line comments as prefix

Closes #60264.

Differential Revision: https://reviews.llvm.org/D142804


Revision tags: llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3
# 882a05af 06-Oct-2022 Sam McCall <sam.mccall@gmail.com>

[Format] Fix crash when hitting eof while lexing JS template string

Different loop termination conditions resulted in confusion of whether
*Offset was intended to be inside or outside the token.
Thi

[Format] Fix crash when hitting eof while lexing JS template string

Different loop termination conditions resulted in confusion of whether
*Offset was intended to be inside or outside the token.
This ultimately led to constructing an out-of-range SourceLocation.

Fix by making Offset consistently point *after* the token.

Differential Revision: https://reviews.llvm.org/D135356

show more ...


Revision tags: working, llvmorg-15.0.2
# b60e7a7f 02-Oct-2022 owenca <owenpiano@gmail.com>

[clang-format] Handle C# interpolated verbatim string prefix @$

Fixes #58062.

Differential Revision: https://reviews.llvm.org/D135026


Revision tags: llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2
# 3f18f7c0 08-Aug-2022 Fangrui Song <i@maskray.me>

[clang] LLVM_FALLTHROUGH => [[fallthrough]]. NFC

With C++17 there is no Clang pedantic warning or MSVC C5051.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D131346


# 71336d03 31-Jul-2022 Kazu Hirata <kazu@google.com>

Use llvm::any_of (NFC)


Revision tags: llvmorg-15.0.0-rc1
# f93182a8 28-Jul-2022 sstwcw <f0gukp2nk@protonmail.com>

[clang-format] Handle Verilog numbers and operators

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D126845


Revision tags: llvmorg-16-init
# 0ffb3dd3 23-Jul-2022 owenca <owenpiano@gmail.com>

[clang-format] Fix a hang when formatting C# $@ string literals

Fixes #56624.

Differential Revision: https://reviews.llvm.org/D130411


# a9bef070 29-Jun-2022 Kevin Cadieux <kevca@microsoft.com>

[clang-format] Fix incorrect isspace input (NFC)

This change fixes a clang-format unit test failure introduced by [D124748](https://reviews.llvm.org/D124748). The `countLeadingWhitespace` function w

[clang-format] Fix incorrect isspace input (NFC)

This change fixes a clang-format unit test failure introduced by [D124748](https://reviews.llvm.org/D124748). The `countLeadingWhitespace` function was calling `isspace` with values that could fall outside the valid input range. The valid input range for `isspace` is unsigned 0-255. Values outside this range produce undefined behavior, which on Windows manifests as an assertion being raised in the debug runtime libraries. `countLeadingWhitespace` was calling `isspace` with a signed char that could produce a negative value if the underlying byte's value was 128 or above, which can happen for non-ASCII encodings. The fix is to use `StringRef`'s `bytes_begin` and `bytes_end` iterators to read the values as unsigned chars instead.

This bug can be reproduced by building the `check-clang-unit` target with a DEBUG configuration under Windows. This change is already covered by existing unit tests.

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D128786

show more ...


# 141ad3ba 26-Jun-2022 sstwcw <f0gukp2nk@protonmail.com>

[clang-format] Fix uninitialized memory problem

The setLength function checks for the token kind which could be
uninitialized in the previous version.

The problem was introduced in 2e32ff106e.

Rev

[clang-format] Fix uninitialized memory problem

The setLength function checks for the token kind which could be
uninitialized in the previous version.

The problem was introduced in 2e32ff106e.

Reviewed By: MyDeveloperDay, owenpan

Differential Revision: https://reviews.llvm.org/D128607

show more ...


# 2e32ff10 26-Jun-2022 sstwcw <f0gukp2nk@protonmail.com>

[clang-format] Handle Verilog preprocessor directives

Verilog uses the backtick instead of the hash. In this revision
backticks are lexed manually and then get labeled as hashes so the logic
for ha

[clang-format] Handle Verilog preprocessor directives

Verilog uses the backtick instead of the hash. In this revision
backticks are lexed manually and then get labeled as hashes so the logic
for handling C preprocessor stuff don't have to change. Hashes get
labeled as identifiers for Verilog-specific stuff like delays.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D124749

show more ...


# 370bee48 26-Jun-2022 sstwcw <f0gukp2nk@protonmail.com>

[clang-format] Fix whitespace counting stuff

The current way of counting whitespace would count backticks as
whitespace. For Verilog stuff we need backticks to be handled
correctly. For JavaScript

[clang-format] Fix whitespace counting stuff

The current way of counting whitespace would count backticks as
whitespace. For Verilog stuff we need backticks to be handled
correctly. For JavaScript the current way is to compare the entire
token text to see if it's a backtick. However, when the backtick is the
first token following an escaped newline, the escaped newline will be
part of the tok::unknown token. Verilog has macros and escaped newlines
unlike JavaScript. So we can't regard an entire tok::unknown token as
whitespace. Previously, the start of every token would be matched for
newlines. Now, it is all whitespace instead of just newlines.

The column counting problem has already been fixed for JavaScript in
e71b4cbdd140f059667f84464bd0ac0ebc348387 by counting columns elsewhere.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D124748

show more ...


Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4
# bebf7bdf 22-May-2022 owenca <owenpiano@gmail.com>

[clang-format][NFC] Insert/remove braces in clang/lib/Format/

Differential Revision: https://reviews.llvm.org/D126157


# 573a5b58 18-May-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

Revert "[clang-format] Fix WhitespaceSensitiveMacros not being honoured when macro closing parenthesis is followed by a newline."

This reverts commit 50cd52d9357224cce66a9e00c9a0417c658a5655.

It pr

Revert "[clang-format] Fix WhitespaceSensitiveMacros not being honoured when macro closing parenthesis is followed by a newline."

This reverts commit 50cd52d9357224cce66a9e00c9a0417c658a5655.

It provoked regressions in C++ and ObjectiveC as described in https://reviews.llvm.org/D123676#3515949.

Reproducers:
```
MACRO_BEGIN
#if A
int f();
#else
int f();
#endif
```

```
NS_SWIFT_NAME(A)
@interface B : C
@property(readonly) D value;
@end
```

show more ...


Revision tags: llvmorg-14.0.3, llvmorg-14.0.2
# 50cd52d9 13-Apr-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Fix WhitespaceSensitiveMacros not being honoured when macro closing parenthesis is followed by a newline.

Fixes https://github.com/llvm/llvm-project/issues/54522.

This fixes regressi

[clang-format] Fix WhitespaceSensitiveMacros not being honoured when macro closing parenthesis is followed by a newline.

Fixes https://github.com/llvm/llvm-project/issues/54522.

This fixes regression introduced in https://github.com/llvm/llvm-project/commit/5e5efd8a91f2e340e79a73bedbc6ab66ad4a4281.

Before the culprit commit, macros in WhitespaceSensitiveMacros were correctly formatted even if their closing parenthesis weren't followed by semicolon (or, to be precise, when they were followed by a newline).
That commit changed the type of the macro token type from TT_UntouchableMacroFunc to TT_FunctionLikeOrFreestandingMacro.

Correct formatting (with `WhitespaceSensitiveMacros = ['FOO']`):
```
FOO(1+2)
FOO(1+2);
```

Regressed formatting:
```
FOO(1 + 2)
FOO(1+2);
```

Reviewed By: HazardyKnusperkeks, owenpan, ksyx

Differential Revision: https://reviews.llvm.org/D123676

show more ...


12345