History log of /llvm-project/clang/lib/Format/Format.cpp (Results 176 – 200 of 1154)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 9694332b 03-Feb-2022 Sven van Haastregt <sven.vanhaastregt@arm.com>

[clang-format] Add missing newline in -style help


# d079995d 02-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Elide unnecessary braces. NFC.


# 630c7360 02-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Elide unnecessary braces. NFC.


# 61f09bcf 02-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Use llvm::seq instead of std::iota. NFC.


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


# af8f1dbb 01-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Use std::iota and reserve when sorting Java imports. NFC.

This way we have at most 1 allocation even if the number of includes is greater than the on-stack size of the small vector.


# e75a3428 01-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Use std::iota and reserve. NFC.

This way we have at most 1 allocation even if the number of includes is greater than the on-stack size of the small vector.


# 545317cb 01-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Use ranged for loops. NFC.


# 95bf0a9e 31-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Don't break block comments when sorting includes.

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

Before, the include sorter would break the code:
```
#include <stdio.h>
#in

[clang-format] Don't break block comments when sorting includes.

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

Before, the include sorter would break the code:
```
#include <stdio.h>
#include <stdint.h> /* long
comment */
```
and change it into:
```
#include <stdint.h> /* long
#include <stdio.h>
comment */
```

This commit handles only the most basic case of a single block comment on an include line, but does not try to handle all the possible edge cases with multiple comments.

Reviewed By: HazardyKnusperkeks

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

show more ...


# 82452be5 20-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Refactor: add FormatToken::hasWhitespaceBefore(). NFC.

This factors out a pattern that comes up from time to time.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

Different

[clang-format] Refactor: add FormatToken::hasWhitespaceBefore(). NFC.

This factors out a pattern that comes up from time to time.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

show more ...


# 966f24e5 17-Jan-2022 Cameron Mulhern <csmulhern@gmail.com>

[clang-format] Add a BlockIndent option to AlignAfterOpenBracket

This style is similar to AlwaysBreak, but places closing brackets on new lines.

For example, if you have a multiline parameter list,

[clang-format] Add a BlockIndent option to AlignAfterOpenBracket

This style is similar to AlwaysBreak, but places closing brackets on new lines.

For example, if you have a multiline parameter list, clang-format currently only supports breaking per-parameter, but places the closing bracket on the line of the last parameter.

Function(
param1,
param2,
param3);

A style supported by other code styling tools (e.g. rustfmt) is to allow the closing brackets to be placed on their own line, aiding the user in being able to quickly infer the bounds of the block of code.

Function(
param1,
param2,
param3
);

For prior work on a similar feature, see: https://reviews.llvm.org/D33029.

Note: This currently only supports block indentation for closing parentheses.

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

show more ...


# 533fbae8 13-Dec-2021 Owen Pan <owenpiano@gmail.com>

[clang-format] Add experimental option to remove LLVM braces

See the style examples at:
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-

[clang-format] Add experimental option to remove LLVM braces

See the style examples at:
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

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

show more ...


# 359b4e6c 07-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Use prefix increment and decrement. NFC.


# 46db0301 05-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Simplify raw string regex. NFC.

Introduced in https://reviews.llvm.org/D115168.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

[clang-format] Simplify raw string regex. NFC.

Introduced in https://reviews.llvm.org/D115168.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

show more ...


# da6b0d0b 04-Jan-2022 Rajat Bajpai <rb.macboy@gmail.com>

[clang-format] Add an option to add a space between operator overloading and opening parentheses

This change adds an option AfterOverloadedOperator in SpaceBeforeParensOptions to add a space between

[clang-format] Add an option to add a space between operator overloading and opening parentheses

This change adds an option AfterOverloadedOperator in SpaceBeforeParensOptions to add a space between overloaded operator and opening parentheses in clang-format.

Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks

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

show more ...


# 6f6f88ff 28-Dec-2021 ksyx <18738953+ksyx@users.noreply.github.com>

[clang-format] Style to separate definition blocks

This commit resolves GitHub issue #45895 (Bugzilla #46550), to
add or remove empty line between definition blocks including
namespaces, classes, st

[clang-format] Style to separate definition blocks

This commit resolves GitHub issue #45895 (Bugzilla #46550), to
add or remove empty line between definition blocks including
namespaces, classes, structs, enums and functions.

Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks

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

show more ...


# cfe31807 03-Jan-2022 G. Pery <gpery@pm.me>

[clang-format] Add penalty for breaking after '('

My team has a vendetta against lines ending with an open parenthesis, thought it might be useful for others too ��

Reviewed By: HazardyKnusperkeks,

[clang-format] Add penalty for breaking after '('

My team has a vendetta against lines ending with an open parenthesis, thought it might be useful for others too ��

Reviewed By: HazardyKnusperkeks, curdeius

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

show more ...


# b9e173fc 03-Jan-2022 Zhao Wei Liew <zhaoweiliew@gmail.com>

[clang-format] Add option to explicitly specify a config file

This diff extends the -style=file option to allow a config file to be specified explicitly. This is useful (for instance) when adding ID

[clang-format] Add option to explicitly specify a config file

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.

Usage: `clang-format -style=file:<path/to/config/file> ...`

Reviewed By: HazardyKnusperkeks, curdeius, MyDeveloperDay, zwliew

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

show more ...


# 0090cd4e 03-Jan-2022 Zhao Wei Liew <zhaoweiliew@gmail.com>

[clang-format] Support inheriting from more than 1 parents in the fallback case

Currently, we are unable to inherit from a chain of parent configs where the outermost parent config has `BasedOnStyle

[clang-format] Support inheriting from more than 1 parents in the fallback case

Currently, we are unable to inherit from a chain of parent configs where the outermost parent config has `BasedOnStyle: InheritParentConfig` set. This patch adds a test case for this scenario, and adds support for it.

To illustrate, suppose we have the following directory structure:
```
- e/
|- .clang-format (BasedOnStyle: InheritParentConfig) <-- outermost config
|- sub/
|- .clang-format (BasedOnStyle: InheritParentConfig)
|- sub/
|- .clang-format (BasedOnStyle: InheritParentConfig)
|- code.cpp
```
Now consider what happens when we run `clang-format --style=file /e/sub/sub/code.cpp`.

Without this patch, on a release build, only the innermost config will be applied. On a debug build, clang-format crashes due to an assertion failure.
With this patch, clang-format behaves as we'd expect, applying all 3 configs.

Reviewed By: HazardyKnusperkeks, curdeius

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

show more ...


# 142e79b8 21-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] NFC use recently added Style.isJavaScript()

Improve the readability of these if(Style==FormatStyle::LK_JavsScript) clauses


# 05bea533 12-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] [PR49298] Sort includes pass will sort inside raw strings

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

clang-format does not respect raw string literals when sorting includes

`

[clang-format] [PR49298] Sort includes pass will sort inside raw strings

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

clang-format does not respect raw string literals when sorting includes

```
const char *RawStr = R"(
)";
```

Running clang-format over with SortIncludes enabled transforms this code to:

```
const char *RawStr = R"(
)";
```
The following code tries to minimize this impact during IncludeSorting, by treating R"( and )" as equivalent of // clang-format off/on

Reviewed By: HazardyKnusperkeks, curdeius

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

Fixes #48642

show more ...


# 93fc9161 24-Nov-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

The following 2 commits caused files in clang-format to no longer be clang-formatted.

we would lose our "cle

[clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

The following 2 commits caused files in clang-format to no longer be clang-formatted.

we would lose our "clean" status https://releases.llvm.org/13.0.0/tools/clang/docs/ClangFormattedStatus.html

c2271926a4fc - Make clang-format fuzz through Lexing with asserts enabled (https://github.com/llvm/llvm-project/commit/c2271926a4fc )

84bf5e328664 - Fix various problems found by fuzzing. (https://github.com/llvm/llvm-project/commit/84bf5e328664)

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


# d8e5a0c4 19-Nov-2021 Zarko Todorovski <zarko@ca.ibm.com>

[clang][NFC] Inclusive terms: replace some uses of sanity in clang

Rewording of comments to avoid using `sanity test, sanity check`.

Reviewed By: aaron.ballman, Quuxplusone

Differential Revision:

[clang][NFC] Inclusive terms: replace some uses of sanity in clang

Rewording of comments to avoid using `sanity test, sanity check`.

Reviewed By: aaron.ballman, Quuxplusone

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

show more ...


# c2271926 19-Nov-2021 Manuel Klimek <klimek@google.com>

Make clang-format fuzz through Lexing with asserts enabled.

Makes clang-format bail out if an in-memory source file with an
unsupported BOM is handed in instead of creating source locations that
are

Make clang-format fuzz through Lexing with asserts enabled.

Makes clang-format bail out if an in-memory source file with an
unsupported BOM is handed in instead of creating source locations that
are violating clang's assumptions.

In the future, we should add support to better transport error messages
like this through clang-format instead of printing to stderr and not
creating any changes.

show more ...


# 6facafe7 07-Nov-2021 C. Rayroud <rayroudc@gmail.com>

[clang-format] Refactor SpaceBeforeParens to add options

The coding style of some projects requires to have more control on space
before opening parentheses.
The goal is to add the support of clang-

[clang-format] Refactor SpaceBeforeParens to add options

The coding style of some projects requires to have more control on space
before opening parentheses.
The goal is to add the support of clang-format to more projects.
For example adding a space only for function definitions or
declarations.
This revision adds SpaceBeforeParensOptions to configure each option
independently from one another.

Differentiel Revision: https://reviews.llvm.org/D110833

show more ...


12345678910>>...47