History log of /llvm-project/clang/lib/Format/WhitespaceManager.cpp (Results 76 – 100 of 183)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 545317cb 01-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Use ranged for loops. NFC.


# fd33cca7 01-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Fix AlignConsecutiveAssignments breaking lambda formatting.

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

This patch fixes the formatting of the code:
```
auto aaaaaaaaaaa

[clang-format] Fix AlignConsecutiveAssignments breaking lambda formatting.

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

This patch fixes the formatting of the code:
```
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b = g([] {
return;
});
```
which should be left as is, but before this patch was formatted to:
```
auto aaaaaaaaaaaaaaaaaaaaa = {};
auto b = g([] {
return;
});
```

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

show more ...


Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3
# 480a1fab 19-Jan-2022 Elliott Maguire <glotchimo@pm.me>

[clang-format] Fix incorrect alignment of operator= overloads.

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

Added a check for operator keyword tokens.

Reviewed By: MyDeveloperDay, curd

[clang-format] Fix incorrect alignment of operator= overloads.

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

Added a check for operator keyword tokens.

Reviewed By: MyDeveloperDay, curdeius, owenpan, HazardyKnusperkeks

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

show more ...


Revision tags: llvmorg-13.0.1-rc2
# 359b4e6c 07-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Use prefix increment and decrement. NFC.


# 5109737c 05-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Fix indentation for array variables with alignment of consecutive assignments and declarations.

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

Reviewed By: HazardyKnusperke

[clang-format] Fix indentation for array variables with alignment of consecutive assignments and declarations.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


# 6f6f88ff 28-Dec-2021 ksyx <18738953+ksyx@users.noreply.github.com>

[clang-format] Style to separate definition blocks

This commit resolves GitHub issue #45895 (Bugzilla #46550), to
add or remove empty line between definition blocks including
namespaces, classes, st

[clang-format] Style to separate definition blocks

This commit resolves GitHub issue #45895 (Bugzilla #46550), to
add or remove empty line between definition blocks including
namespaces, classes, structs, enums and functions.

Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks

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

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


# 93fc9161 24-Nov-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

The following 2 commits caused files in clang-format to no longer be clang-formatted.

we would lose our "cle

[clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

The following 2 commits caused files in clang-format to no longer be clang-formatted.

we would lose our "clean" status https://releases.llvm.org/13.0.0/tools/clang/docs/ClangFormattedStatus.html

c2271926a4fc - Make clang-format fuzz through Lexing with asserts enabled (https://github.com/llvm/llvm-project/commit/c2271926a4fc )

84bf5e328664 - Fix various problems found by fuzzing. (https://github.com/llvm/llvm-project/commit/84bf5e328664)

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


Revision tags: llvmorg-13.0.1-rc1
# 84bf5e32 22-Nov-2021 Manuel Klimek <klimek@google.com>

Fix various problems found by fuzzing.

1. IndexTokenSource::getNextToken cannot return nullptr; some code was
still written assuming it can; make getNextToken more resilient against
incorrect input

Fix various problems found by fuzzing.

1. IndexTokenSource::getNextToken cannot return nullptr; some code was
still written assuming it can; make getNextToken more resilient against
incorrect input and fix its call-sites.

2. Change various asserts that can happen due to user provided input to
conditionals in the code.

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, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init
# 75f6a795 25-Jul-2021 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Fix aligning with linebreaks #2

This amends c5243c63cda3c740d6e9c7e501f6518c21688da3 to fix formatting
continued function calls with BinPacking = false.

Differential Revision: https:

[clang-format] Fix aligning with linebreaks #2

This amends c5243c63cda3c740d6e9c7e501f6518c21688da3 to fix formatting
continued function calls with BinPacking = false.

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

show more ...


Revision tags: llvmorg-12.0.1, llvmorg-12.0.1-rc4
# ee3b2c47 26-Jun-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

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

AlignConsecutiveAssignments/Declarations cause incorrect a

[clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

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

AlignConsecutiveAssignments/Declarations cause incorrect alignment in the presence of a DesignatedInitializerPeriod (https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html)

```
static NTSTATUS stg(PLW_STREAM Stream, int identity)
{
NTSTATUS status;
BYTE payload[256] = {'l', 'h', 'o', 't', 's', 'e'};
struct dm_rpc_header header = {.drh_magic = DRH_MAGIC,
.drh_op_code = RPC_OP_ECHO,
.drh_payload_size = sizeof(payload),
.drh_body_size = sizeof(payload),
.drh_request_id = 1};
header.drh_version = identity;
```

This fix addresses that by ensuring the period isn't ignored

Reviewed By: HazardyKnusperkeks

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

show more ...


Revision tags: llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2
# d650ccf6 14-Jun-2021 Vitaly Buka <vitalybuka@google.com>

[NFC] Remove unused variable

To fix 'set but not used' warning on sanitizer-x86_64-linux-android bot.


# 673c5ba5 13-Jun-2021 Fred Grim <fgrim@apple.com>

[clang-format] Adds a formatter for aligning arrays of structs

This adds a new formatter to arrange array of struct initializers into
neat columns.

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

[clang-format] Adds a formatter for aligning arrays of structs

This adds a new formatter to arrange array of struct initializers into
neat columns.

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

show more ...


# 3e333cc8 03-Jun-2021 Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>

[clang-format] Fix PointerAlignmentRight with AlignConsecutiveDeclarations

This re-applies the old patch D27651, which was never landed, into the
latest "main" branch, without understanding the code

[clang-format] Fix PointerAlignmentRight with AlignConsecutiveDeclarations

This re-applies the old patch D27651, which was never landed, into the
latest "main" branch, without understanding the code. I just applied
the changes "mechanically" and made it compiling again.

This makes the right pointer alignment working as expected.
Fixes https://llvm.org/PR27353

For instance

const char* const* v1;
float const* v2;
SomeVeryLongType const& v3;

was formatted as

const char *const * v1;
float const * v2;
SomeVeryLongType const &v3;

This patch keep the *s or &s aligned to the right, next to their variable.
The above example is now formatted as

const char *const *v1;
float const *v2;
SomeVeryLongType const &v3;

It is a pity that this still does not work with clang-format in 2021,
even though there was a fix available in 2016. IMHO right pointer alignment
is the default case in C, because syntactically the pointer belongs to the
variable.

See

int* a, b, c; // wrong, just the 1st variable is a pointer

vs.

int *a, *b, *c; // right

Prominent example is the Linux kernel coding style.

Some styles argue the left pointer alignment is better and declaration
lists as shown above should be avoided. That's ok, as different projects
can use different styles, but this important style should work too.

I hope that somebody that has a better understanding about the code,
can take over this patch and land it into main.

For now I must maintain this fork to make it working for our projects.

Cheers,
Gerhard.

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

show more ...


Revision tags: llvmorg-12.0.1-rc1
# 5987d7c5 22-Apr-2021 Krasimir Georgiev <krasimir@google.com>

[clang-format] fix indent in alignChainedConditionals

Clang-format was indenting the lines following the `?` in the added test
case by +5 instead of +4. This only happens in a very specific
situatio

[clang-format] fix indent in alignChainedConditionals

Clang-format was indenting the lines following the `?` in the added test
case by +5 instead of +4. This only happens in a very specific
situation, where the `?` is followed by a multiline block comment, as in
the example. This fix addresses this without regressing any of the
existing tests.

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

show more ...


Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4
# c5243c63 10-Mar-2021 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Fix aligning with linebreaks

Breaking a string literal or a function calls arguments with
AlignConsecutiveDeclarations or AlignConsecutiveAssignments did misalign
the continued line.

[clang-format] Fix aligning with linebreaks

Breaking a string literal or a function calls arguments with
AlignConsecutiveDeclarations or AlignConsecutiveAssignments did misalign
the continued line. E.g.:

void foo() {
int myVar = 5;
double x = 3.14;
auto str = "Hello"
"World";
}

or

void foo() {
int myVar = 5;
double x = 3.14;
auto str = "Hello"
"World";
}

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

show more ...


Revision tags: llvmorg-12.0.0-rc3
# e0b1df92 27-Feb-2021 Darwin Xu <darwin.xu@icloud.com>

[clang-format] Fix AlignConsecutiveDeclarations handling of pointers

This is a bug fix of https://bugs.llvm.org/show_bug.cgi?id=49175

The expected code format:

unsigned int* a;
int*

[clang-format] Fix AlignConsecutiveDeclarations handling of pointers

This is a bug fix of https://bugs.llvm.org/show_bug.cgi?id=49175

The expected code format:

unsigned int* a;
int* b;
unsigned int Const* c;

The actual code after formatting (without this patch):

unsigned int* a;
int* b;
unsigned int Const* c;

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

show more ...


Revision tags: llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init
# 25631471 25-Jan-2021 Lukas Barth <mail@lukas-barth.net>

[clang-format] Add the possibility to align assignments spanning empty lines or comments

Currently, empty lines and comments break alignment of assignments on consecutive
lines. This makes the Align

[clang-format] Add the possibility to align assignments spanning empty lines or comments

Currently, empty lines and comments break alignment of assignments on consecutive
lines. This makes the AlignConsecutiveAssignments option an enum that allows controlling
whether empty lines or empty lines and comments should be ignored when aligning
assignments.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, tinloaf

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

show more ...


# 7b9d88ab 25-Jan-2021 Marek Kurdej <marek.kurdej@gmail.com>

Revert "[clang-format] Add the possibility to align assignments spanning empty lines or comments"

This reverts commit f00a20e51c1d186e72844939aad10416e1cc99de.


# f00a20e5 25-Jan-2021 Marek Kurdej <marek.kurdej@gmail.com>

[clang-format] Add the possibility to align assignments spanning empty lines or comments

Currently, empty lines and comments break alignment of assignments on consecutive
lines. This makes the Align

[clang-format] Add the possibility to align assignments spanning empty lines or comments

Currently, empty lines and comments break alignment of assignments on consecutive
lines. This makes the AlignConsecutiveAssignments option an enum that allows controlling
whether empty lines or empty lines and comments should be ignored when aligning
assignments.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, tinloaf

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

show more ...


Revision tags: llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1
# bcc1dee6 23-Dec-2020 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Add StatementAttributeLikeMacros option

This allows to ignore for example Qts emit when
AlignConsecutiveDeclarations is set, otherwise it is parsed as a type
and it results in some mi

[clang-format] Add StatementAttributeLikeMacros option

This allows to ignore for example Qts emit when
AlignConsecutiveDeclarations is set, otherwise it is parsed as a type
and it results in some misformating:

unsigned char MyChar = 'x';
emit signal(MyChar);

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

show more ...


Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1
# b9e78944 17-Oct-2020 Sylvestre Ledru <sylvestre@debian.org>

Revert "[clang-format] Fix AlignConsecutive on PP blocks"

This reverts commit b2eb439317576ce718193763c12bff9fccdfc166.

Caused the regression:
https://bugs.llvm.org/show_bug.cgi?id=47589

Reviewed

Revert "[clang-format] Fix AlignConsecutive on PP blocks"

This reverts commit b2eb439317576ce718193763c12bff9fccdfc166.

Caused the regression:
https://bugs.llvm.org/show_bug.cgi?id=47589

Reviewed By: MyDeveloperDay

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

show more ...


Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1
# f5acd11d 27-Jul-2020 Bruno Ricci <riccibrun@gmail.com>

[clang-format][NFC] Be more careful about the layout of FormatToken.

The underlying ABI forces FormatToken to have a lot of padding.

Currently (on x86-64 linux) `sizeof(FormatToken) == 288`. After

[clang-format][NFC] Be more careful about the layout of FormatToken.

The underlying ABI forces FormatToken to have a lot of padding.

Currently (on x86-64 linux) `sizeof(FormatToken) == 288`. After this patch
`sizeof(FormatToken) == 232`.

No functional changes.

Reviewed By: MyDeveloperDay

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

show more ...


Revision tags: llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2
# b99bf0e0 20-May-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format][PR45816] Add AlignConsecutiveBitFields

Summary:
The following revision follows D80115 since @MyDeveloperDay and I apparently both had the same idea at the same time, for https://bugs.

[clang-format][PR45816] Add AlignConsecutiveBitFields

Summary:
The following revision follows D80115 since @MyDeveloperDay and I apparently both had the same idea at the same time, for https://bugs.llvm.org/show_bug.cgi?id=45816 and my efforts on tooling support for AMDVLK, respectively.

This option aligns adjacent bitfield separators across lines, in a manner similar to AlignConsecutiveAssignments and friends.

Example:
```
struct RawFloat {
uint32_t sign : 1;
uint32_t exponent : 8;
uint32_t mantissa : 23;
};
```
would become
```
struct RawFloat {
uint32_t sign : 1;
uint32_t exponent : 8;
uint32_t mantissa : 23;
};
```

This also handles c++2a style bitfield-initializers with AlignConsecutiveAssignments.
```
struct RawFloat {
uint32_t sign : 1 = 0;
uint32_t exponent : 8 = 127;
uint32_t mantissa : 23 = 0;
}; // defaults to 1.0f
```

Things this change does not do:
- Align multiple comma-chained bitfield variables. None of the other
AlignConsecutive* options seem to implement that either.
- Detect bitfields that have a width specified with something other
than a numeric literal (ie, `int a : SOME_MACRO;`). That'd be fairly
difficult to parse and is rare.

Patch By: JakeMerdichAMD

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang, #clang-format

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

show more ...


12345678