History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 476 – 500 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 60bf5826 25-Jan-2021 Albertas Vyšniauskas <thezbyg@gmail.com>

[clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

Add new option called InsertEmptyLineBeforeAccessModifier. Empty line
before access modifier is inerted if thi

[clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

Add new option called InsertEmptyLineBeforeAccessModifier. Empty line
before access modifier is inerted if this option is set to true (which
is the default value, because clang-format always inserts empty lines
before access modifiers), otherwise empty lines are removed.

Fixes issue #16518.

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

show more ...


# 3395a336 25-Jan-2021 Lukas Barth <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 i

[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: curdeius, HazardyKnusperkeks

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

show more ...


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


# cbdde495 18-Jan-2021 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Apply Allman style to lambdas

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


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


# 00dc97f1 17-Jan-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] PR48594 BraceWrapping: SplitEmptyRecord ignored for templates

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

Empty or small templates were not being treated the same way as small classe

[clang-format] PR48594 BraceWrapping: SplitEmptyRecord ignored for templates

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

Empty or small templates were not being treated the same way as small classes especially when SplitEmptyRecord was set to true

This revision aims to help this by identifying a case when we should try not to merge the lines together

Reviewed By: curdeius, JohelEGP

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

show more ...


# 9af03864 17-Jan-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] Revert e9e6e3b34a8e

Reverting {D92753} due to issues with #pragma indentation in #ifdef/endif structure


# c7dcc4c7 26-Dec-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] PR48569 clang-format fails to align case label with `switch` with Whitesmith Indentation

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

This is a tentative fix which addresses a PR rais

[clang-format] PR48569 clang-format fails to align case label with `switch` with Whitesmith Indentation

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

This is a tentative fix which addresses a PR raise regarding Case indentation when working with Whitesmiths Indentation

I could not find online any reference sources as to what the case indentation for Whitesmith's should be (or be allowed to be)

But according to the documentation, we don't obey the rules for Whitesmith's

```
In particular, the documentation states that this option is to "indent case labels one level from the switch statement. When false, use the same indentation level as for the switch statement."
```

The behaviour we add here is actually as the TODO in the tests used to state in {D67627}, but when {D82016} was added and I brought these tests out from being TODO I realized I changed the indentation.

Reviewed By: curdeius, HazardyKnusperkeks

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

show more ...


Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2
# 47877c90 14-Dec-2020 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Add SpaceBeforeCaseColon option

With which you can add a space before the colon of a case or default
statement.

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


# 5426b2f9 23-Dec-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] PR48535 clang-format Incorrectly Removes Space After C Style Cast When Type Is Not a Pointer

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

using `SpaceAfterCStyleCast: true`

```
size_

[clang-format] PR48535 clang-format Incorrectly Removes Space After C Style Cast When Type Is Not a Pointer

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

using `SpaceAfterCStyleCast: true`

```
size_t idx = (size_t) a;
size_t idx = (size_t) (a - 1);
```

is formatted as:

```
size_t idx = (size_t) a;
size_t idx = (size_t)(a - 1);
```

This revision aims to improve that by improving the function which tries to identify a CastRParen

Reviewed By: curdeius

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

show more ...


# db41c0b3 17-Dec-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] PR35514 brace-init member initializers in function-try-blocks are not formatted correctly

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

Initializer lists with a try-block are incorrect

[clang-format] PR35514 brace-init member initializers in function-try-blocks are not formatted correctly

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

Initializer lists with a try-block are incorrectly formatted.

e.g.

```
Foo(int abc, int def) try : _abc(abc), _def{def}, _ghi{1} {
callA();
callB();
} catch (std::exception&) {
}
```

is formatted as:

```
Foo(int abc, int def) try : _abc(abc), _def { def }
, _ghi{1} {
callA();
callB();
}
catch (std::exception&) {
}
```

This revision adds support in the parseTryCatch for braced initializers in the initializer list

Reviewed By: curdeius, HazardyKnusperkeks

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

show more ...


# 8b48d243 15-Dec-2020 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[clang-format] Recognize c++ coroutine keywords as unary operator to avoid misleading pointer alignment

Summary: The clang-format may go wrong when handle c++ coroutine keywords and pointer.
The def

[clang-format] Recognize c++ coroutine keywords as unary operator to avoid misleading pointer alignment

Summary: The clang-format may go wrong when handle c++ coroutine keywords and pointer.
The default value for PointerAlignment is PAS_Right. So the following format is good:
```
co_return *a;
```
But within some code style, the value for PointerAlignment is PAS_Left, the behavior goes wrong:
```
co_return* a;
```

test-plan: check-clang

reviewers: MyDeveloperDay

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

show more ...


# e9e6e3b3 10-Dec-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] Add IndentPragma style to eliminate common clang-format off scenario

A quick search of github.com, shows one common scenario for excessive use of //clang-format off/on is the indentat

[clang-format] Add IndentPragma style to eliminate common clang-format off scenario

A quick search of github.com, shows one common scenario for excessive use of //clang-format off/on is the indentation of #pragma's, especially around the areas of loop optimization or OpenMP

This revision aims to help that by introducing an `IndentPragmas` style, the aim of which is to keep the pragma at the current level of scope

```
for (int i = 0; i < 5; i++) {
// clang-format off
#pragma HLS UNROLL
// clang-format on
for (int j = 0; j < 5; j++) {
// clang-format off
#pragma HLS UNROLL
// clang-format on
....
```

can become

```
for (int i = 0; i < 5; i++) {
#pragma HLS UNROLL
for (int j = 0; j < 5; j++) {
#pragma HLS UNROLL
....
```

This revision also support working alongside the `IndentPPDirective` of `BeforeHash` and `AfterHash` (see unit tests for examples)

Reviewed By: curdeius

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

show more ...


# 7b2d62fd 10-Dec-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] PR42434 Remove preprocessor and pragma lines from ObjectiveC guess

clang-format see the `disable:` in __pragma(warning(disable:)) as ObjectiveC method call

Remove any line starting

[clang-format] PR42434 Remove preprocessor and pragma lines from ObjectiveC guess

clang-format see the `disable:` in __pragma(warning(disable:)) as ObjectiveC method call

Remove any line starting with `#` or __pragma line from being part of the ObjectiveC guess

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

Reviewed By: curdeius, krasimir

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

show more ...


# 8668eae2 05-Dec-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] Add option for case sensitive regexes for sorted includes

I think the title says everything.

Reviewed By: MyDeveloperDay

Patch By: HazardyKnusperkeks

Differential Revision: https:

[clang-format] Add option for case sensitive regexes for sorted includes

I think the title says everything.

Reviewed By: MyDeveloperDay

Patch By: HazardyKnusperkeks

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

show more ...


# 840e651d 04-Dec-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] Improve clang-formats handling of concepts

This is a starting point to improve the handling of concepts in clang-format. There is currently no real formatting of concepts and this can

[clang-format] Improve clang-formats handling of concepts

This is a starting point to improve the handling of concepts in clang-format. There is currently no real formatting of concepts and this can lead to some odd formatting, e.g.

Reviewed By: mitchell-stellar, miscco, curdeius

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

show more ...


Revision tags: llvmorg-11.0.1-rc1
# 1e4d6d1c 31-Oct-2020 Mark Nauwelaerts <mark.nauwelaerts@gmail.com>

[clang-format] Add new option PenaltyIndentedWhitespace

Reviewed By: MyDeveloperDay

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


# 906b9dbc 02-Nov-2020 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>

[clang-format] Improve BAS_DontAlign+AllowAllArgumentsOnNextLine=false

TokenAnnotator::splitPenalty() was always returning 0 for opening parens if
AlignAfterOpenBracket was set to BAS_DontAlign, so

[clang-format] Improve BAS_DontAlign+AllowAllArgumentsOnNextLine=false

TokenAnnotator::splitPenalty() was always returning 0 for opening parens if
AlignAfterOpenBracket was set to BAS_DontAlign, so the preferred point for
line breaking was always after the open paren (and was ignoring
PenaltyBreakBeforeFirstCallParameter). This change restricts the zero
penalty to the AllowAllArgumentsOnNextLine case. This results in improved
formatting for FreeBSD where we set AllowAllArgumentsOnNextLine: false
and a high value for PenaltyBreakBeforeFirstCallParameter to avoid breaking
after the open paren.

Before:
```
functionCall(
paramA, paramB, paramC);
void functionDecl(
int A, int B, int C)
```
After:
```
functionCall(paramA, paramB,
paramC);
void functionDecl(int A, int B,
int C)
```

Reviewed By: MyDeveloperDay

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

show more ...


# 85032534 27-Oct-2020 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>

[clang-format] Fix misformatted macro definitions after D86959

After D86959 the code `#define lambda [](const decltype(x) &ptr) {}`
was formatted as `#define lambda [](const decltype(x) & ptr) {}` d

[clang-format] Fix misformatted macro definitions after D86959

After D86959 the code `#define lambda [](const decltype(x) &ptr) {}`
was formatted as `#define lambda [](const decltype(x) & ptr) {}` due to
now parsing the '&' token as a BinaryOperator. The problem was caused by
the condition `Line.InPPDirective && (!Left->Previous || !Left->Previous->is(tok::identifier))) {`
being matched and therefore not performing the checks for "previous token
is one of decltype/_Atomic/etc.". This patch moves those checks after the
existing if/else chain to ensure the left-parent token classification is
always run after checking whether the contents of the parens is an
expression or not.

This change also introduces a new TokenAnnotatorTest that checks the
token kind and Role of Tokens after analyzing them. This is used to check
for TT_PointerOrReference, in addition to indirectly testing this based
on the resulting formatting.

Reviewed By: MyDeveloperDay

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

show more ...


# 66a3b907 19-Oct-2020 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>

[clang-format] Drop clangFrontend dependency for FormatTests

This allows building the clang-format unit tests in only 657 ninja steps
rather than 1257 which allows for much faster incremental builds

[clang-format] Drop clangFrontend dependency for FormatTests

This allows building the clang-format unit tests in only 657 ninja steps
rather than 1257 which allows for much faster incremental builds after a
git pull.

Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D89709

show more ...


# 9e27f383 18-Oct-2020 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>

[clang-format] Add a SpaceAroundPointerQualifiers style option

Some projects (e.g. FreeBSD) align pointers to the right but expect a
space between the '*' and any pointer qualifiers such as const. T

[clang-format] Add a SpaceAroundPointerQualifiers style option

Some projects (e.g. FreeBSD) align pointers to the right but expect a
space between the '*' and any pointer qualifiers such as const. To handle
these cases this patch adds a new config option SpaceAroundPointerQualifiers
that can be used to configure whether spaces need to be added before/after
pointer qualifiers.

PointerAlignment = Right
SpaceAroundPointerQualifiers = Default/After:
void *const *x = NULL;
SpaceAroundPointerQualifiers = Before/Both
void * const *x = NULL;

PointerAlignment = Left
SpaceAroundPointerQualifiers = Default/Before:
void* const* x = NULL;
SpaceAroundPointerQualifiers = After/Both
void* const * x = NULL;

PointerAlignment = Middle
SpaceAroundPointerQualifiers = Default/Before/After/Both:
void * const * x = NULL;

Reviewed By: MyDeveloperDay

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

show more ...


# 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
# f64903fd 18-Aug-2020 Joachim Meyer <joachim@joameyer.de>

Add -Wno-error=unknown flag to clang-format.

Currently newer clang-format options cannot be included in .clang-format files, if not all users can be forced to use an updated version.
This patch trie

Add -Wno-error=unknown flag to clang-format.

Currently newer clang-format options cannot be included in .clang-format files, if not all users can be forced to use an updated version.
This patch tries to solve this by adding an option to clang-format, enabling to ignore unknown (newer) options.

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

show more ...


1...<<11121314151617181920>>...82