History log of /llvm-project/clang/unittests/Format/FormatTest.cpp (Results 326 – 350 of 2034)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# d03e3428 03-Mar-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Fix assertion failure/crash with `AllowShortFunctionsOnASingleLine: Inline/InlineOnly`.

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

When handling `AllowShortFunctionsOnA

[clang-format] Fix assertion failure/crash with `AllowShortFunctionsOnASingleLine: Inline/InlineOnly`.

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

When handling `AllowShortFunctionsOnASingleLine`, we were searching for the last line with a smaller level than the current line. The search was incorrect when the first line had the same level as the current one. This led to an unsatisfied assumption about the existence of a brace (non-comment token).

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


# 28b76b1e 05-Mar-2022 owenca <owenpiano@gmail.com>

[clang-format] Handle goto labels for RemoveBracesLLVM

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


# be570576 03-Mar-2022 Zequan Wu <zequanwu@google.com>

[clang-format] fix namepsace format when the name is macro expansion

Originally filed at crbug.com/1184570.
When the name of a namespace is a macro that takes arguments,
- It fixed the indentation.

[clang-format] fix namepsace format when the name is macro expansion

Originally filed at crbug.com/1184570.
When the name of a namespace is a macro that takes arguments,
- It fixed the indentation.
- It fixed the namepsace end comments.

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

show more ...


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


# 13351fdf 02-Mar-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Recognize "if consteval".

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

Reviewed By: MyDeveloperDay, JohelEGP

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


# d6daca21 24-Feb-2022 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Fix BreakBeforeBinaryOperators with TemplateCloser on the lhs

In the presence of pp branches we parse the token stream multiple times.
Thus the token already has the type set. It's be

[clang-format] Fix BreakBeforeBinaryOperators with TemplateCloser on the lhs

In the presence of pp branches we parse the token stream multiple times.
Thus the token already has the type set. It's best just not to assert on
any type in the parser.

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

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

show more ...


# 78ac8670 24-Feb-2022 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Fix requires related crash

In the presence of pp branches we parse the token stream multiple times.
Thus the token already has the type set. It's best just not to assert on
any type i

[clang-format] Fix requires related crash

In the presence of pp branches we parse the token stream multiple times.
Thus the token already has the type set. It's best just not to assert on
any type in the parser.

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

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

show more ...


# 24d4f601 28-Feb-2022 Luis Penagos <luis@penagos.co>

[clang-format] Treat && followed by noexcept operator as a binary operator inside template arguments

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

Reviewed By: curdeius, MyDeveloperDay

[clang-format] Treat && followed by noexcept operator as a binary operator inside template arguments

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

Reviewed By: curdeius, MyDeveloperDay

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

show more ...


# c05da55b 24-Feb-2022 owenca <owenpiano@gmail.com>

[clang-format] Handle trailing comment for InsertBraces

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


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

[clang-format] Avoid inserting space after C++ casts.

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

This is a solution for standard C++ casts: const_cast, dynamic_cast, reinterpret_cast,

[clang-format] Avoid inserting space after C++ casts.

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

This is a solution for standard C++ casts: const_cast, dynamic_cast, reinterpret_cast, static_cast.

A general approach handling all possible casts is not possible without semantic information.
Consider the code:
```
static_cast<T>(*function_pointer_variable)(arguments);
```
vs.
```
some_return_type<T> (*function_pointer_variable)(parameters);
// Later used as:
function_pointer_variable = &some_function;
return function_pointer_variable(args);
```
In the latter case, it's not a cast but a variable declaration of a pointer to function.
Without knowing what `some_return_type<T>` is (and clang-format does not know it), it's hard to distinguish between the two cases. Theoretically, one could check whether "parameters" are types (not a cast) and "arguments" are value/expressions (a cast), but that might be inefficient (needs lots of lookahead).

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

show more ...


# dbc4d281 24-Feb-2022 Luis Penagos <luis@penagos.co>

[clang-format] Do not insert space after new/delete keywords in C function declarations

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

Reviewed By: curdeius, HazardyKnusperkeks

Different

[clang-format] Do not insert space after new/delete keywords in C function declarations

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

Reviewed By: curdeius, HazardyKnusperkeks

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

show more ...


# 923c3755 21-Feb-2022 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Don't break semi after requires clause ...

..regardless of the chosen style.

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

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

[clang-format] Don't break semi after requires clause ...

..regardless of the chosen style.

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

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

show more ...


# c9592ae4 22-Feb-2022 Krasimir Georgiev <krasimir@google.com>

[clang-format] Fix preprocessor nesting after commit 529aa4b011c4ae808d658022ef643c44dd9b2c9c

In https://github.com/llvm/llvm-project/commit/529aa4b011c4ae808d658022ef643c44dd9b2c9c
by setting the i

[clang-format] Fix preprocessor nesting after commit 529aa4b011c4ae808d658022ef643c44dd9b2c9c

In https://github.com/llvm/llvm-project/commit/529aa4b011c4ae808d658022ef643c44dd9b2c9c
by setting the identifier info to nullptr, we started to subtly
interfere with the parts in the beginning of the function,
https://github.com/llvm/llvm-project/blob/529aa4b011c4ae808d658022ef643c44dd9b2c9c/clang/lib/Format/UnwrappedLineParser.cpp#L991
causing the preprocessor nesting to change in some cases. E.g., for the
added regression test, clang-format started incorrectly guessing the
language as C++.

This tries to address this by introducing an internal identifier info
element to use instead.

Reviewed By: curdeius, MyDeveloperDay

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

show more ...


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


# be9a7fdd 15-Feb-2022 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Fixed handling of requires clauses followed by attributes

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

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


# 4701bcae 20-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

Revert "[clang-format] Avoid inserting space after C++ casts."

This reverts commit e021987273bece6e94bc6f43b6b5232de10637c8.

This commit provokes failures in formatting tests of polly.
Cf. https://

Revert "[clang-format] Avoid inserting space after C++ casts."

This reverts commit e021987273bece6e94bc6f43b6b5232de10637c8.

This commit provokes failures in formatting tests of polly.
Cf. https://lab.llvm.org/buildbot/#/builders/205/builds/3320.

That's probably because of `)` being annotated as `CastRParen` instead of `Unknown` before, hence being kept on the same line with the next token.

show more ...


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

[clang-format] Avoid inserting space after C++ casts.

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

This is a solution for standard C++ casts: const_cast, dynamic_cast, reinterpret_cast,

[clang-format] Avoid inserting space after C++ casts.

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

This is a solution for standard C++ casts: const_cast, dynamic_cast, reinterpret_cast, static_cast.

A general approach handling all possible casts is not possible without semantic information.
Consider the code:
```
static_cast<T>(*function_pointer_variable)(arguments);
```
vs.
```
some_return_type<T> (*function_pointer_variable)(parameters);
// Later used as:
function_pointer_variable = &some_function;
return function_pointer_variable(args);
```
In the latter case, it's not a cast but a variable declaration of a pointer to function.
Without knowing what `some_return_type<T>` is (and clang-format does not know it), it's hard to distinguish between the two cases. Theoretically, one could check whether "parameters" are types (not a cast) and "arguments" are value/expressions (a cast), but that might be inefficient (needs lots of lookahead).

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

show more ...


# 331e8e4e 17-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Do not add space after return-like keywords in macros.

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

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https

[clang-format] Do not add space after return-like keywords in macros.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


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

[clang-format] Make checking for a record more robust and avoid a loop.


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

[clang-format] Fix formatting of struct-like records followed by variable declaration.

Fixes https://github.com/llvm/llvm-project/issues/24781.
Fixes https://github.com/llvm/llvm-project/issues/3816

[clang-format] Fix formatting of struct-like records followed by variable declaration.

Fixes https://github.com/llvm/llvm-project/issues/24781.
Fixes https://github.com/llvm/llvm-project/issues/38160.

This patch splits `TT_RecordLBrace` for classes/enums/structs/unions (and other records, e.g. interfaces) and uses the brace type to avoid the error-prone scanning for record token.

The mentioned bugs were provoked by the scanning being too limited (and so not considering `const` or `constexpr`, or other qualifiers, on an anonymous struct variable declaration).

Moreover, the proposed solution is more efficient as we parse tokens once only (scanning being parsing too).

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

show more ...


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


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

[clang-format] Honour PointerAlignment in statements with initializers.

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

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: htt

[clang-format] Honour PointerAlignment in statements with initializers.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


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

[clang-format] Reformat. NFC.


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

[clang-format] Fix PointerAlignment within lambdas in a multi-variable declaration statement.

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

Also, handle while loops with initializers (C+

[clang-format] Fix PointerAlignment within lambdas in a multi-variable declaration statement.

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

Also, handle while loops with initializers (C++20) the same way as for loops.

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


# 25282bd6 12-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Handle PointerAlignment in `if` and `switch` statements with initializers (C++17) the same way as in `for` loops.

Reviewed By: MyDeveloperDay, owenpan

Differential Revision: https://

[clang-format] Handle PointerAlignment in `if` and `switch` statements with initializers (C++17) the same way as in `for` loops.

Reviewed By: MyDeveloperDay, owenpan

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

show more ...


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