History log of /llvm-project/clang/unittests/Format/FormatTestCSharp.cpp (Results 1 – 25 of 86)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3
# d005be33 23-Oct-2024 Owen Pan <owenpiano@gmail.com>

[clang-format] Handle C# `goto case` constructs (#113257)

Fixes #113256.


# b5bcdb5c 22-Oct-2024 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a crash on C# `goto case` (#113056)

Fixes #113011.


Revision tags: llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3
# d990cc45 13-Aug-2024 Owen Pan <owenpiano@gmail.com>

[clang-format] Correctly handle C# attribute on auto property (#102921)

Fixes #101487.


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7
# 1c58208d 21-May-2024 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Remove redundnat llvm::, clang::, etc.


Revision tags: llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3
# d821650e 15-Feb-2024 rmarker <37921131+rmarker@users.noreply.github.com>

[clang-format][NFC] Drop "Always" in "AlwaysBreakAfterReturnType". (#81591)

Complete the switch from "AlwaysBreakAfterReturnType" to
"BreakAfterReturnType".


Revision tags: llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init
# e3acfbc4 15-Jan-2024 sstwcw <su3e8a96kzlver@posteo.net>

[clang-format] Stop aligning the to continuation lines (#76378)

Some unwrapped lines are marked as continuations of the previous lines,
for example the ports in a Verilog module header. Previously,

[clang-format] Stop aligning the to continuation lines (#76378)

Some unwrapped lines are marked as continuations of the previous lines,
for example the ports in a Verilog module header. Previously, if the
first line following the ports line was changed, and git-clang-format
was run, the changed line would be indented by an extra continuation
indentation.

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4
# 88934a82 27-Oct-2023 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Remove extraneous newlines in some unit test files


Revision tags: llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# ddc80637 29-Jun-2023 sstwcw <su3e8a96kzlver@posteo.net>

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
s

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
strings are not broken.

A new subclass BreakableStringLiteralUsingOperators is used to handle
the logic for adding plus signs and commas. The updateAfterBroken
method was added because now parentheses or braces may be required after
the parentheses or commas are added. In order to decide whether the
added plus sign should be unindented in the BreakableToken object, the
logic for it is taken out into a separate function
shouldUnindentNextOperator.

The logic for finding the continuation indentation when the option
AlignAfterOpenBracket is set to DontAlign is not implemented yet. So in
that case the new line may have the wrong indentation, and the parts may
have the wrong length if the string needs to be broken more than once
because finding where to break the string depends on where the string
starts.

The preambles for the C# and Java unit tests are changed to the newer
style in order to allow the 3-argument verifyFormat macro. Some cases
are changed from verifyFormat to verifyImcompleteFormat because those
use incomplete code and the new verifyFormat function checks that the
code is complete.

The line in the doc was changed to being indented by 4 spaces, that is,
the default continuation indentation. It has always been the case. It
was probably a mistake that the doc showed 2 spaces previously.

This commit was fist committed as 16ccba51072b. The tests caused
assertion failures. Then it was reverted in 547bce36132a.

Reviewed By: MyDeveloperDay

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

show more ...


# 547bce36 24-Aug-2023 David Spickett <david.spickett@linaro.org>

Revert "[clang-format] Break long string literals in C#, etc."

This reverts commit 16ccba51072bbc5ff4c66f91f939163dc91e5d96.

This is failing across Linaro's bots e.g.:
https://lab.llvm.org/buildbot

Revert "[clang-format] Break long string literals in C#, etc."

This reverts commit 16ccba51072bbc5ff4c66f91f939163dc91e5d96.

This is failing across Linaro's bots e.g.:
https://lab.llvm.org/buildbot/#/builders/188/builds/34393

show more ...


# 16ccba51 29-Jun-2023 sstwcw <su3e8a96kzlver@posteo.net>

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
s

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
strings are not broken.

A new subclass BreakableStringLiteralUsingOperators is used to handle
the logic for adding plus signs and commas. The updateAfterBroken
method was added because now parentheses or braces may be required after
the parentheses or commas are added. In order to decide whether the
added plus sign should be unindented in the BreakableToken object, the
logic for it is taken out into a separate function
shouldUnindentNextOperator.

The logic for finding the continuation indentation when the option
AlignAfterOpenBracket is set to DontAlign is not implemented yet. So in
that case the new line may have the wrong indentation, and the parts may
have the wrong length if the string needs to be broken more than once
because finding where to break the string depends on where the string
starts.

The preambles for the C# and Java unit tests are changed to the newer
style in order to allow the 3-argument verifyFormat macro. Some cases
are changed from verifyFormat to verifyImcompleteFormat because those
use incomplete code and the new verifyFormat function checks that the
code is complete.

The line in the doc was changed to being indented by 4 spaces, that is,
the default continuation indentation. It has always been the case. It
was probably a mistake that the doc showed 2 spaces previously.

Reviewed By: MyDeveloperDay

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

show more ...


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2
# 63395cb0 17-Apr-2023 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] CSharp don't allow there not to be a space between `is` and `[`

as `is` is a keyword in C# ensure there is always a space before the `[` regardless of `SpaceBeforeSquareBrackets` sett

[clang-format] CSharp don't allow there not to be a space between `is` and `[`

as `is` is a keyword in C# ensure there is always a space before the `[` regardless of `SpaceBeforeSquareBrackets` setting

Fixes: #61965

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

Reviewed By: owenpan, HazardyKnusperkeks

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

show more ...


Revision tags: llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6
# a72609ca 24-Nov-2022 Sam McCall <sam.mccall@gmail.com>

[Format] Don't crash on mismatched brackets


Revision tags: llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2
# b60e7a7f 02-Oct-2022 owenca <owenpiano@gmail.com>

[clang-format] Handle C# interpolated verbatim string prefix @$

Fixes #58062.

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


# 258d7b86 26-Sep-2022 Danil Sidoruk <patriotrossii2019@mail.ru>

[clang-format] Handle constructor invocations after new operator in C# correct

Fixes #56549.

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


Revision tags: llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init
# 0ffb3dd3 23-Jul-2022 owenca <owenpiano@gmail.com>

[clang-format] Fix a hang when formatting C# $@ string literals

Fixes #56624.

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


Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3
# f537a409 07-Mar-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Correctly detect `!` as TT_NonNullAssertion after `default`.

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

Depends on D121132.

Reviewed By: HazardyKnusperkeks, owenpan

D

[clang-format] Correctly detect `!` as TT_NonNullAssertion after `default`.

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

Depends on D121132.

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


# 7a54fceb 07-Mar-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Handle C# 9 `init` accessor specifier.

Before, the code:
```
int Value { get; } = 0;
int Value { init; } = 0;
```
was formatted incoherently:
```
int Value { get; } = 0;
int Value { i

[clang-format] Handle C# 9 `init` accessor specifier.

Before, the code:
```
int Value { get; } = 0;
int Value { init; } = 0;
```
was formatted incoherently:
```
int Value { get; } = 0;
int Value { init; }
= 0;
```
because `init` was not recognised as an accessor specifier.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

show more ...


Revision tags: llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3
# 7af11989 14-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Fix short functions being considered as inline inside an indented namespace.

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

With config:
```
AllowShortFunctionsOnASingleLin

[clang-format] Fix short functions being considered as inline inside an indented namespace.

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

With config:
```
AllowShortFunctionsOnASingleLine: Inline
NamespaceIndentation: All
```

The code:
```
namespace Test
{
void f()
{
return;
}
}
```
was incorrectly formatted to:
```
namespace Test
{
void f() { return; }
}
```

since the function `f` was considered being inside a class/struct/record.
That's because the check was simplistic and only checked for a non-zero indentation level of the line starting `f`.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

show more ...


Revision tags: llvmorg-13.0.1-rc2
# 163c13fe 17-Dec-2021 Peter Stys <peterstys@google.com>

[clang-format] Fix formatting of the code that follows C# Lambda Expressions

The alignment fix introduced by https://reviews.llvm.org/D104388 caused a regression whereby formatting of code that foll

[clang-format] Fix formatting of the code that follows C# Lambda Expressions

The alignment fix introduced by https://reviews.llvm.org/D104388 caused a regression whereby formatting of code that follows the lambda block is incorrect i.e. separate expressions are put on the same line.

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

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


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

[clang-format] C# switch expression formatting differs from normal switch formatting

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

clang-format doesn't format C# switch expressions very well.

[clang-format] C# switch expression formatting differs from normal switch formatting

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

clang-format doesn't format C# switch expressions very well.

Start with this small use case and try and improve the output. I'll look for other examples to add as tests

Reviewed By: curdeius

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

Fixes #52677

show more ...


Revision tags: llvmorg-13.0.1-rc1
# 6e58d14e 13-Nov-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] [PR52228] clang-format csharp inconsistant nested namespace indentation

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

For multilevel namespaces in C# get their content indented when Na

[clang-format] [PR52228] clang-format csharp inconsistant nested namespace indentation

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

For multilevel namespaces in C# get their content indented when NamespaceIndentation: None is set, where as single level namespaces are formatted correctly.

Reviewed By: HazardyKnusperkeks, jbcoe

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

show more ...


Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3
# ed367b9d 27-Aug-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] [PR51640] - New AfterEnum brace wrapping changes have cause C# behaviour to change

LLVM 13.0.0-rc2 shows change of behaviour in enum and interface BraceWrapping (likely before we simp

[clang-format] [PR51640] - New AfterEnum brace wrapping changes have cause C# behaviour to change

LLVM 13.0.0-rc2 shows change of behaviour in enum and interface BraceWrapping (likely before we simply didn't wrap) but may be related to {D99840}

Logged as https://bugs.llvm.org/show_bug.cgi?id=51640

This change ensure AfterEnum works for

`internal|public|protected|private enum A {` in the same way as it works for `enum A {` in C++

A similar issue was also observed with `interface` in C#

Reviewed By: krasimir, owenpan

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

show more ...


Revision tags: llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1
# 71616722 28-Jul-2021 Luna Kirkby <llvm@moonbase.lgbt>

[clang-format] Correctly attach enum braces with ShortEnums disabled

Previously, with AllowShortEnumsOnASingleLine disabled, enums that would have otherwise fit on a single line would always put the

[clang-format] Correctly attach enum braces with ShortEnums disabled

Previously, with AllowShortEnumsOnASingleLine disabled, enums that would have otherwise fit on a single line would always put the opening brace on its own line.
This patch ensures that these enums will only put the brace on its own line if the existing attachment rules indicate that it should.

Reviewed By: HazardyKnusperkeks, curdeius

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

show more ...


Revision tags: llvmorg-14-init
# f9937106 01-Jul-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] PR50727 C# Invoke Lamda Expression indentation incorrect

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

When processing C# Lambda expression in the indentation can goes a little wrong,

[clang-format] PR50727 C# Invoke Lamda Expression indentation incorrect

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

When processing C# Lambda expression in the indentation can goes a little wrong,
resulting the the closing } being at the wrong indentation level and meaning the remaining part of the file is
incorrectly indented.

This can be a fairly common pattern for when C# wants to peform a UI action from a thread,
and it wants to invoke that action on the main thread

Reviewed By: exv, jbcoe

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

show more ...


1234