#
9cb94459 |
| 11-Feb-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Correctly format loops and `if` statements even if preceded with comments.
Fixes https://github.com/llvm/llvm-project/issues/53758.
Braces in loops and in `if` statements with leadin
[clang-format] Correctly format loops and `if` statements even if preceded with comments.
Fixes https://github.com/llvm/llvm-project/issues/53758.
Braces in loops and in `if` statements with leading (block) comments were formatted according to `BraceWrapping.AfterFunction` and not `AllowShortBlocksOnASingleLine`/`AllowShortLoopsOnASingleLine`/`AllowShortIfStatementsOnASingleLine`.
Previously, the code: ``` while (true) { f(); } /*comment*/ while (true) { f(); } ```
was incorrectly formatted to: ``` while (true) { f(); } /*comment*/ while (true) { f(); } ```
when using config: ``` BasedOnStyle: LLVM BreakBeforeBraces: Custom BraceWrapping: AfterFunction: false AllowShortBlocksOnASingleLine: false AllowShortLoopsOnASingleLine: false ```
and it was (correctly but by chance) formatted to: ``` while (true) { f(); } /*comment*/ while (true) { f(); } ```
when using enabling brace wrapping after functions: ``` BasedOnStyle: LLVM BreakBeforeBraces: Custom BraceWrapping: AfterFunction: true AllowShortBlocksOnASingleLine: false AllowShortLoopsOnASingleLine: false ```
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D119649
show more ...
|
#
9aab0db1 |
| 05-Nov-2021 |
Björn Schäpers <bjoern@hazardy.de> |
[clang-format] Improve require and concept handling
- Added an option where to put the requires clauses. - Renamed IndentRequires to IndentRequiresClause. - Changed BreakBeforeConceptDeclaration fro
[clang-format] Improve require and concept handling
- Added an option where to put the requires clauses. - Renamed IndentRequires to IndentRequiresClause. - Changed BreakBeforeConceptDeclaration from bool to an enum.
Fixes https://llvm.org/PR32165, and https://llvm.org/PR52401.
Differential Revision: https://reviews.llvm.org/D113319
show more ...
|
#
fd16eeea |
| 11-Feb-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Assert default style instead of commenting. NFC.
|
#
a218706c |
| 11-Feb-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Add tests for spacing between ref-qualifier and `noexcept`. NFC.
Cf. https://github.com/llvm/llvm-project/issues/44542. Cf. https://github.com/llvm/llvm-project/commit/ae1b7859cbd61d2
[clang-format] Add tests for spacing between ref-qualifier and `noexcept`. NFC.
Cf. https://github.com/llvm/llvm-project/issues/44542. Cf. https://github.com/llvm/llvm-project/commit/ae1b7859cbd61d2284d9690bc53482d0b6a46f63.
show more ...
|
#
6c7e6fc7 |
| 10-Feb-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Do not remove required spaces when aligning tokens.
Fixes https://github.com/llvm/llvm-project/issues/44292. Fixes https://github.com/llvm/llvm-project/issues/45874.
Reviewed By: Haz
[clang-format] Do not remove required spaces when aligning tokens.
Fixes https://github.com/llvm/llvm-project/issues/44292. Fixes https://github.com/llvm/llvm-project/issues/45874.
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D119419
show more ...
|
#
a7b5e5b4 |
| 07-Feb-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Fix formatting of macro definitions with a leading comment.
Fixes https://github.com/llvm/llvm-project/issues/43206.
Reviewed By: HazardyKnusperkeks
Differential Revision: https://r
[clang-format] Fix formatting of macro definitions with a leading comment.
Fixes https://github.com/llvm/llvm-project/issues/43206.
Reviewed By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D118924
show more ...
|
#
a77c67f9 |
| 09-Feb-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Fix formatting of the array form of delete.
Fixes https://github.com/llvm/llvm-project/issues/53576.
There was an inconsistency in formatting of delete expressions.
Before: ``` dele
[clang-format] Fix formatting of the array form of delete.
Fixes https://github.com/llvm/llvm-project/issues/53576.
There was an inconsistency in formatting of delete expressions.
Before: ``` delete (void*)a; delete[](void*) a; ```
After this patch: ``` delete (void*)a; delete[] (void*)a; ```
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D119117
show more ...
|
#
cc8ed7b5 |
| 04-Feb-2022 |
Sam McCall <sam.mccall@gmail.com> |
[Format] Also test rvalue-qualified functions
|
#
acc3ce94 |
| 03-Feb-2022 |
Sam McCall <sam.mccall@gmail.com> |
[Format] Don't derive pointers right based on space before method ref-qualifiers
The second space in `void foo() &` is always produced by clang-format, and isn't evidence of any particular style.
B
[Format] Don't derive pointers right based on space before method ref-qualifiers
The second space in `void foo() &` is always produced by clang-format, and isn't evidence of any particular style.
Before this patch, it was considered evidence of PAS_Right, because there is a space before a pointerlike ampersand.
This caused the following code to have "unstable" pointer alignment: void a() &; void b() &; int *x; PAS_Left, Derive=false would produce 'int* x' with other lines unchanged. But subsequent formatting with Derive=true would produce 'int *x' again.
Differential Revision: https://reviews.llvm.org/D118921
show more ...
|
#
23fc20e0 |
| 03-Feb-2022 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] regression from clang-format v13
https://github.com/llvm/llvm-project/issues/53567
The following source
``` namespace A {
template <int N> struct Foo<char[N]> { void foo() { std:
[clang-format] regression from clang-format v13
https://github.com/llvm/llvm-project/issues/53567
The following source
``` namespace A {
template <int N> struct Foo<char[N]> { void foo() { std::cout << "Bar"; } }; // namespace A ```
is incorrectly formatted as:
``` namespace A {
template <int N> struct Foo<char[N]>{void foo(){std::cout << "Bar"; } } ; // namespace A ```
This looks to be caused by https://github.com/llvm/llvm-project/commit/5c2e7c9ca043d92bed75b08e653fb47c384edd13
Reviewed By: curdeius
Differential Revision: https://reviews.llvm.org/D118911
show more ...
|
#
ca0d9707 |
| 03-Feb-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Avoid merging macro definitions.
Fixes https://github.com/llvm/llvm-project/issues/42087.
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D1
[clang-format] Avoid merging macro definitions.
Fixes https://github.com/llvm/llvm-project/issues/42087.
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D118879
show more ...
|
#
529aa4b0 |
| 03-Feb-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Avoid adding space after the name of a function-like macro when the name is a keyword.
Fixes https://github.com/llvm/llvm-project/issues/31086.
Before the code: ``` #define if(x) ```
[clang-format] Avoid adding space after the name of a function-like macro when the name is a keyword.
Fixes https://github.com/llvm/llvm-project/issues/31086.
Before the code: ``` #define if(x) ```
was erroneously formatted to: ``` #define if (x) ```
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D118844
show more ...
|
#
eaef54f2 |
| 03-Feb-2022 |
Owen Pan <owenpiano@gmail.com> |
[clang-format] Revert a feature in RemoveBracesLLVM
Revert the handling of a single-statement block that gets wrapped.
See issue #53543.
Differential Revision: https://reviews.llvm.org/D118873
|
#
bc40b76b |
| 02-Feb-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Correctly parse C99 digraphs: "<:", ":>", "<%", "%>", "%:", "%:%:".
Fixes https://github.com/llvm/llvm-project/issues/31592.
This commits enables lexing of digraphs in C++11 and onwa
[clang-format] Correctly parse C99 digraphs: "<:", ":>", "<%", "%>", "%:", "%:%:".
Fixes https://github.com/llvm/llvm-project/issues/31592.
This commits enables lexing of digraphs in C++11 and onwards. Enabling them in C++03 is error-prone, as it would unconditionally treat sequences like "<:" as digraphs, even if they are followed by a single colon, e.g. "<::" would be treated as "[:" instead of "<" followed by "::". Lexing in C++11 doesn't have this problem as it looks ahead the following token. The relevant excerpt from Lexer::LexTokenInternal: ``` // C++0x [lex.pptoken]p3: // Otherwise, if the next three characters are <:: and the subsequent // character is neither : nor >, the < is treated as a preprocessor // token by itself and not as the first character of the alternative // token <:. ```
Also, note that both clang and gcc turn on digraphs by default (-fdigraphs), so clang-format should match this behaviour.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D118706
show more ...
|
#
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 ...
|
#
438f0e1f |
| 31-Jan-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Use EXPECT_EQ instead of setting style to a default value. NFC.
|
#
d1aed486 |
| 30-Jan-2022 |
Philip Sigillito <psigillito@gmail.com> |
[clang-format] Handle C variables with name that matches c++ access specifier
Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D117416
|
#
36622c4e |
| 27-Jan-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Fix AllowShortFunctionsOnASingleLine: InlineOnly with wrapping after record.
Fixes https://github.com/llvm/llvm-project/issues/53430.
Initially, I had a quick and dirty approach, but
[clang-format] Fix AllowShortFunctionsOnASingleLine: InlineOnly with wrapping after record.
Fixes https://github.com/llvm/llvm-project/issues/53430.
Initially, I had a quick and dirty approach, but it led to a myriad of special cases handling comments (that may add unwrapped lines). So I added TT_RecordLBrace type annotations and it seems like a much nicer solution. I think that in the future it will allow us to clean up some convoluted code that detects records.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D118337
show more ...
|
#
93948c52 |
| 26-Jan-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Correctly format lambdas with variadic template parameters.
Fixes https://github.com/llvm/llvm-project/issues/53405.
Reviewed By: MyDeveloperDay, owenpan
Differential Revision: http
[clang-format] Correctly format lambdas with variadic template parameters.
Fixes https://github.com/llvm/llvm-project/issues/53405.
Reviewed By: MyDeveloperDay, owenpan
Differential Revision: https://reviews.llvm.org/D118220
show more ...
|
#
72e29caf |
| 26-Jan-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Fix regression in parsing pointers to arrays.
Fixes https://github.com/llvm/llvm-project/issues/53293.
After commit 5c2e7c9, the code: ``` template <> struct S : Template<int (*)[]>
[clang-format] Fix regression in parsing pointers to arrays.
Fixes https://github.com/llvm/llvm-project/issues/53293.
After commit 5c2e7c9, the code: ``` template <> struct S : Template<int (*)[]> {}; ``` was misformatted as: ``` template <> struct S : Template<int (*)[]>{}; ```
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D118106
show more ...
|
#
50999e82 |
| 24-Jan-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Space between attribute closing parenthesis and qualified type colon.
Fixes https://github.com/llvm/llvm-project/issues/35711.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpa
[clang-format] Space between attribute closing parenthesis and qualified type colon.
Fixes https://github.com/llvm/llvm-project/issues/35711.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D117894
show more ...
|
#
794b1eeb |
| 20-Jan-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Add tests for aligning `operator=` with `=delete`. NFC.
Also, add test case from https://github.com/llvm/llvm-project/issues/33044. This was actually fixed in https://github.com/llvm/
[clang-format] Add tests for aligning `operator=` with `=delete`. NFC.
Also, add test case from https://github.com/llvm/llvm-project/issues/33044. This was actually fixed in https://github.com/llvm/llvm-project/commit/480a1fab72f4e367a5986d572914d252c318431d, but there were no tests for delete.
show more ...
|
#
560eb227 |
| 20-Jan-2022 |
Jino Park <pjessesco@gmail.com> |
[clang-format] Fix bug in parsing `operator<` with template
Fixes https://github.com/llvm/llvm-project/issues/44601.
This patch handles a bug when parsing a below example code :
``` template <clas
[clang-format] Fix bug in parsing `operator<` with template
Fixes https://github.com/llvm/llvm-project/issues/44601.
This patch handles a bug when parsing a below example code :
``` template <class> class S;
template <class T> bool operator<(S<T> const &x, S<T> const &y) { return x.i < y.i; }
template <class T> class S { int i = 42; friend bool operator< <>(S const &, S const &); };
int main() { return S<int>{} < S<int>{}; } ``` which parse `< <>` as `<< >`, not `< <>` in terms of tokens as discussed in discord.
1. Add a condition in `tryMergeLessLess()` considering `operator` keyword and `>` 2. Force to leave a whitespace between `tok::less` and a template opener 3. Add unit test
Reviewed By: MyDeveloperDay, curdeius
Differential Revision: https://reviews.llvm.org/D117398
show more ...
|
#
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 ...
|
#
1e512f02 |
| 14-Jan-2022 |
Marek Kurdej <marek.kurdej+llvm.org@gmail.com> |
[clang-format] Treat ForEachMacros as loops
TT_ForEachMacro should be considered in rules AllowShortBlocksOnASingleLine and AllowShortLoopsOnASingleLine. Fixes https://github.com/llvm/llvm-project/i
[clang-format] Treat ForEachMacros as loops
TT_ForEachMacro should be considered in rules AllowShortBlocksOnASingleLine and AllowShortLoopsOnASingleLine. Fixes https://github.com/llvm/llvm-project/issues/45432.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D94955
show more ...
|