History log of /llvm-project/clang/lib/Format/BreakableToken.cpp (Results 1 – 25 of 137)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2
# 0fba8381 12-Oct-2024 Iuri Chaer <ichaer@splunk.com>

[clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (#96804)

* Convert `ReflowComments` from boolean into a new `enum` wh

[clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (#96804)

* Convert `ReflowComments` from boolean into a new `enum` which can take
on the value `RCS_Never`, `RCS_IndentOnly`, or `RCS_Always`. The first
one is equivalent to the old `false`, the third one is `true`, and the
middle one means that multiline comments should only have their
indentation corrected, which is what Doxygen users will want.
* Preserve backward compatibility while parsing `ReflowComments`.

show more ...


Revision tags: llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3
# b2082a98 20-Mar-2024 Owen Pan <owenpiano@gmail.com>

Revert "[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files"

This reverts commit b92d6dd704d789240685a336ad8b25a9f381b4cc. See
github.com/llvm/llvm-project/commit/b92d6dd704d7#com

Revert "[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files"

This reverts commit b92d6dd704d789240685a336ad8b25a9f381b4cc. See
github.com/llvm/llvm-project/commit/b92d6dd704d7#commitcomment-139992444

We should use a tool like Visual Studio to clean up the headers.

show more ...


Revision tags: llvmorg-18.1.2
# b92d6dd7 17-Mar-2024 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files


Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2
# 1b03cbc9 07-Feb-2024 Fernando Tagawa <tagawafernando@gmail.com>

[clang-format] Handle doxygen commands starting with \ (#80381)

Fixes llvm/llvm-project#63241

Doxygen commands can start with `@` or `\`.


Revision tags: llvmorg-18.1.0-rc1, llvmorg-19-init
# f3dcc235 13-Dec-2023 Kazu Hirata <kazu@google.com>

[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}:

[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# ddc80637 29-Jun-2023 sstwcw <su3e8a96kzlver@posteo.net>

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
s

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
strings are not broken.

A new subclass BreakableStringLiteralUsingOperators is used to handle
the logic for adding plus signs and commas. The updateAfterBroken
method was added because now parentheses or braces may be required after
the parentheses or commas are added. In order to decide whether the
added plus sign should be unindented in the BreakableToken object, the
logic for it is taken out into a separate function
shouldUnindentNextOperator.

The logic for finding the continuation indentation when the option
AlignAfterOpenBracket is set to DontAlign is not implemented yet. So in
that case the new line may have the wrong indentation, and the parts may
have the wrong length if the string needs to be broken more than once
because finding where to break the string depends on where the string
starts.

The preambles for the C# and Java unit tests are changed to the newer
style in order to allow the 3-argument verifyFormat macro. Some cases
are changed from verifyFormat to verifyImcompleteFormat because those
use incomplete code and the new verifyFormat function checks that the
code is complete.

The line in the doc was changed to being indented by 4 spaces, that is,
the default continuation indentation. It has always been the case. It
was probably a mistake that the doc showed 2 spaces previously.

This commit was fist committed as 16ccba51072b. The tests caused
assertion failures. Then it was reverted in 547bce36132a.

Reviewed By: MyDeveloperDay

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

show more ...


# 547bce36 24-Aug-2023 David Spickett <david.spickett@linaro.org>

Revert "[clang-format] Break long string literals in C#, etc."

This reverts commit 16ccba51072bbc5ff4c66f91f939163dc91e5d96.

This is failing across Linaro's bots e.g.:
https://lab.llvm.org/buildbot

Revert "[clang-format] Break long string literals in C#, etc."

This reverts commit 16ccba51072bbc5ff4c66f91f939163dc91e5d96.

This is failing across Linaro's bots e.g.:
https://lab.llvm.org/buildbot/#/builders/188/builds/34393

show more ...


# 16ccba51 29-Jun-2023 sstwcw <su3e8a96kzlver@posteo.net>

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
s

[clang-format] Break long string literals in C#, etc.

Now strings that are too long for one line in C#, Java, JavaScript, and
Verilog get broken into several lines. C# and JavaScript interpolated
strings are not broken.

A new subclass BreakableStringLiteralUsingOperators is used to handle
the logic for adding plus signs and commas. The updateAfterBroken
method was added because now parentheses or braces may be required after
the parentheses or commas are added. In order to decide whether the
added plus sign should be unindented in the BreakableToken object, the
logic for it is taken out into a separate function
shouldUnindentNextOperator.

The logic for finding the continuation indentation when the option
AlignAfterOpenBracket is set to DontAlign is not implemented yet. So in
that case the new line may have the wrong indentation, and the parts may
have the wrong length if the string needs to be broken more than once
because finding where to break the string depends on where the string
starts.

The preambles for the C# and Java unit tests are changed to the newer
style in order to allow the 3-argument verifyFormat macro. Some cases
are changed from verifyFormat to verifyImcompleteFormat because those
use incomplete code and the new verifyFormat function checks that the
code is complete.

The line in the doc was changed to being indented by 4 spaces, that is,
the default continuation indentation. It has always been the case. It
was probably a mistake that the doc showed 2 spaces previously.

Reviewed By: MyDeveloperDay

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

show more ...


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6
# 1116ed2b 21-Nov-2022 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Correctly count a tab's width in a comment

It worked only correct for a tab as the first char.

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

Differential Revision: https:/

[clang-format] Correctly count a tab's width in a comment

It worked only correct for a tab as the first char.

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

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

show more ...


# ea9d4040 15-Mar-2023 Kazu Hirata <kazu@google.com>

[clang] Use *{Set,Map}::contains (NFC)


Revision tags: llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1
# 873888c1 30-Jul-2022 Kazu Hirata <kazu@google.com>

Use is_sorted (NFC)


Revision tags: llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5
# 40a5d79a 09-Jun-2022 owenca <owenpiano@gmail.com>

[clang-format][NFC] Format lib/Format and unittests/Format in clang

Reformat these directories with InsertBraces and RemoveBracesLLVM.

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


Revision tags: 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


Revision tags: llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1
# eb35e0ec 22-Mar-2022 Krasimir Georgiev <krasimir@google.com>

[clang-format] don't break up #-style comment sections

Follow-up from https://github.com/llvm/llvm-project/commit/36d13d3f8adb3d1a6bae71370afa23d11a94dc78; https://reviews.llvm.org/D121451.

Restore

[clang-format] don't break up #-style comment sections

Follow-up from https://github.com/llvm/llvm-project/commit/36d13d3f8adb3d1a6bae71370afa23d11a94dc78; https://reviews.llvm.org/D121451.

Restore the old behavior in situations where we use # as comments and long strings of #'s for comment sections.

Reviewed By: MyDeveloperDay

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

show more ...


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

[clang-format] Refactor BreakableBlockComment constructor. NFC.


Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2
# 36d13d3f 01-Mar-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Add space to comments starting with '#'.

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

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

Differential Revision: htt

[clang-format] Add space to comments starting with '#'.

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

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

show more ...


# d9567bab 20-Feb-2022 Luis Penagos <luis@penagos.co>

Fix extraneous whitespace addition in line comments on clang-format directives

Fixes https://github.com/llvm/llvm-project/issues/53844.
I believe this regression was caused by not accounting for cla

Fix extraneous whitespace addition in line comments on clang-format directives

Fixes https://github.com/llvm/llvm-project/issues/53844.
I believe this regression was caused by not accounting for clang-format directives in https://reviews.llvm.org/D92257.

Reviewed By: HazardyKnusperkeks, curdeius

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

show more ...


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

[clang-format] Fix SpacesInLineCommentPrefix deleting tokens.

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

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://revie

[clang-format] Fix SpacesInLineCommentPrefix deleting tokens.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

show more ...


Revision tags: llvmorg-14.0.0-rc1
# 88e4e6be 03-Feb-2022 ksyx <18738953+ksyx@users.noreply.github.com>

[clang-format] Use wider comment prefix space rule

This commit changes the condition of requiring comment to start with
alphanumeric characters to make no change only for a certain set of
characters

[clang-format] Use wider comment prefix space rule

This commit changes the condition of requiring comment to start with
alphanumeric characters to make no change only for a certain set of
characters, currently horizontal whitespace and punctuation characters,
to support wider set of leading characters unrelated to documentation
generation directives.

Reviewed By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D118869

show more ...


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

[clang-format] Elide unnecessary braces. NFC.


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

[clang-format] Factor out loop variable. NFC.

* Break on the size of the used variable Content instead of Lines (even though both should have the same size).


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

[clang-format] Simplify use of StringRef::substr(). NFC.


Revision tags: llvmorg-15-init
# 64df5162 28-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Fix misaligned trailing comments in the presence of an empty block comment.

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

Expected code:
```
/**/ //
int a; //
```

was b

[clang-format] Fix misaligned trailing comments in the presence of an empty block comment.

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

Expected code:
```
/**/ //
int a; //
```

was before misformatted to:
```
/**/ //
int a; //
```

Because the "remaining length" (after the starting `/*`) of an empty block comment `/**/` was computed to be 0 instead of 2.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

show more ...


# f4d5195d 28-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Move irrelevant code from getRangeLength to getRemainingLength. NFC.


# 249a21ab 28-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Remove useless npos parameter from substr. NFC.


123456