History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 401 – 425 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 960712cc 20-Dec-2021 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Fix wrong indentation of namespace identifiers after a concept declaration.

Before this patch, the code:
```
template <class T>
concept a_concept = X<>;
namespace B {
struct b_struct

[clang-format] Fix wrong indentation of namespace identifiers after a concept declaration.

Before this patch, the code:
```
template <class T>
concept a_concept = X<>;
namespace B {
struct b_struct {};
} // namespace B
```
with config:
```
NamespaceIndentation: None
```

was wrongly indented inside namespace B, giving:
```
template <class T>
concept a_concept = X<>;
namespace B {
struct b_struct {};
} // namespace B
```

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

Reviewed By: MyDeveloperDay, owenpan

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

show more ...


# 3a3fcd6a 19-Dec-2021 Krasimir Georgiev <krasimir@google.com>

[clang-format] add regression tests for braced lists

Depends on https://reviews.llvm.org/D116000.

Added test cases from the comments on https://reviews.llvm.org/D114583.

Reviewed By: MyDeveloperDa

[clang-format] add regression tests for braced lists

Depends on https://reviews.llvm.org/D116000.

Added test cases from the comments on https://reviews.llvm.org/D114583.

Reviewed By: MyDeveloperDay

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

show more ...


# d96bf6ea 19-Dec-2021 Krasimir Georgiev <krasimir@google.com>

Revert "[clang-format] Adjust braced list detection"

It appears that this regressed the formatting of initializer lists in some
cases, see comments on https://reviews.llvm.org/D114583. I'll follow-u

Revert "[clang-format] Adjust braced list detection"

It appears that this regressed the formatting of initializer lists in some
cases, see comments on https://reviews.llvm.org/D114583. I'll follow-up
by adding regression tests for these.

This reverts commit c41b3b0fa0f4f70aad8deaf48bcd42a04385066c.

Reviewed By: MyDeveloperDay

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

show more ...


# 3362fa59 18-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] extern with new line brace without indentation

https://github.com/llvm/llvm-project/issues/49804

Interaction between IndentExternBlock and AfterExternBlock means you cannot have Afte

[clang-format] extern with new line brace without indentation

https://github.com/llvm/llvm-project/issues/49804

Interaction between IndentExternBlock and AfterExternBlock means you cannot have AfterExternBlock = true and IndentExternBlock = NoIndent/Indent

This patch resolves that
```
BraceWrapping:
AfterExternBlock: true
IndentExternBlock: AfterExternBlock
```
Fixes: #49804

Reviewed By: HazardyKnusperkeks, curdeius, owenpan

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

show more ...


# 936a67f0 17-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] Extra spaces surrounding arrow in templated member call in variable decl

https://github.com/llvm/llvm-project/issues/43196

Fixes #43196

-> is incorrectly interpreted as a TrailingRe

[clang-format] Extra spaces surrounding arrow in templated member call in variable decl

https://github.com/llvm/llvm-project/issues/43196

Fixes #43196

-> is incorrectly interpreted as a TrailingReturnArrow if we've seen an auto

```
auto p = new A;
auto x = p -> foo<1>();
```

Reviewed By: curdeius

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

show more ...


# 62ead365 17-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] Formatter does not handle c++11 string literal prefix with stringize #

https://github.com/llvm/llvm-project/issues/27740

Ensure
```
```
behave the same as
```
```

when formatted, en

[clang-format] Formatter does not handle c++11 string literal prefix with stringize #

https://github.com/llvm/llvm-project/issues/27740

Ensure
```
```
behave the same as
```
```

when formatted, ensure clang-format follows the conventions for `L` `u` `U` `u8`

https://docs.microsoft.com/en-us/cpp/cpp/string-and-character-literals-cpp?redirectedfrom=MSDN&view=msvc-170

Fixes #27740

Reviewed By: curdeius, owenpan

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

show more ...


# 2b671c3f 16-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] add support for branch attribute macros

https://github.com/llvm/llvm-project/issues/49184

clang-format doesn't handle the use of AttributeMacros where `[[unlikely]]` / `[[likely]]` c

[clang-format] add support for branch attribute macros

https://github.com/llvm/llvm-project/issues/49184

clang-format doesn't handle the use of AttributeMacros where `[[unlikely]]` / `[[likely]]` could be used in `if` statements

This was not covered in the original commit {{D80144}}

Fixes #49184

Reviewed By: curdeius, owenpan

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

show more ...


# 27818f01 15-Dec-2021 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Fix tabs when using BreakBeforeTernaryOperators=false.

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

This is rather a workaround than a correct fix. To properly fix it, we

[clang-format] Fix tabs when using BreakBeforeTernaryOperators=false.

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

This is rather a workaround than a correct fix. To properly fix it, we'd need to find a better way to tell when not to decrease the StartOfTokenColumn.

Reviewed By: MyDeveloperDay, owenpan

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

show more ...


# a94aab12 15-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] put non-empty catch block on one line with AllowShortBlocksOnASingleLine: Empty

https://github.com/llvm/llvm-project/issues/52715

Fixes #52715

`AllowShortBlocksOnASingleLine` seems

[clang-format] put non-empty catch block on one line with AllowShortBlocksOnASingleLine: Empty

https://github.com/llvm/llvm-project/issues/52715

Fixes #52715

`AllowShortBlocksOnASingleLine` seems to never be checked for "Empty" as such if its used it will be considered "Always" as we only ever check `AllowShortBlocksOnASingleLine != Never`

This impacts C++ as well as C# hence the slightly duplicated test.

Reviewed By: curdeius, jbcoe

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

show more ...


# 2a73a1ac 09-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] PR48916 PointerAlignment not working when using C++20 init-statement in for loop

https://bugs.llvm.org/show_bug.cgi?id=48916

Left and Right Alignment inside a loop is misaligned.

Re

[clang-format] PR48916 PointerAlignment not working when using C++20 init-statement in for loop

https://bugs.llvm.org/show_bug.cgi?id=48916

Left and Right Alignment inside a loop is misaligned.

Reviewed By: HazardyKnusperkeks, curdeius

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

show more ...


# c41b3b0f 06-Dec-2021 Tan S. B <cpplearner@outlook.com>

[clang-format] Adjust braced list detection

This avoids mishandling nested compound statements that are followed by another compound statement.

Fixes https://llvm.org/PR38314 and https://llvm.org/P

[clang-format] Adjust braced list detection

This avoids mishandling nested compound statements that are followed by another compound statement.

Fixes https://llvm.org/PR38314 and https://llvm.org/PR48305.

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

show more ...


# 57b95aed 02-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] Add better support for co-routinues

Responding to a Discord call to help {D113977} and heavily inspired by the unlanded {D34225} add some support to help coroutinues from not being fo

[clang-format] Add better support for co-routinues

Responding to a Discord call to help {D113977} and heavily inspired by the unlanded {D34225} add some support to help coroutinues from not being formatted from

```for co_await(auto elt : seq)```

to

```
for
co_await(auto elt : seq)
```

Because of the dominance of clang-format in the C++ community, I don't think we should make it the blocker that prevents users from embracing the newer parts of the standard because we butcher the layout of some of the new constucts.

Reviewed By: HazardyKnusperkeks, Quuxplusone, ChuanqiXu

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

show more ...


# d688b316 01-Dec-2021 Manuel Klimek <klimek@google.com>

Fix segfault in clang-format.

Fix bug where we'd read past the end of the tokens after merging _T
macro strings.


# 59788422 01-Dec-2021 Manuel Klimek <klimek@google.com>

Fix clang-format bug when handling conflict markers.

Previously, clang-format would not correctly identify preprocessor
directives directly following a conflict marker, which would result in
violati

Fix clang-format bug when handling conflict markers.

Previously, clang-format would not correctly identify preprocessor
directives directly following a conflict marker, which would result in
violating the formatter's invariants.

The provided test fails in assert mode before this change.

show more ...


# 814aabae 29-Nov-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] regressed default behavior for operator parentheses

{D110833} regressed behavior of spaces before parentheses for operators, this revision reverts that so that operators are handled a

[clang-format] regressed default behavior for operator parentheses

{D110833} regressed behavior of spaces before parentheses for operators, this revision reverts that so that operators are handled as they were before.

I think in hindsight it was a mistake to try and consume operator behaviour in with the function behaviour, I think Operators can be considered a special style. Its seems the code is getting confused as to if this is a function declaration or definition.

I think latterly we can consider adding an operator parentheses specific custom option but this should have been explicitly called out as it can impact projects.

Reviewed By: HazardyKnusperkeks, curdeius

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

show more ...


# 813d486c 25-Nov-2021 Jesses Gott <jesses.gott.na+llvm@gmail.com>

[clang-format] Extend AllowShortBlocksOnASingleLine for else blocks

Extend AllowShortBlocksOnASingleLine for else blocks. See https://bugs.llvm.org/show_bug.cgi?id=49722

Reviewed By: HazardyKnusper

[clang-format] Extend AllowShortBlocksOnASingleLine for else blocks

Extend AllowShortBlocksOnASingleLine for else blocks. See https://bugs.llvm.org/show_bug.cgi?id=49722

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

show more ...


# c2fe2b5a 25-Nov-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] [C++20] [Module] clang-format couldn't recognize partitions

https://bugs.llvm.org/show_bug.cgi?id=52517

clang-format is butchering modules, this could easily become a barrier to entr

[clang-format] [C++20] [Module] clang-format couldn't recognize partitions

https://bugs.llvm.org/show_bug.cgi?id=52517

clang-format is butchering modules, this could easily become a barrier to entry for modules given clang-formats wide spread use.

Prevent the following from adding spaces around the `:` (cf was considering the ':' as an InheritanceColon)

Reviewed By: HazardyKnusperkeks, owenpan, ChuanqiXu

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

show more ...


# c94667a8 25-Nov-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] [PR52595] clang-format does not recognize rvalue references to array

https://bugs.llvm.org/show_bug.cgi?id=52595

missing space between `T(&&)` but not between `T (&` due to && being

[clang-format] [PR52595] clang-format does not recognize rvalue references to array

https://bugs.llvm.org/show_bug.cgi?id=52595

missing space between `T(&&)` but not between `T (&` due to && being incorrectly thought of as `UnaryOperator` rather than `PointerOrReference`

```
int operator()(T (&)[N]) { return 0; }
int operator()(T(&&)[N]) { return 1; }
```

Existing Unit tests are changed because actually I think they are originally incorrect, and are inconsistent with the (&) cases that are 4 or 5 lines above them.

Reviewed By: curdeius

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

show more ...


# 72e4f4a2 25-Nov-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] [PR47936] AfterControlStatement: MultiLine breaks AllowShortFunctionsOnASingleLine

https://bugs.llvm.org/show_bug.cgi?id=47936

Using the MultiLine setting for BraceWrapping.AfterCont

[clang-format] [PR47936] AfterControlStatement: MultiLine breaks AllowShortFunctionsOnASingleLine

https://bugs.llvm.org/show_bug.cgi?id=47936

Using the MultiLine setting for BraceWrapping.AfterControlStatement appears to disable AllowShortFunctionsOnASingleLine, even in cases without any control statements

Reviewed By: HazardyKnusperkeks, curdeius

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

show more ...


# e7cb3283 23-Nov-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] [PR52527] can join * with /* to form an outside of comment error C4138

https://bugs.llvm.org/show_bug.cgi?id=52527

The follow patch ensures there is always a space between * and /* t

[clang-format] [PR52527] can join * with /* to form an outside of comment error C4138

https://bugs.llvm.org/show_bug.cgi?id=52527

The follow patch ensures there is always a space between * and /* to prevent transforming
```
void foo(* /* comment */)(int bar);
```
into
```
void foo(*/* comment */)(int bar);
```

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

show more ...


# fce3eed9 14-Nov-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format][c++2b] support removal of the space between auto and {} in P0849R8

Looks like the work of {D113393} requires manual clang-formatting intervention.
Removal of the space between `auto`

[clang-format][c++2b] support removal of the space between auto and {} in P0849R8

Looks like the work of {D113393} requires manual clang-formatting intervention.
Removal of the space between `auto` and `{}`

Reviewed By: HazardyKnusperkeks, Quuxplusone

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

show more ...


# 6facafe7 07-Nov-2021 C. Rayroud <rayroudc@gmail.com>

[clang-format] Refactor SpaceBeforeParens to add options

The coding style of some projects requires to have more control on space
before opening parentheses.
The goal is to add the support of clang-

[clang-format] Refactor SpaceBeforeParens to add options

The coding style of some projects requires to have more control on space
before opening parentheses.
The goal is to add the support of clang-format to more projects.
For example adding a space only for function definitions or
declarations.
This revision adds SpaceBeforeParensOptions to configure each option
independently from one another.

Differentiel Revision: https://reviews.llvm.org/D110833

show more ...


# 3d209c76 02-Oct-2021 Josh Learn <joshua_learn@apple.com>

[clang-format] Constructor initializer lists format with pp directives

Currently constructor initializer lists sometimes format incorrectly
when there is a preprocessor directive in the middle of th

[clang-format] Constructor initializer lists format with pp directives

Currently constructor initializer lists sometimes format incorrectly
when there is a preprocessor directive in the middle of the list.
This patch fixes the issue when parsing the initilizer list by
ignoring the preprocessor directive when checking if a block is
part of an initializer list.

rdar://82554274

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

show more ...


# a36227cb 25-Sep-2021 Fred Grim <fgrim@apple.com>

fixes bug #51926 where dangling comma caused overrun

bug 51926 identified an issue where a dangling comma caused the cell count to be to off by one

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

fixes bug #51926 where dangling comma caused overrun

bug 51926 identified an issue where a dangling comma caused the cell count to be to off by one

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

show more ...


Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4
# a44ab170 23-Sep-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] Add Left/Right Const fixer capability

Developers these days seem to argue over east vs west const like they used to argue over tabs vs whitespace or the various bracing style. These p

[clang-format] Add Left/Right Const fixer capability

Developers these days seem to argue over east vs west const like they used to argue over tabs vs whitespace or the various bracing style. These previous arguments were mainly eliminated with tools like `clang-format` that allowed those rules to become part of your style guide. Anyone who has been using clang-format in a large team over the last couple of years knows that we don't have those religious arguments any more, and code reviews are more productive.

https://www.youtube.com/watch?v=fv--IKZFVO8
https://mariusbancila.ro/blog/2018/11/23/join-the-east-const-revolution/
https://www.youtube.com/watch?v=z6s6bacI424

The purpose of this revision is to try to do the same for the East/West const discussion. Move the debate into the style guide and leave it there!

In addition to the new `ConstStyle: Right` or `ConstStyle: Left` there is an additional command-line argument `--const-style=left/right` which would allow an individual developer to switch the source back and forth to their own style for editing, and back to the committed style before commit. (you could imagine an IDE might offer such a switch)

The revision works by implementing a separate pass of the Annotated lines much like the SortIncludes and then create replacements for constant type declarations.

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

show more ...


1...<<11121314151617181920>>...82