History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 151 – 175 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# c669541c 25-Jul-2023 Gedare Bloom <gedare@rtems.org>

[clang-format] Add SpacesInParens with SpacesInParensOptions

This is a refactoring of:
- SpacesInConditionalStatement
- SpacesInCStyleCastParentheses
- SpaceInEmptyParentheses
- SpacesInParentheses

[clang-format] Add SpacesInParens with SpacesInParensOptions

This is a refactoring of:
- SpacesInConditionalStatement
- SpacesInCStyleCastParentheses
- SpaceInEmptyParentheses
- SpacesInParentheses

These are now options under the new Style Option: SpacesInParens. The
existing options are maintained for backward compatibility.

Within SpacesInParens, there are currently options for:
- Never
- Custom

The currently available options for Custom are:
- InConditionalStatements
- InCStyleCasts
- InEmptyParentheses
- Other

Setting InConditionalStatements and Other to true enables the same space
additions as SpacesInParentheses.

This refactoring does not add or remove any existing features, but it makes
it possible to more easily extend and maintain the addition of spaces within
parentheses.

Related to #55428.

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

show more ...


# 74720d1b 25-Jul-2023 Galen Elias <galenelias@gmail.com>

[clang-format] Add AlignConsecutiveShortCaseStatements

This adds a new AlignConsecutiveShortCaseStatements option in line with the
existing AlignConsecutive* options , which when
AllowShortCaseLabel

[clang-format] Add AlignConsecutiveShortCaseStatements

This adds a new AlignConsecutiveShortCaseStatements option in line with the
existing AlignConsecutive* options , which when
AllowShortCaseLabelsOnASingleLine is enabled will align the tokens after the
case statement's colon. This also adds a AlignCaseColons option to allow
aligning the case label colon itself rather than the token after it.

Fixes #55475.

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

show more ...


# 87ad34ff 25-Jul-2023 Owen Pan <owenpiano@gmail.com>

Revert "[clang-format] Add AlignConsecutiveShortCaseStatements"

This reverts commit 4ba00844174db562d2bd8b15dab6aac605eddf57.


# ac6e5514 25-Jul-2023 Owen Pan <owenpiano@gmail.com>

Revert "Revert "[clang-format] Add AlignConsecutiveShortCaseStatements""

This reverts commit 4f093b31669a4f8e417259583141159586a05b28.


# 4f093b31 25-Jul-2023 Owen Pan <owenpiano@gmail.com>

Revert "[clang-format] Add AlignConsecutiveShortCaseStatements"

This reverts commit 4ba00844174db562d2bd8b15dab6aac605eddf57 due to missing
authorship.


# 4ba00844 25-Jul-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Add AlignConsecutiveShortCaseStatements

This adds a new AlignConsecutiveShortCaseStatements option in line with the
existing AlignConsecutive* options , which when
AllowShortCaseLabel

[clang-format] Add AlignConsecutiveShortCaseStatements

This adds a new AlignConsecutiveShortCaseStatements option in line with the
existing AlignConsecutive* options , which when
AllowShortCaseLabelsOnASingleLine is enabled will align the tokens after the
case statement's colon. This also adds a AlignCaseColons option to allow
aligning the case label colon itself rather than the token after it.

Fixes #55475.

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

show more ...


# 63d6659a 14-Jul-2023 Jared Grubb <jaredgrubb+github@gmail.com>

[clang-format] Fix support for ObjC blocks with pointer return types

The ObjC-block detection code only supports a single token as the return type. Add support to detect pointers, too (ObjC has lots

[clang-format] Fix support for ObjC blocks with pointer return types

The ObjC-block detection code only supports a single token as the return type. Add support to detect pointers, too (ObjC has lots of object-pointers).

For example, using `BasedOnStyle: WebKit`, the following is stable output:

```
int* p = ^int*(void)
{ //
return nullptr;
}
();
```

After the patch, this is stable:

```
int* p = ^int*(void) { //
return nullptr;
}();
```

Differential Review: https://reviews.llvm.org/D146434

show more ...


# 3a6a0702 05-Jul-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Add an option to remove redundant parentheses

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


# 413a7cb6 06-Jul-2023 Gedare Bloom <gedare@rtems.org>

[clang-format] Support block indenting array/struct list initializers

C89 and C99 list initializers are treated differently than Cpp11 braced
initializers. This patch identifies the C array/struct i

[clang-format] Support block indenting array/struct list initializers

C89 and C99 list initializers are treated differently than Cpp11 braced
initializers. This patch identifies the C array/struct initializer lists by
finding the preceding equal sign before a left brace, and applies formatting
rules for BracketAlignmentStyle.BlockIndent to those list initializers.

Fixes #57878.

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

show more ...


# a84e0b4b 06-Jul-2023 Gedare Bloom <gedare@rtems.org>

[clang-format] Fix align consecutive declarations over function pointers

Fixes a bug that prevents alignment from proceeding through a function
pointer in a list of declarations.

Fixes #63451.

Dif

[clang-format] Fix align consecutive declarations over function pointers

Fixes a bug that prevents alignment from proceeding through a function
pointer in a list of declarations.

Fixes #63451.

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

show more ...


# 6b8a9ff7 06-Jul-2023 Gedare Bloom <gedare@rtems.org>

[clang-format] Fix RAS reference alignment when PAS is left or middle

Fixes a bug with the handling of right aligned references with left/middle
alignment pointers.

Fixes #63452.

Differential Revi

[clang-format] Fix RAS reference alignment when PAS is left or middle

Fixes a bug with the handling of right aligned references with left/middle
alignment pointers.

Fixes #63452.

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

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


# 6e39b0dd 26-Jun-2023 Emilia Kond <emilia@rymiel.space>

[clang-format][NFC] Use correct test method for new tests

7a38b3bfeb56 landed after 20b4df1ed611, which refactored how tests are
structured in FormatTest. This quick fix-up unifies the tests added i

[clang-format][NFC] Use correct test method for new tests

7a38b3bfeb56 landed after 20b4df1ed611, which refactored how tests are
structured in FormatTest. This quick fix-up unifies the tests added in
7a38b3bfeb56 to comply with this new format.

show more ...


# 7a38b3bf 23-Jun-2023 Emilia Kond <emilia@rymiel.space>

[clang-format] Respect ColumnLimit 0 line breaks in inline asm

Previously, using ColumnLimit: 0 with extended inline asm with the
BreakBeforeInlineASMColon: OnlyMultiline option (the default style),

[clang-format] Respect ColumnLimit 0 line breaks in inline asm

Previously, using ColumnLimit: 0 with extended inline asm with the
BreakBeforeInlineASMColon: OnlyMultiline option (the default style),
the formatter would act as if in Always mode, meaning a line break was
added before every colon in an extended inline assembly block.

This patch respects the already existing line breaks, and doesn't add
any new ones, if in ColumnLimit 0 mode.

Behaviour with Always stays as expected, with a break before every colon
regardless of any existing line breaks.

Behaviour with Never was broken before, and remains broken with this patch,
it is just never respected in ColumnLimit 0 mode.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


# 8e85739a 19-Jun-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Don't finalize #if, #else, #endif, etc.

Don't finalize a preprocessor branch directive if it's the first
token of an annotated line. See the rationale at
https://reviews.llvm.org/D150

[clang-format] Don't finalize #if, #else, #endif, etc.

Don't finalize a preprocessor branch directive if it's the first
token of an annotated line. See the rationale at
https://reviews.llvm.org/D150057#inline-1449546.

Fixes #63379

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

show more ...


# 8411bdb0 17-Jun-2023 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Remove redundant getLLVMStyle() in unit tests


# 441108cc 14-Jun-2023 Owen Pan <owenpiano@gmail.com>

Reland [clang-format] Fix overlapping whitespace replacements before PPDirective

If the first token of an annotated line already has a computed Newlines,
reuse it to avoid potential overlapping whit

Reland [clang-format] Fix overlapping whitespace replacements before PPDirective

If the first token of an annotated line already has a computed Newlines,
reuse it to avoid potential overlapping whitespace replacements before
preprocessor branching directives.

Fixes #62892.

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

show more ...


# 926e1faa 16-Jun-2023 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Use verifyGoogleFormat in FormatTest.cpp

Replaces verifyFormat(..., getGoogleStyle()) with
verifyGoogleFormat(...) in FormatTest.cpp.


# 20b4df1e 16-Jun-2023 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Clean up unit tests

This patch adds a verifyNoChange macro to verify code that won't
change after being formatted. (The code will not be messed up before
being formatted.) It the

[clang-format][NFC] Clean up unit tests

This patch adds a verifyNoChange macro to verify code that won't
change after being formatted. (The code will not be messed up before
being formatted.) It then replaces EXPECT_EQ with verifyFormat
wherever applicable so that the code will be messed up before being
formatted. When the replacement fails the unit test, verifyFormat is
replaced with verifyNoChange.

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

show more ...


# 829ed96b 13-Jun-2023 Owen Pan <owenpiano@gmail.com>

Reland [clang-format] Add the KeepEmptyLinesAtEOF option


# b6a71801 08-Jun-2023 Paul Kirth <paulkirth@google.com>

[clang-format] Add test case for issue 63170

After https://reviews.llvm.org/D151954 we've noticed some issues w/
clang-format behavior, as outlined in
https://github.com/llvm/llvm-project/issues/631

[clang-format] Add test case for issue 63170

After https://reviews.llvm.org/D151954 we've noticed some issues w/
clang-format behavior, as outlined in
https://github.com/llvm/llvm-project/issues/63170.

Valid C/C++ files, that were previously accepted, are now rejected by
clang-format, emitting the message:

"The new replacement overlaps with an existing replacement."

This reverts commit 4b9764959dc4b8783e18747c1742ab164e4bc4ee and
d2627cf88d2553a4c2e850430bdb908a4b7d2e52, which depends on it.

Reviewed By: phosek

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

show more ...


# 9f00eb99 08-Jun-2023 Leonard Chan <leonardchan@google.com>

Revert "Revert "[clang-format] Fix overlapping replacements before PPDirectives""

This reverts commit 94e75469597f197f9c4b45baa6c8a576c78dbd02.

Apparently I broke some builders with the original re

Revert "Revert "[clang-format] Fix overlapping replacements before PPDirectives""

This reverts commit 94e75469597f197f9c4b45baa6c8a576c78dbd02.

Apparently I broke some builders with the original revert: http://45.33.8.238/linux/109159/step_7.txt

show more ...


# 94e75469 07-Jun-2023 Leonard Chan <leonardchan@google.com>

Revert "[clang-format] Fix overlapping replacements before PPDirectives"

This reverts commit 4b9764959dc4b8783e18747c1742ab164e4bc4ee.

Reverting since this causes clang-formtat to incorrectly fall

Revert "[clang-format] Fix overlapping replacements before PPDirectives"

This reverts commit 4b9764959dc4b8783e18747c1742ab164e4bc4ee.

Reverting since this causes clang-formtat to incorrectly fall into an
error path yet return a zero exit code despite not formatting the file
at all.

See https://github.com/llvm/llvm-project/issues/63170

show more ...


# d2627cf8 06-Jun-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Add the KeepEmptyLinesAtEOF option

Adds an option KeepEmptyLinesAtEOF to keep empty lines (up to
MaxEmptyLinesToKeep) before EOF. This remedies the probably unintentional
change in be

[clang-format] Add the KeepEmptyLinesAtEOF option

Adds an option KeepEmptyLinesAtEOF to keep empty lines (up to
MaxEmptyLinesToKeep) before EOF. This remedies the probably unintentional
change in behavior introduced in 3d3ea84a4f8f, which started to always
remove empty lines before EOF.

Fixes #56054.
Fixes #63150.

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

show more ...


12345678910>>...82