#
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 ...
|
#
09b75f48 |
| 26-May-2021 |
Zhihao Yuan <zhihao.yuan@broadcom.com> |
[clang-format] New BreakInheritanceList style AfterComma
This inheritance list style has been widely adopted by Symantec, a division of Broadcom Inc. It breaks after the commas that separate the bas
[clang-format] New BreakInheritanceList style AfterComma
This inheritance list style has been widely adopted by Symantec, a division of Broadcom Inc. It breaks after the commas that separate the base-specifiers:
class Derived : public Base1, private Base2 { };
Differential Revision: https://reviews.llvm.org/D103204
show more ...
|
#
eae445f6 |
| 15-May-2021 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] PR50326 AlignAfterOpenBracket AlwaysBreak does not keep to the ColumnLimit
https://bugs.llvm.org/show_bug.cgi?id=50326
{D93626} caused a regression in terms of formatting a function
[clang-format] PR50326 AlignAfterOpenBracket AlwaysBreak does not keep to the ColumnLimit
https://bugs.llvm.org/show_bug.cgi?id=50326
{D93626} caused a regression in terms of formatting a function ptr, incorrectly thinking it was a C-Style cast.
This cased a formatter regression between clang-format-11 and clang-format-12
``` void bar() { size_t foo = function(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong);
size_t foo = function( Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong, FoooooooooLooooong);
size_t foo = (*(function))(Foooo, Barrrrr, Foooo, FoooooooooLooooong);
size_t foo = (*( function))(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong, FoooooooooLooooong); } ```
became
``` void bar() { size_t foo1 = function(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong);
size_t foo2 = function( Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong, FoooooooooLooooong);
size_t foo3 = (*(function))(Foooo, Barrrrr, Foooo, FoooooooooLooooong);
size_t foo4 = (*( function))(Foooo, Barrrrr, Foooo, Barrrr, FoooooooooLooooong, BarrrrrrrrrrrrLong, FoooooooooLooooong); } ```
This fixes this issue by simplify the clause to be specific about what is wanted rather than what is not.
Reviewed By: curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D102392
show more ...
|
#
4dd54613 |
| 14-May-2021 |
Benjamin Kramer <benny.kra@googlemail.com> |
Bump googletest to 1.8.1
We've accumulated a scary amount of local patches to this directory. I tried to merge them all, but if your favorite change is missing please reapply it manually (and send i
Bump googletest to 1.8.1
We've accumulated a scary amount of local patches to this directory. I tried to merge them all, but if your favorite change is missing please reapply it manually (and send it upstream).
show more ...
|
#
8fa56f7e |
| 04-May-2021 |
Luis Penagos <luis@penagos.co> |
[clang-format] Prevent extraneous space insertion in bitshift operators
This serves to augment the improvements made in https://reviews.llvm.org/D86581. It prevents clang-format from interpreting b
[clang-format] Prevent extraneous space insertion in bitshift operators
This serves to augment the improvements made in https://reviews.llvm.org/D86581. It prevents clang-format from interpreting bitshift operators as template arguments in certain circumstances. This is an attempt at fixing https://bugs.llvm.org/show_bug.cgi?id=49868
Reviewed By: MyDeveloperDay, krasimir
Differential Revision: https://reviews.llvm.org/D100778
show more ...
|
#
8d93d7ff |
| 03-May-2021 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Add options to AllowShortIfStatementsOnASingleLine to apply to "else if" and "else".
This fixes the bug http://llvm.org/pr50019.
Reviewed By: MyDeveloperDay
Differential Revision: h
[clang-format] Add options to AllowShortIfStatementsOnASingleLine to apply to "else if" and "else".
This fixes the bug http://llvm.org/pr50019.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D100727
show more ...
|
#
9363aa90 |
| 29-Apr-2021 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Add `SpacesInAngles: Leave` option to keep spacing inside angle brackets as is.
A need for such an option came up in a few libc++ reviews. That's because libc++ has both code in C++03
[clang-format] Add `SpacesInAngles: Leave` option to keep spacing inside angle brackets as is.
A need for such an option came up in a few libc++ reviews. That's because libc++ has both code in C++03 and newer standards. Currently, it uses `Standard: C++03` setting for clang-format, but this breaks e.g. u8"string" literals. Also, angle brackets are the only place where C++03-specific formatting needs to be applied.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D101344
show more ...
|
#
3feb84a3 |
| 27-Apr-2021 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Merge SpacesInAngles tests. NFC.
|
#
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 ...
|
#
fd4e08aa |
| 16-Apr-2021 |
Max Sagebaum <max.sagebaum@scicomp.uni-kl.de> |
[clang-format] Inconsistent behavior regarding line break before access modifier
Fixes https://llvm.org/PR41870.
Checks for newlines in option Style.EmptyLineBeforeAccessModifier are now based on t
[clang-format] Inconsistent behavior regarding line break before access modifier
Fixes https://llvm.org/PR41870.
Checks for newlines in option Style.EmptyLineBeforeAccessModifier are now based on the formatted new lines and not on the new lines in the file.
Reviewed By: HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D99503
show more ...
|
#
dda978ee |
| 15-Apr-2021 |
Max Sagebaum <max.sagebaum@scicomp.uni-kl.de> |
[clang-format] Option for empty lines after an access modifier.
The current logic for access modifiers in classes ignores the option 'MaxEmptyLinesToKeep=1'. It is therefore impossible to have a cod
[clang-format] Option for empty lines after an access modifier.
The current logic for access modifiers in classes ignores the option 'MaxEmptyLinesToKeep=1'. It is therefore impossible to have a coding style that requests one empty line after an access modifier. The patch allows the user to configure how many empty lines clang-format should add after an access modifier. This will remove lines if there are to many and will add them if there are missing.
Reviewed By: MyDeveloperDay, curdeius
Differential Revision: https://reviews.llvm.org/D98237
show more ...
|
Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4 |
|
#
bc4b0fc5 |
| 30-Mar-2021 |
Nico Rieck <nico.rieck@gmail.com> |
[clang-format] Fix east const pointer alignment of operators
This patch fixes left pointer alignment after pointer qualifiers of operators. Currently "operator void const*()" is formatted with a spa
[clang-format] Fix east const pointer alignment of operators
This patch fixes left pointer alignment after pointer qualifiers of operators. Currently "operator void const*()" is formatted with a space between const and pointer despite setting PointerAlignment to Left.
AFAICS this has been broken since clang-format 10.
Reviewed By: MyDeveloperDay, curdeius
Differential Revision: https://reviews.llvm.org/D99458
show more ...
|
#
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 |
|
#
f7f9f94b |
| 05-Mar-2021 |
Tim Wojtulewicz <timwoj@gmail.com> |
[clang-format] Rework Whitesmiths mode to use line-level values in UnwrappedLineParser
This commit removes the old way of handling Whitesmiths mode in favor of just setting the levels during parsing
[clang-format] Rework Whitesmiths mode to use line-level values in UnwrappedLineParser
This commit removes the old way of handling Whitesmiths mode in favor of just setting the levels during parsing and letting the formatter handle it from there. It requires a bit of special-casing during the parsing, but ends up a bit cleaner than before. It also removes some of switch/case unit tests that don't really make much sense when dealing with Whitesmiths.
Differential Revision: https://reviews.llvm.org/D94500
show more ...
|
#
7b02794f |
| 04-Mar-2021 |
Björn Schäpers <bjoern@hazardy.de> |
[clang-format] Rename case sorting
As discussed in D95017 the names case sensitive and insensitive should be switched.
This amends a8105b3766e4.
Differential Revision: https://reviews.llvm.org/D97
[clang-format] Rename case sorting
As discussed in D95017 the names case sensitive and insensitive should be switched.
This amends a8105b3766e4.
Differential Revision: https://reviews.llvm.org/D97927
show more ...
|
#
418b4a7b |
| 27-Feb-2021 |
Björn Schäpers <bjoern@hazardy.de> |
[clang-format] Respect spaces in line comment section...
... without an active column limit.
Before line comments were not touched at all with ColumnLimit == 0.
Differential Revision: https://revi
[clang-format] Respect spaces in line comment section...
... without an active column limit.
Before line comments were not touched at all with ColumnLimit == 0.
Differential Revision: https://reviews.llvm.org/D96896
show more ...
|
#
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 ...
|
#
2a42c759 |
| 26-Feb-2021 |
Jakub Budiský <jakub.budisky@gmail.com> |
[clang-format] [PR19056] Add support for access modifiers indentation
Adds support for coding styles that make a separate indentation level for access modifiers, such as Code::Blocks or QtCreator.
[clang-format] [PR19056] Add support for access modifiers indentation
Adds support for coding styles that make a separate indentation level for access modifiers, such as Code::Blocks or QtCreator.
The new option, `IndentAccessModifiers`, if enabled, forces the content inside classes, structs and unions (“records”) to be indented twice while removing a level for access modifiers. The value of `AccessModifierOffset` is disregarded in this case, aiming towards an ease of use.
====== The PR (https://bugs.llvm.org/show_bug.cgi?id=19056) had an implementation attempt by @MyDeveloperDay already (https://reviews.llvm.org/D60225) but I've decided to start from scratch. They differ in functionality, chosen approaches, and even the option name. The code tries to re-use the existing functionality to achieve this behavior, limiting possibility of breaking something else.
Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D94661
show more ...
|
Revision tags: llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3 |
|
#
25f753c5 |
| 29-Jan-2021 |
Björn Schäpers <bjoern@hazardy.de> |
[clang-format] Add possibility to be based on parent directory
This allows the define BasedOnStyle: InheritParentConfig and then clang-format looks into the parent directories for their .clang-forma
[clang-format] Add possibility to be based on parent directory
This allows the define BasedOnStyle: InheritParentConfig and then clang-format looks into the parent directories for their .clang-format and takes that as a basis.
Differential Revision: https://reviews.llvm.org/D93844
show more ...
|
#
a8105b37 |
| 02-Feb-2021 |
Kent Sommer <work@kentsommer.com> |
[clang-format] Add case aware include sorting.
Adds an option to [clang-format] which sorts headers in an alphabetical manner using case only for tie-breakers. The options is off by default in favor
[clang-format] Add case aware include sorting.
Adds an option to [clang-format] which sorts headers in an alphabetical manner using case only for tie-breakers. The options is off by default in favor of the current ASCIIbetical sorting style.
Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D95017
show more ...
|
#
772eb24e |
| 29-Jan-2021 |
Björn Schäpers <bjoern@hazardy.de> |
[clang-format] Add option to control the spaces in a line comment
Differential Revision: https://reviews.llvm.org/D92257
|
#
4ad41f1d |
| 29-Jan-2021 |
Björn Schäpers <bjoern@hazardy.de> |
Revert "[clang-format] Add option to control the spaces in a line comment"
This reverts commit 078f30e04d1fcb5a05d8e340f3178f3478075541.
|
Revision tags: llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1 |
|
#
078f30e0 |
| 26-Dec-2020 |
Björn Schäpers <bjoern@hazardy.de> |
[clang-format] Add option to control the spaces in a line comment
Differential Revision: https://reviews.llvm.org/D92257
|
#
e3713f15 |
| 27-Jan-2021 |
Marek Kurdej <marek.kurdej@gmail.com> |
[clang-format] Avoid considering include directive as a template closer.
This fixes a bug [[ http://llvm.org/PR48891 | PR48891 ]] introduced in D93839 where: ``` #include <stdint.h> namespace rep {}
[clang-format] Avoid considering include directive as a template closer.
This fixes a bug [[ http://llvm.org/PR48891 | PR48891 ]] introduced in D93839 where: ``` #include <stdint.h> namespace rep {} ``` got formatted as ``` #include <stdint.h> namespace rep { } ```
Reviewed By: MyDeveloperDay, leonardchan
Differential Revision: https://reviews.llvm.org/D95479
show more ...
|
#
6d5c1cd2 |
| 26-Jan-2021 |
Marek Kurdej <marek.kurdej@gmail.com> |
Revert "[clang-format] add case aware include sorting"
This reverts commit 3395a336b02538d0bb768ccfae11c9b6151b102e as there was a post-merge doubt about option naming and type.
|