History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 201 – 225 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b4e35c63 08-Feb-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Insert a space between a numeric UDL and a dot

Fixes #60576.

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


# c24cdd58 06-Feb-2023 Backl1ght <backlight.zzk@gmail.com>

[clang-format] PackConstructorInitializers support PCIS_OnlyNextLine

fixes https://github.com/llvm/llvm-project/issues/60241

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


# 35f2ac17 05-Feb-2023 David Turner <turner_david_k@cat.com>

[clang-format] Fix inconsistent annotation of operator&

Token annotator incorrectly annotates operator& as a reference type in
situations like Boost serialization archives:
https://www.boost.org/doc

[clang-format] Fix inconsistent annotation of operator&

Token annotator incorrectly annotates operator& as a reference type in
situations like Boost serialization archives:
https://www.boost.org/doc/libs/1_81_0/libs/serialization/doc/tutorial.html

Add annotation rules for standalone and chained operator& instances while
preserving behavior for reference declarations at class scope. Add tests to
validate annotation and formatting behavior.

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

show more ...


# 25e2d0f3 28-Jan-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Support clang-format on/off line comments as prefix

Closes #60264.

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


# 8a3de135 27-Jan-2023 Emilia Dreamer <emilia@rymiel.space>

[clang-format] Disallow templates to be followed by literal

There should not be any cases where the angle brackets of template
parameters are directly followed by a literal. It is more likely that a

[clang-format] Disallow templates to be followed by literal

There should not be any cases where the angle brackets of template
parameters are directly followed by a literal. It is more likely that a
comparison is taking place instead.

This patch makes the TokenAnnotator prefer to annotate < and > as
operators when directly followed by a literal. A similar check already
exists for literals directly *before* potential template args.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

show more ...


# 56313f65 23-Jan-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Put peekNextToken(/*SkipComment=*/true) to good use

To prevent potential bugs in situations where we want to peek the next
non-comment token.

Differential Revision: https://reviews.l

[clang-format] Put peekNextToken(/*SkipComment=*/true) to good use

To prevent potential bugs in situations where we want to peek the next
non-comment token.

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

show more ...


# 02fd0020 22-Jan-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix bugs in parsing C++20 module import statements

Also fixes #60145.

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


# e3eca335 13-Jan-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Replace DeriveLineEnding and UseCRLF with LineEnding

Below is the mapping:
LineEnding DeriveLineEnding UseCRLF
LF false false
CRLF false true

[clang-format] Replace DeriveLineEnding and UseCRLF with LineEnding

Below is the mapping:
LineEnding DeriveLineEnding UseCRLF
LF false false
CRLF false true
DeriveLF true false
DeriveCRLF true true

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

show more ...


# 2e2aa8bb 12-Jan-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a bug in DerivePointerAlignment fallback

Fixes #59953.

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


# 922c8891 11-Jan-2023 Krasimir Georgiev <krasimir@google.com>

Revert "Revert "[clang-format] Add an option for breaking after C++11 attributes""

This reverts commit 879bfe6a979295f834b76df66b19a203b93eed0f.

owenpan@ pointed out on https://reviews.llvm.org/D14

Revert "Revert "[clang-format] Add an option for breaking after C++11 attributes""

This reverts commit 879bfe6a979295f834b76df66b19a203b93eed0f.

owenpan@ pointed out on https://reviews.llvm.org/D140956 that this
actually makes the formatting more consistent, so it's not a regression.

show more ...


# 0904e0ba 11-Jan-2023 Emilia Dreamer <emilia@rymiel.space>

[clang-format] Properly handle the C11 _Generic keyword.

This patch properly recognizes the generic selection expression
introduced in C11, by adding an additional token type for the colons
present

[clang-format] Properly handle the C11 _Generic keyword.

This patch properly recognizes the generic selection expression
introduced in C11, by adding an additional token type for the colons
present in such expressions.

Previously, they would be recognized as
"inline ASM colons" purely by the fact that those are the last thing
checked for.

I tried to avoid adding an addition token type, but since colons by
default like having spaces around them, I chose to add a new type so
that no space is added after the type selector.

Currently, no aspect of the formatting of these expressions in able to
be configured, as I'm not sure what could even be configured here.

One notable thing is that association list is always formatted as
either entirely on one line, if it can fit, or with line breaks
after every comma in the expression (also after the controlling expr.)

This visually makes them more similar to switch statements when long,
matching the behaviour of the selection expression, being that of a sort
of switch on types, but also allows for terseness when only selecting
for a few things.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

show more ...


# 51ba660a 11-Jan-2023 Emilia Dreamer <emilia@rymiel.space>

[clang-format] Inherit RightAlign options across scopes

D119599 added the ability to align compound assignments, right aligning
them in order to line up at the equals sign.
However, that patch didn'

[clang-format] Inherit RightAlign options across scopes

D119599 added the ability to align compound assignments, right aligning
them in order to line up at the equals sign.
However, that patch didn't account for AlignTokens being called
recursively across scopes, which reset the right justification to be
false in any scope besides the top scope. This meant the compound
assignments were aligned, just not at the right place.
(No tests also ever introduced any scopes)

This patch makes sure to inherit the right justification value, just as
every other parameter is passed on.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

show more ...


# 879bfe6a 10-Jan-2023 Krasimir Georgiev <krasimir@google.com>

Revert "[clang-format] Add an option for breaking after C++11 attributes"

This reverts commit a28f0747c2f3728bd8a6f64f7c8ba80b4e0cda9f.

It appears that this regresses some function definitions, add

Revert "[clang-format] Add an option for breaking after C++11 attributes"

This reverts commit a28f0747c2f3728bd8a6f64f7c8ba80b4e0cda9f.

It appears that this regresses some function definitions, added an
example as a comment over at https://reviews.llvm.org/D140956.

show more ...


# b62906b0 06-Jan-2023 Backl1ght <backlight.zzk@gmail.com>

[clang-format] fix template closer followed by >

fix https://github.com/llvm/llvm-project/issues/59785

Reviewed By: HazardyKnusperkeks, MyDeveloperDay, owenpan

Differential Revision: https://revie

[clang-format] fix template closer followed by >

fix https://github.com/llvm/llvm-project/issues/59785

Reviewed By: HazardyKnusperkeks, MyDeveloperDay, owenpan

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

show more ...


# d9899501 06-Jan-2023 Emilia Dreamer <emilia@rymiel.space>

[clang-format] Disallow decltype in the middle of constraints

If a function with a `requires` clause as a constraint has a decltype
return type, such as `decltype(auto)`, the decltype was seen to be

[clang-format] Disallow decltype in the middle of constraints

If a function with a `requires` clause as a constraint has a decltype
return type, such as `decltype(auto)`, the decltype was seen to be part
of the constraint clause, rather than as part of the function
declaration, causing it to be placed on the wrong line.

This patch disallows decltype to be a part of these clauses

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

Depends on D140339

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

show more ...


# b1eeec61 06-Jan-2023 Emilia Dreamer <emilia@rymiel.space>

[clang-format] Remove special logic for parsing concept definitions.

Previously, clang-format relied on a special method to parse concept
definitions, `UnwrappedLineParser::parseConcept()`, which de

[clang-format] Remove special logic for parsing concept definitions.

Previously, clang-format relied on a special method to parse concept
definitions, `UnwrappedLineParser::parseConcept()`, which deferred to
`UnwrappedLineParser::parseConstraintExpression()`. This is problematic,
because the C++ grammar treats concepts and requires clauses
differently, causing issues such as https://github.com/llvm/llvm-project/issues/55898 and https://github.com/llvm/llvm-project/issues/58130.

This patch removes `parseConcept`, letting the formatter parse concept
definitions as more like what they actually are, fancy bool definitions.

NOTE that because of this, some long concept definitions change in their
formatting, as can be seen in the changed tests. This is because of a
change in split penalties, caused by a change in MightBeFunctionDecl on
the concept definition line, which was previously `true` but with this
patch is now `false`.

One might argue that `false` is a more "correct" value for concept
definitions, but I'd be fine with setting it to `true` again to maintain
compatibility with previous versions.

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

Depends on D140330

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

show more ...


# 54fab18c 06-Jan-2023 Emilia Dreamer <emilia@rymiel.space>

[clang-format] Require space before noexcept qualifier

This brings the noexcept qualifier more visually in line with the other
keyword qualifiers, such as "final" and "override".

Originally reporte

[clang-format] Require space before noexcept qualifier

This brings the noexcept qualifier more visually in line with the other
keyword qualifiers, such as "final" and "override".

Originally reported as https://github.com/llvm/llvm-project/issues/44542,
it was closed as "working by design" and reinforcing tests were added
as part of a218706cba90248be0c60bd6a8f10dbcf0270955. The exact spacing
depended on the `PointerAlignment` option, where the default value of
`Right` would leave no space.

This patch seeks to change this behaviour, regardless of the configured
`PointerAlignment` option (matching the previous behaviour of the `Left`
option).

Closes https://github.com/llvm/llvm-project/issues/59729

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

show more ...


# 2c6ecc9d 05-Jan-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Add an option to insert a newline at EOF if missing

Closes #38042.

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


# a28f0747 04-Jan-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Add an option for breaking after C++11 attributes

Fixes #45968.
Fixes #54265.
Fixes #58102.

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


# 83843479 16-Dec-2022 Emilia Dreamer <emilia@rymiel.space>

[clang-format] Don't require deduction guides to be templates

The C++ standard doesn't require that class template deduction guides
be templates themselves, but previously `isDeductionGuide` would a

[clang-format] Don't require deduction guides to be templates

The C++ standard doesn't require that class template deduction guides
be templates themselves, but previously `isDeductionGuide` would assert
for the existence of a template closer or requires clause closer before
the deduction guide declaration.

This patch simply removes that check. Because of this, a test which
asserted that `x()->x<1>;` *isn't* a deduction guide failed, as it is
now formatted as a deduction guide. However, as @JohelEGP demonstrated,
it is [possible to make that a viable deduction guide][1].

Thus, that test has been removed, but other tests related to
non-template class template deduction guides have been added.

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

[1]: https://compiler-explorer.com/z/Wx3K6d5K9

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


# 15f121e8 04-Dec-2022 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix an assertion failure in block parsing

This assertion failure was introduced in 9ed2e68c9ae5 and is
manifested when both RemoveBracesLLVM and MacroBlockBegin are set.

Fixes #59335

[clang-format] Fix an assertion failure in block parsing

This assertion failure was introduced in 9ed2e68c9ae5 and is
manifested when both RemoveBracesLLVM and MacroBlockBegin are set.

Fixes #59335.

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

show more ...


# b40e9dce 06-Dec-2022 Gedare Bloom <gedare@rtems.org>

[clang-format] Avoid breaking )( with BlockIndent

The BracketAlignmentStyle BAS_BlockIndent was forcing breaks before a
closing right parenthesis yielding strange-looking results in case of
code str

[clang-format] Avoid breaking )( with BlockIndent

The BracketAlignmentStyle BAS_BlockIndent was forcing breaks before a
closing right parenthesis yielding strange-looking results in case of
code structures that have a left parens immediately following a right
parens ")(" such as is seen with indirect function calls via function
pointers and with type casting.

Fixes 57250.
Fixes 58496.

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

show more ...


# 4daeb8c7 20-Nov-2022 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a crash due to dereferencing null MatchingParen

Fixes #59089.

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


# 92bccf5d 19-Nov-2022 Noah Goldstein <goldstein.w.n@gmail.com>

[clang-format] Don't use PPIndentWidth inside multi-line macros

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


# df6f4b85 17-Nov-2022 Emilia Dreamer <emilia@rymiel.space>

[clang-format] Defer formatting of operator< to honor paren spacing

I'm not exactly sure what the intent of that section of
`spaceRequiredBetween` is doing, it seems to handle templates and <<,
but

[clang-format] Defer formatting of operator< to honor paren spacing

I'm not exactly sure what the intent of that section of
`spaceRequiredBetween` is doing, it seems to handle templates and <<,
but the part which adds spaces before parens is way later, as part
of `spaceRequiredBeforeParens`.

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

show more ...


12345678910>>...82