-
Notifications
You must be signed in to change notification settings - Fork 15.2k
clang-format reflow comments disable star: Fixes #58710 #167146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
49b5691
3edea36
6a1ba43
923c14a
0daa7af
1343698
44d9afe
09b2529
0477f70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,5 @@ | ||
| BasedOnStyle: LLVM | ||
| LineEnding: LF | ||
| ColumnLimit: 80 | ||
| ReflowComments: true | ||
| ReflowCommentsNoStar: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4250,6 +4250,19 @@ struct FormatStyle { | |
| /// \version 3.8 | ||
| ReflowCommentsStyle ReflowComments; | ||
|
|
||
| /// If reflow comments is enabled, dont include * in the formatted block comment. | ||
| /// \code | ||
| /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of | ||
| /// // information | ||
| /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of | ||
| /// information */ | ||
| /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of | ||
| /// information and a misaligned second line */ | ||
| /// \endcode | ||
|
|
||
| /// \version 22 | ||
| bool ReflowCommentsNoStar; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rework |
||
|
|
||
| /// Remove optional braces of control statements (``if``, ``else``, ``for``, | ||
| /// and ``while``) in C++ according to the LLVM coding style. | ||
| /// \warning | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -506,6 +506,8 @@ BreakableBlockComment::BreakableBlockComment( | |||||||||
| } | ||||||||||
|
|
||||||||||
| Decoration = "* "; | ||||||||||
| if (Style.ReflowCommentsNoStar) | ||||||||||
| Decoration = ""; | ||||||||||
|
Comment on lines
508
to
+510
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| if (Lines.size() == 1 && !FirstInLine) { | ||||||||||
| // Comments for which FirstInLine is false can start on arbitrary column, | ||||||||||
| // and available horizontal space can be too small to align consecutive | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // RUN: clang-format -style="{ColumnLimit: 80, ReflowComments: true, ReflowCommentsNoStar: true}" %S/ReflowCommentsNoStarInput.cpp > %t | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drop these, we have our tests in |
||
| // RUN: diff %t %S/ReflowCommentsNoStarExpected.cpp | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| /* erfdfdfdfdfdfd fd fdfd fd fd fd fd fd fd fd fd fd fd fd fd fd fdf df df df df | ||
| df df df df df df df fd f */ | ||
|
|
||
| void func() {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| /* erfdfdfdfdfdfd fd fdfd fd fd fd fd fd fd fd fd fd fd fd fd fd fdf df df df df df df df df df df df fd f */ | ||
|
|
||
| void func() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't touch this.