History log of /llvm-project/clang/unittests/Format/TokenAnnotatorTest.cpp (Results 126 – 150 of 240)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b7abab2f 09-Oct-2023 Björn Schäpers <bjoern@hazardy.de>

Annotate enum r brace

In preparation of #67906.


# 38c31d7e 09-Oct-2023 Björn Schäpers <bjoern@hazardy.de>

[clang-format][NFC] Annotate more r_braces

In preparation of #67906.


# 7e856d18 04-Oct-2023 Owen Pan <owenpiano@gmail.com>

Reland "[clang-format] Annotate ctors/dtors as CtorDtorDeclName instead (#67955)"

Reland 6a621ed8e4cb which failed on Windows but not macOS.

The failures were caused by moving the annotation of the

Reland "[clang-format] Annotate ctors/dtors as CtorDtorDeclName instead (#67955)"

Reland 6a621ed8e4cb which failed on Windows but not macOS.

The failures were caused by moving the annotation of the children from the
top to the bottom of TokenAnnotator::annotate(), resulting in invalid lines
including incomplete ones being skipped.

show more ...


# d08fcc81 04-Oct-2023 Owen Pan <owenpiano@gmail.com>

Revert "[clang-format] Annotate ctors/dtors as CtorDtorDeclName instead (#67955)"

This reverts commit 6a621ed8e4cb02bd55fe4a4a0254615576b70a55 as it caused
buildbots to fail.


# 6a621ed8 04-Oct-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Annotate ctors/dtors as CtorDtorDeclName instead (#67955)

After annotating constructors/destructors as FunctionDeclarationName in
commit 08630512088, we have seen several issues beca

[clang-format] Annotate ctors/dtors as CtorDtorDeclName instead (#67955)

After annotating constructors/destructors as FunctionDeclarationName in
commit 08630512088, we have seen several issues because ctors/dtors had
been treated differently than functions in aligning, wrapping, and
indenting.

This patch annotates ctors/dtors as CtorDtorDeclName instead and would
effectively revert commit 0468fa07f87f, which is obsolete now.

Fixed #67903.
Fixed #67907.

show more ...


# c83d64f1 02-Oct-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a bug in mis-annotating arrows (#67780)

Fixed #66923.


# 151d0a4d 29-Sep-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Handle __attribute/__declspec/AttributeMacro consistently (#67518)


# 3e87829a 27-Sep-2023 Emilia Kond <emilia@rymiel.space>

[clang-format] Fix requires misannotation with comma (#65908)

clang-format uses a heuristic to determine if a requires() is either a
requires clause or requires expression, based on what is in the

[clang-format] Fix requires misannotation with comma (#65908)

clang-format uses a heuristic to determine if a requires() is either a
requires clause or requires expression, based on what is in the
parentheses. Part of this heuristic assumed that a requires clause can
never contain a comma, however this is not the case if said comma is in
the template argument of a type.

This patch allows commas to appear in a requires clause if an angle
bracket `<` has been opened.

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

show more ...


# 67b99fa8 27-Sep-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Correctly annotate keyword operator function name (#66904)

Fixes #66890.


# cef9f40c 27-Sep-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Split TT_AttributeParen (#67396)

Replaced TT_AttributeParen with TT_AttributeLParen and
TT_AttributeRParen.


# 6e608dc4 26-Sep-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Correctly annotate return type of function pointer (#66893)

Fixes #66857.


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0
# 0b2c88ee 14-Sep-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a bug in annotating `&&` followed by `*` or `&` (#65933)

Fixes #65877.


# 5db201fb 13-Sep-2023 sstwcw <134215812+sstwcw@users.noreply.github.com>

[clang-format] Stop breaking unbreakable strings in JS (#66168)

Dictionary literal keys and strings in TypeScript type declarations can
not be broken.

The problem was pointed out by @alexfh and

[clang-format] Stop breaking unbreakable strings in JS (#66168)

Dictionary literal keys and strings in TypeScript type declarations can
not be broken.

The problem was pointed out by @alexfh and @e-kud here:

https://reviews.llvm.org/D154093#4644512

show more ...


# e9ed1aa9 07-Sep-2023 Emilia Kond <emilia@rymiel.space>

[clang-format] Correctly annotate designated initializer with PP if (#65409)

When encountering braces, such as those of a designated initializer,
clang-format scans ahead to see what is contained w

[clang-format] Correctly annotate designated initializer with PP if (#65409)

When encountering braces, such as those of a designated initializer,
clang-format scans ahead to see what is contained within the braces. If
it found a statement, like an if-statement of for-loop, it would deem
the braces as not an initializer, but as a block instead.

However, this heuristic incorrectly included a preprocessor `#if` line
as an if-statement. This manifested in strange results and discrepancies
between `#ifdef` and `#if defined`.

With this patch, `if` is now ignored if it is preceeded by `#`.

Fixes most of https://github.com/llvm/llvm-project/issues/56685

show more ...


# 4f7086ce 07-Sep-2023 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Fix misannotation of && before noexcept (#65526)

When we are in an expression, it has to be a binary operator and not
pointer or reference.


Revision tags: llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# ddc80637 29-Jun-2023 sstwcw <su3e8a96kzlver@posteo.net>

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
s

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
strings are not broken.

A new subclass BreakableStringLiteralUsingOperators is used to handle
the logic for adding plus signs and commas. The updateAfterBroken
method was added because now parentheses or braces may be required after
the parentheses or commas are added. In order to decide whether the
added plus sign should be unindented in the BreakableToken object, the
logic for it is taken out into a separate function
shouldUnindentNextOperator.

The logic for finding the continuation indentation when the option
AlignAfterOpenBracket is set to DontAlign is not implemented yet. So in
that case the new line may have the wrong indentation, and the parts may
have the wrong length if the string needs to be broken more than once
because finding where to break the string depends on where the string
starts.

The preambles for the C# and Java unit tests are changed to the newer
style in order to allow the 3-argument verifyFormat macro. Some cases
are changed from verifyFormat to verifyImcompleteFormat because those
use incomplete code and the new verifyFormat function checks that the
code is complete.

The line in the doc was changed to being indented by 4 spaces, that is,
the default continuation indentation. It has always been the case. It
was probably a mistake that the doc showed 2 spaces previously.

This commit was fist committed as 16ccba51072b. The tests caused
assertion failures. Then it was reverted in 547bce36132a.

Reviewed By: MyDeveloperDay

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

show more ...


# 08630512 28-Aug-2023 Owen Pan <owenpiano@gmail.com>

Reland "[clang-format] Annotate constructor/destructor names"

(0e63f1aacc00 was reverted by 7590b7657004 due to a crash.)

Annotate constructor/destructor names as FunctionDeclarationName.

Fixes #6

Reland "[clang-format] Annotate constructor/destructor names"

(0e63f1aacc00 was reverted by 7590b7657004 due to a crash.)

Annotate constructor/destructor names as FunctionDeclarationName.

Fixes #63046.

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

show more ...


# 7590b765 28-Aug-2023 Kadir Cetinkaya <kadircet@google.com>

Revert "[clang-format] Annotate constructor/destructor names"

This reverts commit 0e63f1aacc0040e9a16fa2fab15a140b1686e2ab.

clang-format started to crash with contents like:
a.h:
```
```
$ clang-fo

Revert "[clang-format] Annotate constructor/destructor names"

This reverts commit 0e63f1aacc0040e9a16fa2fab15a140b1686e2ab.

clang-format started to crash with contents like:
a.h:
```
```
$ clang-format a.h
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ../llvm/build/bin/clang-format a.h
#0 0x0000560b689fe177 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /usr/local/google/home/kadircet/repos/llvm/llvm/lib/Support/Unix/Signals.inc:723:13
#1 0x0000560b689fbfbe llvm::sys::RunSignalHandlers() /usr/local/google/home/kadircet/repos/llvm/llvm/lib/Support/Signals.cpp:106:18
#2 0x0000560b689feaca SignalHandler(int) /usr/local/google/home/kadircet/repos/llvm/llvm/lib/Support/Unix/Signals.inc:413:1
#3 0x00007f030405a540 (/lib/x86_64-linux-gnu/libc.so.6+0x3c540)
#4 0x0000560b68a9a980 is /usr/local/google/home/kadircet/repos/llvm/clang/include/clang/Lex/Token.h:98:44
#5 0x0000560b68a9a980 is /usr/local/google/home/kadircet/repos/llvm/clang/lib/Format/FormatToken.h:562:51
#6 0x0000560b68a9a980 startsSequenceInternal<clang::tok::TokenKind, clang::tok::TokenKind> /usr/local/google/home/kadircet/repos/llvm/clang/lib/Format/FormatToken.h:831:9
#7 0x0000560b68a9a980 startsSequence<clang::tok::TokenKind, clang::tok::TokenKind> /usr/local/google/home/kadircet/repos/llvm/clang/lib/Format/FormatToken.h:600:12
#8 0x0000560b68a9a980 getFunctionName /usr/local/google/home/kadircet/repos/llvm/clang/lib/Format/TokenAnnotator.cpp:3131:17
#9 0x0000560b68a9a980 clang::format::TokenAnnotator::annotate(clang::format::AnnotatedLine&) /usr/local/google/home/kadircet/repos/llvm/clang/lib/Format/TokenAnnotator.cpp:3191:17
Segmentation fault
```

show more ...


# 0e63f1aa 17-Aug-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Annotate constructor/destructor names

Annotate constructor/destructor names as FunctionDeclarationName.

Fixes #63046.

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


# 547bce36 24-Aug-2023 David Spickett <david.spickett@linaro.org>

Revert "[clang-format] Break long string literals in C#, etc."

This reverts commit 16ccba51072bbc5ff4c66f91f939163dc91e5d96.

This is failing across Linaro's bots e.g.:
https://lab.llvm.org/buildbot

Revert "[clang-format] Break long string literals in C#, etc."

This reverts commit 16ccba51072bbc5ff4c66f91f939163dc91e5d96.

This is failing across Linaro's bots e.g.:
https://lab.llvm.org/buildbot/#/builders/188/builds/34393

show more ...


# 16ccba51 29-Jun-2023 sstwcw <su3e8a96kzlver@posteo.net>

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
s

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
strings are not broken.

A new subclass BreakableStringLiteralUsingOperators is used to handle
the logic for adding plus signs and commas. The updateAfterBroken
method was added because now parentheses or braces may be required after
the parentheses or commas are added. In order to decide whether the
added plus sign should be unindented in the BreakableToken object, the
logic for it is taken out into a separate function
shouldUnindentNextOperator.

The logic for finding the continuation indentation when the option
AlignAfterOpenBracket is set to DontAlign is not implemented yet. So in
that case the new line may have the wrong indentation, and the parts may
have the wrong length if the string needs to be broken more than once
because finding where to break the string depends on where the string
starts.

The preambles for the C# and Java unit tests are changed to the newer
style in order to allow the 3-argument verifyFormat macro. Some cases
are changed from verifyFormat to verifyImcompleteFormat because those
use incomplete code and the new verifyFormat function checks that the
code is complete.

The line in the doc was changed to being indented by 4 spaces, that is,
the default continuation indentation. It has always been the case. It
was probably a mistake that the doc showed 2 spaces previously.

Reviewed By: MyDeveloperDay

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

show more ...


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


# cc2ff02e 15-Jul-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Correctly annotate overloaded operator function name

The operator keyword preceded by a template closer should be annotated as
TT_FunctionDeclarationName.

Fixes #63879.

Differential

[clang-format] Correctly annotate overloaded operator function name

The operator keyword preceded by a template closer should be annotated as
TT_FunctionDeclarationName.

Fixes #63879.

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

show more ...


# 3f3620e5 30-Jun-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Correctly annotate */&/&& in operator function calls

Reverts 4986f3f2f220 (but keeps its unit tests) and fixes #49973
differently.

Also fixes bugs that incorrectly annotate the opera

[clang-format] Correctly annotate */&/&& in operator function calls

Reverts 4986f3f2f220 (but keeps its unit tests) and fixes #49973
differently.

Also fixes bugs that incorrectly annotate the operator keyword as
TT_FunctionDeclarationName in function calls and as TT_Unknown in function
declarations and definitions.

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

show more ...


# 4986f3f2 29-Jun-2023 Emilia Kond <emilia@rymiel.space>

[clang-format] Correctly annotate operator free function call

The annotator correctly annotates an overloaded operator call when
called as a member function, like `x.operator+(y)`, however, when cal

[clang-format] Correctly annotate operator free function call

The annotator correctly annotates an overloaded operator call when
called as a member function, like `x.operator+(y)`, however, when called
as a free function, like `operator+(x, y)`, the annotator assumed it was
an overloaded operator function *declaration*, instead of a call.

This patch allows for a free function call to correctly be annotated as
a call, but only if the current like cannot be a declaration, usually
within the bodies of a function.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay, Nuullll

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

show more ...


12345678910