History log of /llvm-project/clang/unittests/Format/TokenAnnotatorTest.cpp (Results 101 – 125 of 240)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 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 ...


# 791637e7 12-Jan-2024 Emilia Kond <emilia@rymiel.space>

[clang-format] Don't allow casts in front of ampamp (#77704)

clang-format performs a heuristic to see if a right parenthesis is the
parenthesis of a cast expression. This check never looked ahead t

[clang-format] Don't allow casts in front of ampamp (#77704)

clang-format performs a heuristic to see if a right parenthesis is the
parenthesis of a cast expression. This check never looked ahead to see
if the next token is an ampamp && token. This resulted in the paren
being set as an CastRParen, and the following ampamp got annotated as an
UnaryOperator!

Since && can never be a unary operator is standard C++, this patch
forbids the right paren from ever becoming a cast.

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

show more ...


# cf3421de 11-Jan-2024 Kazu Hirata <kazu@google.com>

[Format] Fix a warning

This patch fixes:

clang/unittests/Format/TokenAnnotatorTest.cpp:2181:29: error: lambda
capture 'Style' is not used [-Werror,-Wunused-lambda-capture]


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


# 093e6bdd 11-Jan-2024 XDeme <66138117+XDeme@users.noreply.github.com>

[clang-format] Fix crash involving array designators (#77045)

Fixes llvm/llvm-project#76716
Fixes parsing of `[0]{}`. Before this patch it was begin parsed as a
lambda, now it is correctly parsed

[clang-format] Fix crash involving array designators (#77045)

Fixes llvm/llvm-project#76716
Fixes parsing of `[0]{}`. Before this patch it was begin parsed as a
lambda, now it is correctly parsed as a designator initializer.

show more ...


# 27f54796 08-Jan-2024 kadir çetinkaya <kadircet@google.com>

[clang-format] Break after string literals with trailing line breaks (#76795)

This restores a subset of functionality that was forego in
d68826dfbd987377ef6771d40c1d984f09ee3b9e.

Streaming multi

[clang-format] Break after string literals with trailing line breaks (#76795)

This restores a subset of functionality that was forego in
d68826dfbd987377ef6771d40c1d984f09ee3b9e.

Streaming multiple string literals is rare enough in practice, hence
that change makes sense in general. But it seems people were
incidentally relying on this for having line breaks after string
literals that ended with `\n`.

This patch tries to restore that behavior to prevent regressions in the
upcoming LLVM release, until we can implement some configuration based
approach as proposed in https://github.com/llvm/llvm-project/pull/69859.

show more ...


# f8f89260 23-Dec-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a bug in annotating function declaration names (#76206)

Annotates function declaration names having unnamed parameters.


# 9512d6d2 13-Dec-2023 XDeme <66138117+XDeme@users.noreply.github.com>

[clang-format] Fix parsing of `operator<() {}` (#75144)

Fixes #74876.

During the parsing of `operator<(Foo&) {}`, there was no handling for
the operator<, so it called `consumeToken()` again, ca

[clang-format] Fix parsing of `operator<() {}` (#75144)

Fixes #74876.

During the parsing of `operator<(Foo&) {}`, there was no handling for
the operator<, so it called `consumeToken()` again, causing the
`AnnotationParser::Scopes` to have one additional left brace each time
it tried to parse it, leaving it unbalanced.
Because of this, in the following code:
```cpp
class Foo {
void operator<(Foo&) {}
Foo& f;
};
```
The `&` in the reference member, was being interpreted as
`TT_BinaryOperator` instead of `TT_PointerOrReference`.

show more ...


# a112921d 30-Nov-2023 Emilia Kond <emilia@rymiel.space>

[clang-format] Don't skip stringizing when determining brace kind (#73886)

PR #69473 introduced skipping PP directives when determining the brace
kind of an lbrace. However, it did so by skipping t

[clang-format] Don't skip stringizing when determining brace kind (#73886)

PR #69473 introduced skipping PP directives when determining the brace
kind of an lbrace. However, it did so by skipping to the end of the line
when encountering a hash character. This means it also skipped to the
end of line when encountering a macro stringizing operator, which,
unlike PP directives, don't have effect until the end of line.

This led to cases where the rbrace could be completely skipped if it was
on the same line as a stringizing operator.

This patch skips hash characters if we're already in a PP directive, as
you can't define a macro inside of a macro

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

show more ...


# 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
# edad025d 19-Nov-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Correctly annotate braces of empty functions (#72733)

Also fixed some existing test cases.

Fixed #57305.
Fixed #58251.


# cb3a605c 19-Nov-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a bug in isStartOfName() on macro definitions (#72768)

Fixed #72751.


# eaff0830 15-Nov-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix more bugs in isStartOfName() (#72336)

Fixed #72264.


Revision tags: llvmorg-17.0.5
# a8528693 14-Nov-2023 Gedare Bloom <gedare@rtems.org>

[clang-format] Fix a bug in parsing function/variable names

Function and variable names are not detected when there is a
__attribute__((x)) preceding the name.

Fixes #64137.

Differential Revision:

[clang-format] Fix a bug in parsing function/variable names

Function and variable names are not detected when there is a
__attribute__((x)) preceding the name.

Fixes #64137.

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

show more ...


# 063e3fe6 03-Nov-2023 Emilia Kond <emilia@rymiel.space>

[clang-format] Skip PP directives when determining brace kind (#69473)

Pull request #65409 changed the brace kind heuristic to not treat a
preprocessor if directive as a in statement, however, this

[clang-format] Skip PP directives when determining brace kind (#69473)

Pull request #65409 changed the brace kind heuristic to not treat a
preprocessor if directive as a in statement, however, this caused some
regressions.

If the contents of a brace don't immediately determine the brace kind,
the heuristic will look at the characters immediately before and after
the closing brace to determine the brace type.

Unfortunately, if the closing brace was preceded by a preprocessor
directive, for example `#endif`, the preceding token was `endif`, seen
as just an identifier, so the braces were understood as a braced list.

This patch fixes this behaviour by skipping all preprocessor directives
when calculating brace types. Comments were already being skipped, so
now preprocessor lines are skipped alongside comments.

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

show more ...


# c280bed8 31-Oct-2023 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Fix annotating annotations after requires clause

Fixes #69325.


Revision tags: llvmorg-17.0.4
# e00d32af 28-Oct-2023 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Delete TT_LambdaArrow (#70519)

It's one type of TT_TrailingReturnArrow.


# 88934a82 27-Oct-2023 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Remove extraneous newlines in some unit test files


# a95d4b79 20-Oct-2023 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Annotate do while while

So we can differentiate on the while keyword between a do-while-loop and
a normal while-loop.


# 0ae998c4 18-Oct-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a bug in annotating TrailingReturnArrow (#69249)

Skip TrailingAnnotation when looking for TrailingReturnArrow.

Fixes #69234.


Revision tags: llvmorg-17.0.3
# 5f4ed780 16-Oct-2023 Emilia Kond <emilia@rymiel.space>

[clang-format] Allow default values for template parameters in lambda (#69052)

Previously, upon encountering an equals sign while parsing a lambda in
the UnwrappedLineParser, it would fall through

[clang-format] Allow default values for template parameters in lambda (#69052)

Previously, upon encountering an equals sign while parsing a lambda in
the UnwrappedLineParser, it would fall through and fail. This caused any
lambda template with a default argument for a template parameter to be
annotated as an ArraySubscriptLSquare.

This patch allows equals signs in the UnwrappedLineParser if we're
currently in a template parameter list. This resolved a FIXME that was
in the lambda parsing function.

This patch seems deceptively easy, it's likely it doesn't solve the
FIXME entirely, or causes other issues (the FIXME itself mentions
something about Objective-C, which I cannot comment about). However this
patch is sufficient to fix the below issue.

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

---------

Co-authored-by: Owen Pan <owenpiano@gmail.com>

show more ...


# 7f881a2a 10-Oct-2023 Jared Grubb <jgrubb@apple.com>

[clang-format] Treat AttributeMacro more like __attribute__

There are two parts to this fix:
- Annotate the paren after an AttributeMacro as an AttributeLParen.
- Treat an AttributeMacro-without-par

[clang-format] Treat AttributeMacro more like __attribute__

There are two parts to this fix:
- Annotate the paren after an AttributeMacro as an AttributeLParen.
- Treat an AttributeMacro-without-paren the same as one with a paren.

I added a new test-case to differentiate a macro that is or is-not an
AttributeMacro; also handled whether ColumnLimit is set to infinite (0) or a
finite value, as part of this patch is in ContinuationIndenter.

Closes #68722.

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

show more ...


# 6c7cf74a 15-Oct-2023 Owen Pan <owenpiano@gmail.com>

Revert "[clang-format] Treat AttributeMacro more like __attribute__"

This reverts commit 6f46bcc609f14121e6942763ba9871f98541ea0e.


Revision tags: llvmorg-17.0.2
# 6f46bcc6 02-Oct-2023 Jared Grubb <jgrubb@apple.com>

[clang-format] Treat AttributeMacro more like __attribute__

There are two parts to this fix:
- Annotate the paren after an AttributeMacro as an AttributeLParen.
- Treat an AttributeMacro-without-par

[clang-format] Treat AttributeMacro more like __attribute__

There are two parts to this fix:
- Annotate the paren after an AttributeMacro as an AttributeLParen.
- Treat an AttributeMacro-without-paren the same as one with a paren.

I added a new test-case to differentiate a macro that is or is-not an
AttributeMacro; also handled whether ColumnLimit is set to infinite (0) or a
finite value, as part of this patch is in ContinuationIndenter.

Closes #68722.

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

show more ...


# a8896e57 13-Oct-2023 Björn Schäpers <bjoern@hazardy.de>

[clang-format][NFC] Annotate control statement r_braces (#68621)

Annotating switch braces for the first time.

Also in preparation of #67906.


12345678910