History log of /llvm-project/clang/lib/Format/Format.cpp (Results 151 – 175 of 1154)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b1f0efc0 01-Jul-2022 Nico Weber <thakis@chromium.org>

[clang-format] Tweak help text a bit

In particular, make it clear that `--style=file` is the default,
since there's some confusion about this, e.g. here:
https://stackoverflow.com/questions/61455148

[clang-format] Tweak help text a bit

In particular, make it clear that `--style=file` is the default,
since there's some confusion about this, e.g. here:
https://stackoverflow.com/questions/61455148/

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

show more ...


# 9ed2e68c 26-Jun-2022 sstwcw <f0gukp2nk@protonmail.com>

[clang-format] Parse Verilog if statements

This patch mainly handles treating `begin` as block openers.

While and for statements will be handled in another patch.

Reviewed By: HazardyKnusperkeks

[clang-format] Parse Verilog if statements

This patch mainly handles treating `begin` as block openers.

While and for statements will be handled in another patch.

Reviewed By: HazardyKnusperkeks

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

show more ...


Revision tags: llvmorg-14.0.6
# 07b3446d 13-Jun-2022 owenca <owenpiano@gmail.com>

[clang-format] Never analyze insert/remove braces in the same pass

Turn off RemoveBracesLLVM while analyzing InsertBraces and vice
versa to avoid potential interference of each other and better the

[clang-format] Never analyze insert/remove braces in the same pass

Turn off RemoveBracesLLVM while analyzing InsertBraces and vice
versa to avoid potential interference of each other and better the
performance.

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

show more ...


Revision tags: llvmorg-14.0.5, llvmorg-14.0.4
# bebf7bdf 22-May-2022 owenca <owenpiano@gmail.com>

[clang-format][NFC] Insert/remove braces in clang/lib/Format/

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


# 6cd9633c 12-May-2022 owenca <owenpiano@gmail.com>

[clang-format] Handle comments below r_brace in RemoveBracesLLVM

If a closing brace is followed by a non-trailing comment, the
newline before the closing brace must also be removed.

Differential Re

[clang-format] Handle comments below r_brace in RemoveBracesLLVM

If a closing brace is followed by a non-trailing comment, the
newline before the closing brace must also be removed.

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

show more ...


Revision tags: llvmorg-14.0.3
# e8cc7490 28-Apr-2022 Krasimir Georgiev <krasimir@google.com>

Revert "[clang-format] SortIncludes should support "@import" lines in Objective-C"

This reverts commit d46fa023caa2db5a9f1e21dd038bcb626261d958.
Regressed include order in some cases with trailing c

Revert "[clang-format] SortIncludes should support "@import" lines in Objective-C"

This reverts commit d46fa023caa2db5a9f1e21dd038bcb626261d958.
Regressed include order in some cases with trailing comments, see the
comments on https://reviews.llvm.org/D121370. Will add a regression test
in a follow-up commit.

show more ...


# db57acff 26-Apr-2022 owenca <owenpiano@gmail.com>

[clang-format] Adjust editor cursor position past #include blocks

Fixes #55027.

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


Revision tags: llvmorg-14.0.2, llvmorg-14.0.1
# d46fa023 11-Apr-2022 Konrad Kleine <kkleine@redhat.com>

[clang-format] SortIncludes should support "@import" lines in Objective-C

Fixes [[ https://github.com/llvm/llvm-project/issues/38995 | #38995 ]]

This is an attempt to modify the regular expression

[clang-format] SortIncludes should support "@import" lines in Objective-C

Fixes [[ https://github.com/llvm/llvm-project/issues/38995 | #38995 ]]

This is an attempt to modify the regular expression to identify
`@import` and `import` alongside the regular `#include`. The challenging
part was not to support `@` in addition to `#` but how to handle
everything that comes after the `include|import` keywords. Previously
everything that wasn't `"` or `<` was consumed. But as you can see in
this example from the issue #38995, there is no `"` or `<` following the
keyword:

```
@import Foundation;
```

I experimented with a lot of fancy and useful expressions in [this
online regex tool](https://regex101.com) only to find out that some
things are simply not supported by the regex implementation in LLVM.

* For example the beginning `[\t\ ]*` should be replacable by the
horizontal whitespace character `\h*` but this will break the
`SortIncludesTest.LeadingWhitespace` test.

That's why I've chosen to come back to the basic building blocks.

The essential change in this patch is the change from this regular
expression:

```
^[\t\ ]*#[\t\ ]*(import|include)[^"<]*(["<][^">]*[">])
~ ~~~~~~~~~~~~~~
^ ^
| |
only support # prefix not @ |
only support "" and <> as
delimiters
no support for C++ modules and ;
ending. Also this allows for ">
or <" or "" or <> which all seems
either off or wrong.
```

to this:

```
^[\t\ ]*[@#][\t\ ]*(import|include)([^"]*("[^"]+")|[^<]*(<[^>]+>)|[\t\
]*([^;]+;))
~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
^ ^ ^ ^ ^
| | | | |
Now support @ and #. Clearly support "" and <> as
well as an
include name without enclosing
characters.
Allows for no mixture of "> or
<" or
empty include names.

```

Here is how I've tested this patch:

```
ninja clang-Format
ninja FormatTests
./tools/clang/unittests/Format/FormatTests
--gtest_filter=SortIncludesTest*
```

And if that worked I doubled checked that nothing else broke by running
all format checks:

```
./tools/clang/unittests/Format/FormatTests
```

One side effect of this change is it should partially support
[C++20 Module](https://en.cppreference.com/w/cpp/language/modules)
`import` lines without the optional `export` in front. Adding
this can be a change on its own that shouldn't be too hard. I say
partially because the `@` or `#` are currently *NOT* optional in the
regular expression.

I see an opportunity to optimized the matching to exclude `@include` for
example. But eventually these should be caught by the compiler, so...

With my change, the matching group is not at a fixed position any
longer. I decided to
choose the last match (group) that is not empty.

Reviewed By: HazardyKnusperkeks

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

show more ...


# 0cb9c6ea 13-Apr-2022 owenca <owenpiano@gmail.com>

[clang-format] Allow empty .clang-format file

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


# 0cde8bdb 12-Apr-2022 owenca <owenpiano@gmail.com>

Revert "[clang-format] Allow empty .clang-format file"

This reverts commit 4e814a6f2db90046914734fac4f9e3110c7e0424.


# 4e814a6f 12-Apr-2022 owenca <owenpiano@gmail.com>

[clang-format] Allow empty .clang-format file

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


# c80eaa91 12-Apr-2022 owenca <owenpiano@gmail.com>

Revert "[clang-format] Allow empty .clang-format file"

This reverts commit 6eafda0ef0543cad4b190002e9dae93b036a4ded.


# 6eafda0e 11-Apr-2022 owenca <owenpiano@gmail.com>

[clang-format] Allow empty .clang-format file

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


Revision tags: llvmorg-14.0.0
# c24b3db4 14-Mar-2022 sstwcw <f0gukp2nk@protonmail.com>

[clang-format] Add option to align compound assignments like `+=`

Reviewed By: curdeius, HazardyKnusperkeks, MyDeveloperDay

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


Revision tags: llvmorg-14.0.0-rc4
# 9f616a46 11-Mar-2022 owenca <owenpiano@gmail.com>

[clang-format][NFC] Group QualifierAlignment with other C++ passes

Also increases the initial size of Passes to 8 and move the
definition of BracesInserter up.

Differential Revision: https://review

[clang-format][NFC] Group QualifierAlignment with other C++ passes

Also increases the initial size of Passes to 8 and move the
definition of BracesInserter up.

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

show more ...


# 0be56c87 10-Mar-2022 owenca <owenpiano@gmail.com>

[clang-format][NFC] Group all C++ passes under isCpp()

Also removes a not very helpful comment.


Revision tags: llvmorg-14.0.0-rc3
# e2b219bd 10-Mar-2022 owenca <owenpiano@gmail.com>

[clang-format] Handle "// clang-format off" for RemoveBracesLLVM

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


# e6a8b92b 07-Mar-2022 Nico Weber <thakis@chromium.org>

[clang-format] Fix namespace end comments in ObjC++ files too

See also d96ae867351ec.

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


# 1aa608a0 03-Mar-2022 owenca <owenpiano@gmail.com>

[clang-format] Handle wrapped else for RemoveBracesLLVM

Removes the newline before the right brace that's followed by an
else on the next line.

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

[clang-format] Handle wrapped else for RemoveBracesLLVM

Removes the newline before the right brace that's followed by an
else on the next line.

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

show more ...


Revision tags: llvmorg-14.0.0-rc2
# c05da55b 24-Feb-2022 owenca <owenpiano@gmail.com>

[clang-format] Handle trailing comment for InsertBraces

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


Revision tags: llvmorg-14.0.0-rc1
# 77e60bc4 08-Feb-2022 owenca <owenpiano@gmail.com>

[clang-format] Add option to insert braces after control statements

Adds a new option InsertBraces to insert the optional braces after
if, else, for, while, and do in C++.

Differential Revision: ht

[clang-format] Add option to insert braces after control statements

Adds a new option InsertBraces to insert the optional braces after
if, else, for, while, and do in C++.

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

show more ...


# aacc110b 21-Feb-2022 Krystian Kuzniarek <krystian.kuzniarek@gmail.com>

[clang-format][NFC] Fix typos and inconsistencies

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


Revision tags: llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1
# b786a4ae 07-Nov-2021 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Extend SpaceBeforeParens for requires

We can now configure the space between requires and the following paren,
seperate for clauses and expressions.

Differential Revision: https://re

[clang-format] Extend SpaceBeforeParens for requires

We can now configure the space between requires and the following paren,
seperate for clauses and expressions.

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

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


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


12345678910>>...47