#
14198ccf |
| 30-Apr-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] Fix lambda with ellipsis in return type
Summary: BTW my actual code that hit this issue is like
``` [a, b = std::move(b)](auto &&... c) mutable -> std::invoke_result_t<decltype(b), d
[clang-format] Fix lambda with ellipsis in return type
Summary: BTW my actual code that hit this issue is like
``` [a, b = std::move(b)](auto &&... c) mutable -> std::invoke_result_t<decltype(b), decltype(c)...> { /* omitted */ } ```
where this explicit return type is required for SFINAE.
Reviewed By: krasimir, MyDeveloperDay
Patch By: johnchen902
Subscribers: krasimir, dexonsmith, cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D78694
show more ...
|
#
b01dca50 |
| 30-Apr-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] [PR45357] Fix issue found with operator spacing
Summary: This is a tentative fix for https://bugs.llvm.org/show_bug.cgi?id=45357
Spaces seem to be introduced between * and * due to c
[clang-format] [PR45357] Fix issue found with operator spacing
Summary: This is a tentative fix for https://bugs.llvm.org/show_bug.cgi?id=45357
Spaces seem to be introduced between * and * due to changes brought in for {D69573}
Reviewers: sylvestre.ledru, mitchell-stellar, sammccall, Abpostelnicu, krasimir, jbcoe
Reviewed By: Abpostelnicu
Subscribers: tstellar, hans, Abpostelnicu, cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D78879
show more ...
|
#
47ef09e4 |
| 23-Apr-2020 |
Haojian Wu <hokein.wu@gmail.com> |
Revert "clang-format: support aligned nested conditionals formatting"
This reverts 3d61b1120e8267aa39f4c9a33d618dbaec4ec6fa, 5daa25fd7a184524759b6ad065a8bd7e95aa149a
The clang-format test (FormatTe
Revert "clang-format: support aligned nested conditionals formatting"
This reverts 3d61b1120e8267aa39f4c9a33d618dbaec4ec6fa, 5daa25fd7a184524759b6ad065a8bd7e95aa149a
The clang-format test (FormatTest.ConfigurableUseOfTab) is failing in the buildbot:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/31811/steps/ninja%20check%201/logs/stdio
show more ...
|
#
3d61b112 |
| 22-May-2017 |
Francois Ferrand <thetypz@gmail.com> |
clang-format: Introduce stricter AlignOperands flag
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it could align the actual o
clang-format: Introduce stricter AlignOperands flag
Summary: Even when BreakBeforeBinaryOperators is set, AlignOperands kept aligning the beginning of the line, even when it could align the actual operands (e.g. after an assignment).
With this patch, there is an option to actually align the operands, so that the operator gets right-aligned with the equal sign or return operator:
int aaaaa = bbbbbb + cccccc; return aaaaaaa && bbbbbbb;
This not happen in parentheses, to avoid 'breaking' the indentation:
if (aaaaa && bbbbb) return;
Reviewers: krasimir, djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D32478
show more ...
|
#
5daa25fd |
| 15-Jun-2018 |
Francois Ferrand <thetypz@gmail.com> |
clang-format: support aligned nested conditionals formatting
When multiple ternary operators are chained, e.g. like an if/else-if/ else-if/.../else sequence, clang-format will keep aligning the colo
clang-format: support aligned nested conditionals formatting
When multiple ternary operators are chained, e.g. like an if/else-if/ else-if/.../else sequence, clang-format will keep aligning the colon with the question mark, which increases the indent for each conditionals:
int a = condition1 ? result1 : condition2 ? result2 : condition3 ? result3 : result4;
This patch detects the situation (e.g. conditionals used in false branch of another conditional), to avoid indenting in that case:
int a = condition1 ? result1 : condition2 ? result2 : condition3 ? result3 : result4;
When BreakBeforeTernaryOperators is false, this will format like this:
int a = condition1 ? result1 : condition2 ? result2 : conditino3 ? result3 : result4;
show more ...
|
#
e8111502 |
| 13-Apr-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] use spaces for alignment with UT_ForContinuationAndIndentation
Summary: Use spaces instead of tabs for alignment with UT_ForContinuationAndIndentation to make the code aligned for any
[clang-format] use spaces for alignment with UT_ForContinuationAndIndentation
Summary: Use spaces instead of tabs for alignment with UT_ForContinuationAndIndentation to make the code aligned for any tab/indent width.
Fixes https://bugs.llvm.org/show_bug.cgi?id=38381
Reviewed By: MyDeveloperDay
Patch By: fickert
Tags: #clang-format
Differential Revision: https://reviews.llvm.org/D75034
show more ...
|
#
072ae7c1 |
| 13-Apr-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] Always break line after enum opening brace
Summary: clang-format currently puts the first enumerator on the same line as the enum keyword and opening brace if it fits (for example, fo
[clang-format] Always break line after enum opening brace
Summary: clang-format currently puts the first enumerator on the same line as the enum keyword and opening brace if it fits (for example, for anonymous enums if IndentWidth is 8):
$ echo "enum { RED, GREEN, BLUE };" | clang-format -style="{BasedOnStyle: llvm, ColumnLimit: 15, IndentWidth: 8}" enum { RED, GREEN, BLUE };
This doesn't seem to be intentional, as I can't find any style guide that suggests wrapping enums this way. Always force the enumerator to be on a new line, which gets us the desired result:
$ echo "enum { RED, GREEN, BLUE };" | ./bin/clang-format -style="{BasedOnStyle: llvm, ColumnLimit: 15, IndentWidth: 8}" enum { RED, GREEN, BLUE };
Test Plan:
New test added. Confirmed test failed without change and passed with change by running:
$ ninja FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewed By: MyDeveloperDay
Patch By: osandov
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D77682
show more ...
|
#
eb85e903 |
| 25-Mar-2020 |
Hans Wennborg <hans@chromium.org> |
clang-format: Fix pointer alignment for overloaded operators (PR45107)
This fixes a regression from D69573 which broke the following example:
$ echo 'operator C<T>*();' | bin/clang-format --style
clang-format: Fix pointer alignment for overloaded operators (PR45107)
This fixes a regression from D69573 which broke the following example:
$ echo 'operator C<T>*();' | bin/clang-format --style=Chromium operator C<T> *();
(There should be no space before the asterisk.)
It seems the problem is in TokenAnnotator::spaceRequiredBetween(), which only looked at the token to the left of the * to see if it was a type or not. That code only handled simple types or identifiers, not templates or qualified types. This patch addresses that.
Differential revision: https://reviews.llvm.org/D76850
show more ...
|
#
c5c487f0 |
| 11-Mar-2020 |
Mitchell Balan <mitchell@stellarscience.com> |
Revert "[clang-format] Add option to specify explicit config file" There were a number of unexpected test failures.
This reverts commit 10b1a87ba35d386b718f0e83c1d750631705b220.
|
#
10b1a87b |
| 11-Mar-2020 |
Mitchell Balan <mitchell@stellarscience.com> |
[clang-format] Add option to specify explicit config file Summary: This diff extends the -style=file option to allow a config file to be specified explicitly. This is useful (for instance) when addin
[clang-format] Add option to specify explicit config file Summary: This diff extends the -style=file option to allow a config file to be specified explicitly. This is useful (for instance) when adding IDE commands to reformat code to a personal style.
Reviewers: djasper, ioeric, krasimir, MyDeveloperDay
Reviewed by: MyDeveloperDay
Contributed by: tnorth
Subscribers: cfe-commits, lebedev.ri, MyDeveloperDay, klimek, sammccall, mitchell-stellar
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D72326
show more ...
|
#
2eff1c3c |
| 06-Mar-2020 |
Mitchell Balan <mitchell@stellarscience.com> |
[clang-format] Extend AllowShortLoopsOnASingleLine to do ... while loops. Summary: If AllowShortLoopsOnASingleLine is enabled,
do a++; while (true);
becomes
do a++; while (true);
Revi
[clang-format] Extend AllowShortLoopsOnASingleLine to do ... while loops. Summary: If AllowShortLoopsOnASingleLine is enabled,
do a++; while (true);
becomes
do a++; while (true);
Reviewers: MyDeveloperDay, mitchell-stellar
Reviewed by: mitchell-stellar
Contributed by: DaanDeMeyer
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D75022
show more ...
|
#
36c2ab8d |
| 05-Mar-2020 |
Krasimir Georgiev <krasimir@google.com> |
[clang-format] do not insert spaces around inline asm symbolic names
Summary: Fixes https://bugs.llvm.org/show_bug.cgi?id=45108.
The `[` in such cases was mis-annotated as an `TT_ArrayInitializerLS
[clang-format] do not insert spaces around inline asm symbolic names
Summary: Fixes https://bugs.llvm.org/show_bug.cgi?id=45108.
The `[` in such cases was mis-annotated as an `TT_ArrayInitializerLSquare`.
Reviewers: hans
Reviewed By: hans
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75675
show more ...
|
#
fa0118e6 |
| 13-Feb-2020 |
Wawha <fjean.wk@gmail.com> |
[clang-format] Add new option BeforeLambdaBody in Allman style.
This option add a line break then a lambda is inside a function call.
Reviewers : djasper, klimek, krasimir, MyDeveloperDay
Reviewed
[clang-format] Add new option BeforeLambdaBody in Allman style.
This option add a line break then a lambda is inside a function call.
Reviewers : djasper, klimek, krasimir, MyDeveloperDay
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D44609
show more ...
|
#
4ec2a267 |
| 29-Jan-2020 |
Sanne Wouda <Sanne.Wouda@arm.com> |
Fix clang test build
|
#
a324fcf1 |
| 24-Jan-2020 |
Martin Probst <martin@probst.io> |
clang-format: insert trailing commas into containers.
Summary: This change adds an option to insert trailing commas into container literals. For example, in JavaScript:
const x = [ a,
clang-format: insert trailing commas into containers.
Summary: This change adds an option to insert trailing commas into container literals. For example, in JavaScript:
const x = [ a, b, ^~~~~ inserted if missing. ]
This is implemented as a seperate post-processing pass after formatting (because formatting might change whether the container literal does or does not wrap). This keeps the code relatively simple and orthogonal, though it has the notable drawback that the newly inserted comma is not taken into account for formatting decisions (e.g. it might exceed the 80 char limit). To avoid exceeding the ColumnLimit, a comma is only inserted if it fits into the limit.
Trailing comma insertion conceptually conflicts with argument bin-packing: inserting a comma disables bin-packing, so we cannot do both. clang-format rejects FormatStyle configurations that do both with this change.
Reviewers: krasimir, MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang
show more ...
|
#
b3b68c0f |
| 24-Jan-2020 |
Sam McCall <sam.mccall@gmail.com> |
[Format] Fix 'auto x(T&&, T &&)->F' with PAS_Left.
Summary: An heuristic targetting `x && x->foo` was targed overly broadly and caused the last T&& to be treated as a binary operator.
Reviewers: ho
[Format] Fix 'auto x(T&&, T &&)->F' with PAS_Left.
Summary: An heuristic targetting `x && x->foo` was targed overly broadly and caused the last T&& to be treated as a binary operator.
Reviewers: hokein
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73334
show more ...
|
#
ea2be452 |
| 19-Jan-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] Expand the SpacesAroundConditions option to include catch statements
Summary: This diff expands the SpacesAroundConditions option added in D68346 to include adding spaces to catch sta
[clang-format] Expand the SpacesAroundConditions option to include catch statements
Summary: This diff expands the SpacesAroundConditions option added in D68346 to include adding spaces to catch statements.
Reviewed By: MyDeveloperDay
Patch by: timwoj
Differential Revision: https://reviews.llvm.org/D72793
show more ...
|
#
14c04475 |
| 19-Jan-2020 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] Add IndentCaseBlocks option
Summary: The documentation for IndentCaseLabels claimed that the "Switch statement body is always indented one level more than case labels". This is techni
[clang-format] Add IndentCaseBlocks option
Summary: The documentation for IndentCaseLabels claimed that the "Switch statement body is always indented one level more than case labels". This is technically false for the code block immediately following the label. Its closing bracket aligns with the start of the label.
If the case label are not indented, it leads to a style where the closing bracket of the block aligns with the closing bracket of the switch statement, which can be hard to parse.
This change introduces a new option, IndentCaseBlocks, which when true treats the block as a scope block (which it technically is).
(Note: regenerated ClangFormatStyleOptions.rst using tools/dump_style.py)
Reviewed By: MyDeveloperDay
Patch By: capn
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D72276
show more ...
|
#
33463cfb |
| 17-Jan-2020 |
Krasimir Georgiev <krasimir@google.com> |
clang-format: fix spacing in `operator const char*()`
Summary: Revision a75f8d98d7ac9e557b238a229a9a2647c71feed1 fixed spacing for operators, but caused the const and non-const versions to diverge:
clang-format: fix spacing in `operator const char*()`
Summary: Revision a75f8d98d7ac9e557b238a229a9a2647c71feed1 fixed spacing for operators, but caused the const and non-const versions to diverge: ``` // With Style.PointerAlignment = FormatStyle::PAS_Left:
struct A { operator char*() { return ""; } operator const char *() const { return ""; } };
``` The code was checking if the type specifier was directly preceded by `operator`. However there could be comments and `const/volatile` in between.
Reviewers: mprobst
Reviewed By: mprobst
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72911
show more ...
|
#
d45aafa2 |
| 06-Jan-2020 |
Mitchell Balan <mitchell@stellarscience.com> |
[clang-format] fix conflict between FormatStyle::BWACS_MultiLine and BeforeCatch/BeforeElse
Summary: Found a bug introduced with BraceWrappingFlags AfterControlStatement MultiLine. This feature conf
[clang-format] fix conflict between FormatStyle::BWACS_MultiLine and BeforeCatch/BeforeElse
Summary: Found a bug introduced with BraceWrappingFlags AfterControlStatement MultiLine. This feature conflicts with the existing BeforeCatch and BeforeElse flags.
For example, our team uses BeforeElse.
if (foo || bar) { doSomething(); } else { doSomethingElse(); }
If we enable MultiLine (which we'd really love to do) we expect it to work like this:
if (foo || bar) { doSomething(); } else { doSomethingElse(); }
What we actually get is:
if (foo || bar) { doSomething(); } else { doSomethingElse(); }
Reviewers: MyDeveloperDay, Bouska, mitchell-stellar
Patch by: pastey
Subscribers: Bouska, cfe-commits
Tags: clang
Differential Revision: https://reviews.llvm.org/D71939
show more ...
|
#
26748a32 |
| 03-Dec-2019 |
Mitchell Balan <mitchell@stellarscience.com> |
[clang-format] Add new option to add spaces around conditions Summary: This diff adds a new option SpacesAroundConditions that inserts spaces inside the braces for conditional statements.
Reviewers:
[clang-format] Add new option to add spaces around conditions Summary: This diff adds a new option SpacesAroundConditions that inserts spaces inside the braces for conditional statements.
Reviewers: klimek, owenpan, mitchell-stellar, MyDeveloperDay
Patch by: timwoj
Subscribers: rsmmr, cfe-commits
Tags: clang, clang-format
Differential Revision: https://reviews.llvm.org/D68346
show more ...
|
#
8682d29a |
| 30-Nov-2019 |
Brian Gesiak <modocache@gmail.com> |
[Format] Add format check for coroutine keywords with negative numbers
Summary: As a followup to D69144, this diff fixes the coroutine keyword spacing for co_yield / co_returning negative numbers.
[Format] Add format check for coroutine keywords with negative numbers
Summary: As a followup to D69144, this diff fixes the coroutine keyword spacing for co_yield / co_returning negative numbers.
Reviewers: modocache, sammccall, Quuxplusone
Reviewed By: modocache
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69180
Patch by Jonathan Thomas (jonathoma)!
show more ...
|
#
5987cc1b |
| 16-Nov-2019 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] fix regression in middle pointer alignment
Summary: a75f8d98d7ac introduced a regression with Middle pointer alignment, which this patch fixes.
Reviewers: MyDeveloperDay, klimek, sam
[clang-format] fix regression in middle pointer alignment
Summary: a75f8d98d7ac introduced a regression with Middle pointer alignment, which this patch fixes.
Reviewers: MyDeveloperDay, klimek, sammccall
Reviewed By: MyDeveloperDay, sammccall
Subscribers: cfe-commits, merge_guards_bot
Patch by: Typz
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70305
show more ...
|
#
a4a7c125 |
| 16-Nov-2019 |
mydeveloperday <mydeveloperday@gmail.com> |
[clang-format] Add SpaceBeforeBrackets
Summary: Adds a new option SpaceBeforeBrackets to add spaces before brackets (i.e. int a[23]; -> int a [23];) This is present as an option in the Visual Studi
[clang-format] Add SpaceBeforeBrackets
Summary: Adds a new option SpaceBeforeBrackets to add spaces before brackets (i.e. int a[23]; -> int a [23];) This is present as an option in the Visual Studio C++ code formatting settings, but there was no matching setting in clang-format.
Reviewers: djasper, MyDeveloperDay, mitchell-stellar
Reviewed By: MyDeveloperDay
Subscribers: llvm-commits, cfe-commits, klimek
Patch by: Anteru
Tags: #clang, #clang-format, #llvm
Differential Revision: https://reviews.llvm.org/D6920
show more ...
|
#
358eaa3d |
| 15-Nov-2019 |
Cameron Desrochers <Cameron.Desrochers@octasic.com> |
[clang-format] Flexible line endings
Line ending detection is now set with the `DeriveLineEnding` option. CRLF can now be used as the default line ending by setting `UseCRLF`. When line ending detec
[clang-format] Flexible line endings
Line ending detection is now set with the `DeriveLineEnding` option. CRLF can now be used as the default line ending by setting `UseCRLF`. When line ending detection is disabled, all line endings are converted according to the `UseCRLF` option.
Differential Revision: https://reviews.llvm.org/D19031
show more ...
|