[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)
Iuri Chaer via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 11 06:59:59 PDT 2024
https://github.com/ichaer updated https://github.com/llvm/llvm-project/pull/96804
>From 4c6b2fb52dcfe2ca5ace822ecaf6d0e8ac60f0d7 Mon Sep 17 00:00:00 2001
From: Iuri Chaer <ichaer at splunk.com>
Date: Wed, 13 Dec 2023 21:33:05 +0000
Subject: [PATCH 1/9] [clang-format] Introduce "ReflowComments: IndentOnly" to
re-indent comments without breaking internal structure (think Doxygen).
* 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`.
---
clang/include/clang/Format/Format.h | 17 +++++++++++---
clang/lib/Format/BreakableToken.cpp | 14 ++++++++----
clang/lib/Format/ContinuationIndenter.cpp | 4 ++--
clang/lib/Format/Format.cpp | 12 +++++++++-
clang/lib/Format/UnwrappedLineParser.cpp | 18 +++++++--------
clang/unittests/Format/ConfigParseTest.cpp | 11 +++++++++-
clang/unittests/Format/FormatTest.cpp | 6 ++---
clang/unittests/Format/FormatTestComments.cpp | 22 ++++++++++++++++---
8 files changed, 78 insertions(+), 26 deletions(-)
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index 7d257be10af42c..971e9347df1279 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3749,23 +3749,34 @@ struct FormatStyle {
/// \version 13
ReferenceAlignmentStyle ReferenceAlignment;
+ enum ReflowCommentsStyle : int8_t { RCS_Never, RCS_IndentOnly, RCS_Always };
// clang-format off
/// If ``true``, clang-format will attempt to re-flow comments. That is it
/// will touch a comment and *reflow* long comments into new lines, trying to
/// obey the ``ColumnLimit``.
/// \code
- /// false:
+ /// RCS_Never:
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
/// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
+ /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// * and a misaligned second line */
///
- /// true:
+ /// RCS_IndentOnly:
+ /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
+ /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// * and a misaligned second line */
+ ///
+ /// RCS_Always:
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
/// // information
/// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
/// * information */
+ /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ /// * information and a misaligned second line */
/// \endcode
/// \version 3.8
- bool ReflowComments;
+ ReflowCommentsStyle ReflowComments;
// clang-format on
/// Remove optional braces of control statements (``if``, ``else``, ``for``,
diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp
index 75304908dc6506..0ccc8a690c2087 100644
--- a/clang/lib/Format/BreakableToken.cpp
+++ b/clang/lib/Format/BreakableToken.cpp
@@ -420,8 +420,10 @@ BreakableComment::getSplit(unsigned LineIndex, unsigned TailOffset,
unsigned ColumnLimit, unsigned ContentStartColumn,
const llvm::Regex &CommentPragmasRegex) const {
// Don't break lines matching the comment pragmas regex.
- if (CommentPragmasRegex.match(Content[LineIndex]))
+ if (Style.ReflowComments != FormatStyle::RCS_Always ||
+ CommentPragmasRegex.match(Content[LineIndex])) {
return Split(StringRef::npos, 0);
+ }
return getCommentSplit(Content[LineIndex].substr(TailOffset),
ContentStartColumn, ColumnLimit, Style.TabWidth,
Encoding, Style);
@@ -608,8 +610,10 @@ BreakableToken::Split BreakableBlockComment::getSplit(
unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit,
unsigned ContentStartColumn, const llvm::Regex &CommentPragmasRegex) const {
// Don't break lines matching the comment pragmas regex.
- if (CommentPragmasRegex.match(Content[LineIndex]))
+ if (Style.ReflowComments != FormatStyle::RCS_Always ||
+ CommentPragmasRegex.match(Content[LineIndex])) {
return Split(StringRef::npos, 0);
+ }
return getCommentSplit(Content[LineIndex].substr(TailOffset),
ContentStartColumn, ColumnLimit, Style.TabWidth,
Encoding, Style, Decoration.ends_with("*"));
@@ -855,7 +859,8 @@ bool BreakableBlockComment::mayReflow(
StringRef IndentContent = Content[LineIndex];
if (Lines[LineIndex].ltrim(Blanks).starts_with("*"))
IndentContent = Lines[LineIndex].ltrim(Blanks).substr(1);
- return LineIndex > 0 && !CommentPragmasRegex.match(IndentContent) &&
+ return LineIndex > 0 && Style.ReflowComments == FormatStyle::RCS_Always &&
+ !CommentPragmasRegex.match(IndentContent) &&
mayReflowContent(Content[LineIndex]) && !Tok.Finalized &&
!switchesFormatting(tokenAt(LineIndex));
}
@@ -1160,7 +1165,8 @@ bool BreakableLineCommentSection::mayReflow(
// // text that protrudes
// // into text with different indent
// We do reflow in that case in block comments.
- return LineIndex > 0 && !CommentPragmasRegex.match(IndentContent) &&
+ return LineIndex > 0 && Style.ReflowComments == FormatStyle::RCS_Always &&
+ !CommentPragmasRegex.match(IndentContent) &&
mayReflowContent(Content[LineIndex]) && !Tok.Finalized &&
!switchesFormatting(tokenAt(LineIndex)) &&
OriginalPrefix[LineIndex] == OriginalPrefix[LineIndex - 1];
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index b07360425ca6e1..7d592a31bc0eb6 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -2400,7 +2400,7 @@ ContinuationIndenter::createBreakableToken(const FormatToken &Current,
State.Line->InPPDirective, Encoding, Style);
}
} else if (Current.is(TT_BlockComment)) {
- if (!Style.ReflowComments ||
+ if (Style.ReflowComments == FormatStyle::RCS_Never ||
// If a comment token switches formatting, like
// /* clang-format on */, we don't want to break it further,
// but we may still want to adjust its indentation.
@@ -2421,7 +2421,7 @@ ContinuationIndenter::createBreakableToken(const FormatToken &Current,
}
return true;
}();
- if (!Style.ReflowComments ||
+ if (Style.ReflowComments == FormatStyle::RCS_Never ||
CommentPragmasRegex.match(Current.TokenText.substr(2)) ||
switchesFormatting(Current) || !RegularComments) {
return nullptr;
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index cd21fbb2221ac6..ee1f5651b4f986 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -497,6 +497,16 @@ template <> struct MappingTraits<FormatStyle::RawStringFormat> {
}
};
+template <> struct ScalarEnumerationTraits<FormatStyle::ReflowCommentsStyle> {
+ static void enumeration(IO &IO, FormatStyle::ReflowCommentsStyle &Value) {
+ IO.enumCase(Value, "Never", FormatStyle::RCS_Never);
+ IO.enumCase(Value, "IndentOnly", FormatStyle::RCS_IndentOnly);
+ IO.enumCase(Value, "Always", FormatStyle::RCS_Always);
+ IO.enumCase(Value, "false", FormatStyle::RCS_Never);
+ IO.enumCase(Value, "true", FormatStyle::RCS_Always);
+ }
+};
+
template <>
struct ScalarEnumerationTraits<FormatStyle::ReferenceAlignmentStyle> {
static void enumeration(IO &IO, FormatStyle::ReferenceAlignmentStyle &Value) {
@@ -1534,7 +1544,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
LLVMStyle.PPIndentWidth = -1;
LLVMStyle.QualifierAlignment = FormatStyle::QAS_Leave;
LLVMStyle.ReferenceAlignment = FormatStyle::RAS_Pointer;
- LLVMStyle.ReflowComments = true;
+ LLVMStyle.ReflowComments = FormatStyle::RCS_Always;
LLVMStyle.RemoveBracesLLVM = false;
LLVMStyle.RemoveParentheses = FormatStyle::RPS_Leave;
LLVMStyle.RemoveSemicolon = false;
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index d406a531a5c0c2..0e239c93620277 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -4588,11 +4588,11 @@ bool UnwrappedLineParser::isOnNewLine(const FormatToken &FormatTok) {
// Checks if \p FormatTok is a line comment that continues the line comment
// section on \p Line.
-static bool
-continuesLineCommentSection(const FormatToken &FormatTok,
- const UnwrappedLine &Line,
- const llvm::Regex &CommentPragmasRegex) {
- if (Line.Tokens.empty())
+static bool continuesLineCommentSection(
+ const FormatToken &FormatTok, const UnwrappedLine &Line,
+ const FormatStyle::ReflowCommentsStyle ReflowCommentsStyle,
+ const llvm::Regex &CommentPragmasRegex) {
+ if (Line.Tokens.empty() || ReflowCommentsStyle != FormatStyle::RCS_Always)
return false;
StringRef IndentContent = FormatTok.TokenText;
@@ -4704,8 +4704,8 @@ void UnwrappedLineParser::flushComments(bool NewlineBeforeNext) {
//
// FIXME: Consider putting separate line comment sections as children to the
// unwrapped line instead.
- Tok->ContinuesLineCommentSection =
- continuesLineCommentSection(*Tok, *Line, CommentPragmasRegex);
+ Tok->ContinuesLineCommentSection = continuesLineCommentSection(
+ *Tok, *Line, Style.ReflowComments, CommentPragmasRegex);
if (isOnNewLine(*Tok) && JustComments && !Tok->ContinuesLineCommentSection)
addUnwrappedLine();
pushToken(Tok);
@@ -4778,8 +4778,8 @@ void UnwrappedLineParser::distributeComments(
if (HasTrailAlignedWithNextToken && i == StartOfTrailAlignedWithNextToken) {
FormatTok->ContinuesLineCommentSection = false;
} else {
- FormatTok->ContinuesLineCommentSection =
- continuesLineCommentSection(*FormatTok, *Line, CommentPragmasRegex);
+ FormatTok->ContinuesLineCommentSection = continuesLineCommentSection(
+ *FormatTok, *Line, Style.ReflowComments, CommentPragmasRegex);
}
if (!FormatTok->ContinuesLineCommentSection &&
(isOnNewLine(*FormatTok) || FormatTok->IsFirst)) {
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp
index aded3ed2a6596e..a8a985f8fa94bc 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -183,7 +183,6 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
CHECK_PARSE_BOOL(ObjCSpaceAfterProperty);
CHECK_PARSE_BOOL(ObjCSpaceBeforeProtocolList);
CHECK_PARSE_BOOL(Cpp11BracedListStyle);
- CHECK_PARSE_BOOL(ReflowComments);
CHECK_PARSE_BOOL(RemoveBracesLLVM);
CHECK_PARSE_BOOL(RemoveSemicolon);
CHECK_PARSE_BOOL(SkipMacroDefinitionBody);
@@ -372,6 +371,16 @@ TEST(ConfigParseTest, ParsesConfiguration) {
CHECK_PARSE("PointerBindsToType: Middle", PointerAlignment,
FormatStyle::PAS_Middle);
+ Style.ReflowComments = FormatStyle::RCS_Always;
+ CHECK_PARSE("ReflowComments: Never", ReflowComments, FormatStyle::RCS_Never);
+ CHECK_PARSE("ReflowComments: IndentOnly", ReflowComments,
+ FormatStyle::RCS_IndentOnly);
+ CHECK_PARSE("ReflowComments: Always", ReflowComments,
+ FormatStyle::RCS_Always);
+ // For backward compatibility:
+ CHECK_PARSE("ReflowComments: false", ReflowComments, FormatStyle::RCS_Never);
+ CHECK_PARSE("ReflowComments: true", ReflowComments, FormatStyle::RCS_Always);
+
Style.Standard = FormatStyle::LS_Auto;
CHECK_PARSE("Standard: c++03", Standard, FormatStyle::LS_Cpp03);
CHECK_PARSE("Standard: c++11", Standard, FormatStyle::LS_Cpp11);
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index db1decb20d626b..80d4958806f191 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -17851,7 +17851,7 @@ TEST_F(FormatTest, AlignConsecutiveMacros) {
// Test across comments
Style.MaxEmptyLinesToKeep = 10;
- Style.ReflowComments = false;
+ Style.ReflowComments = FormatStyle::RCS_Never;
Style.AlignConsecutiveMacros.AcrossComments = true;
verifyFormat("#define a 3\n"
"// line comment\n"
@@ -18598,7 +18598,7 @@ TEST_F(FormatTest, AlignConsecutiveAssignmentsAcrossEmptyLinesAndComments) {
"y = 1;",
Alignment);
- Alignment.ReflowComments = true;
+ Alignment.ReflowComments = FormatStyle::RCS_Always;
Alignment.ColumnLimit = 50;
verifyFormat("int x = 0;\n"
"int yy = 1; /// specificlennospace\n"
@@ -18996,7 +18996,7 @@ TEST_F(FormatTest, AlignConsecutiveAssignments) {
"y = 1;",
Alignment);
- EXPECT_EQ(Alignment.ReflowComments, true);
+ EXPECT_EQ(Alignment.ReflowComments, FormatStyle::RCS_Always);
Alignment.ColumnLimit = 50;
verifyFormat("int x = 0;\n"
"int yy = 1; /// specificlennospace\n"
diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp
index 3e75707a9faecc..a89016758719c5 100644
--- a/clang/unittests/Format/FormatTestComments.cpp
+++ b/clang/unittests/Format/FormatTestComments.cpp
@@ -493,9 +493,25 @@ TEST_F(FormatTestComments, AlignsBlockComments) {
TEST_F(FormatTestComments, CommentReflowingCanBeTurnedOff) {
FormatStyle Style = getLLVMStyleWithColumns(20);
- Style.ReflowComments = false;
- verifyFormat("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
- verifyFormat("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
+ Style.ReflowComments = FormatStyle::RCS_Never;
+ verifyNoChange("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\naaaaaaaaa*/", Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n aaaaaaaaa*/", Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n * aaaaaaaaa*/",
+ Style);
+}
+
+TEST_F(FormatTestComments, CommentReflowingCanApplyOnlyToIndents) {
+ FormatStyle Style = getLLVMStyleWithColumns(20);
+ Style.ReflowComments = FormatStyle::RCS_IndentOnly;
+ verifyNoChange("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\naaaaaaaaa*/", Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n aaaaaaaaa*/", Style);
+ verifyFormat("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n * aaaaaaaaa*/",
+ "/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n * aaaaaaaaa*/",
+ Style);
}
TEST_F(FormatTestComments, CorrectlyHandlesLengthOfBlockComments) {
>From 48ed2cf336a7cff73e3fbc36d1e0ffc0c5d5b7fa Mon Sep 17 00:00:00 2001
From: Iuri Chaer <ichaer at splunk.com>
Date: Thu, 27 Jun 2024 13:45:57 +0100
Subject: [PATCH 2/9] Fix docs.
---
clang/docs/ClangFormatStyleOptions.rst | 50 ++++++++++++++-----
clang/include/clang/Format/Format.h | 68 +++++++++++++++-----------
2 files changed, 77 insertions(+), 41 deletions(-)
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index bb00c20922d361..6b6d8a93579e44 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -5204,22 +5204,46 @@ the configuration (without a prefix: ``Auto``).
.. _ReflowComments:
-**ReflowComments** (``Boolean``) :versionbadge:`clang-format 3.8` :ref:`¶ <ReflowComments>`
- If ``true``, clang-format will attempt to re-flow comments. That is it
- will touch a comment and *reflow* long comments into new lines, trying to
- obey the ``ColumnLimit``.
+**ReflowComments** (``ReflowCommentsStyle``) :versionbadge:`clang-format 20` :ref:`¶ <ReflowComments>`
+ Comment reformatting style.
- .. code-block:: c++
+ Possible values:
+
+ * ``// clang-format on`` (in configuration: ``// clang-format on``)
+ Leave comments untouched.
+
+ .. code-block:: c++
+
+ // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
+ /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ * and a misaligned second line */
+
+ * ``// clang-format on`` (in configuration: ``// clang-format on``)
+ Only apply indentation rules, moving comments left or right, without
+ changing formatting inside the comments.
+
+ .. code-block:: c++
+
+ // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
+ /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ * and a misaligned second line */
+
+ * ``// clang-format on`` (in configuration: ``// clang-format on``)
+ Apply indentation rules and re-flow long comments into new lines, trying
+ to obey the ``ColumnLimit``.
+
+ .. code-block:: c++
+
+ // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ // information
+ /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ * information */
+ /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ * information and a misaligned second line */
- false:
- // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
- /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
- true:
- // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
- // information
- /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
- * information */
.. _RemoveBracesLLVM:
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index 971e9347df1279..edb52bb02ee59a 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3749,35 +3749,47 @@ struct FormatStyle {
/// \version 13
ReferenceAlignmentStyle ReferenceAlignment;
- enum ReflowCommentsStyle : int8_t { RCS_Never, RCS_IndentOnly, RCS_Always };
- // clang-format off
- /// If ``true``, clang-format will attempt to re-flow comments. That is it
- /// will touch a comment and *reflow* long comments into new lines, trying to
- /// obey the ``ColumnLimit``.
- /// \code
- /// RCS_Never:
- /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
- /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
- /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
- /// * and a misaligned second line */
- ///
- /// RCS_IndentOnly:
- /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
- /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
- /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
- /// * and a misaligned second line */
- ///
- /// RCS_Always:
- /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
- /// // information
- /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
- /// * information */
- /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
- /// * information and a misaligned second line */
- /// \endcode
- /// \version 3.8
+ /// \brief Types of comment re-flow style.
+ enum ReflowCommentsStyle : int8_t {
+ // clang-format off
+ /// Leave comments untouched.
+ /// \code
+ /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
+ /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// * and a misaligned second line */
+ /// \endcode
+ // clang-format on
+ RCS_Never,
+ // clang-format off
+ /// Only apply indentation rules, moving comments left or right, without
+ /// changing formatting inside the comments.
+ /// \code
+ /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
+ /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// * and a misaligned second line */
+ /// \endcode
+ // clang-format on
+ RCS_IndentOnly,
+ // clang-format off
+ /// Apply indentation rules and re-flow long comments into new lines, trying
+ /// to obey the ``ColumnLimit``.
+ /// \code
+ /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ /// // information
+ /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ /// * information */
+ /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ /// * information and a misaligned second line */
+ /// \endcode
+ // clang-format on
+ RCS_Always
+ };
+
+ /// \brief Comment reformatting style.
+ /// \version 20
ReflowCommentsStyle ReflowComments;
- // clang-format on
/// Remove optional braces of control statements (``if``, ``else``, ``for``,
/// and ``while``) in C++ according to the LLVM coding style.
>From 1c816f50b5041f6c748e494b90fa68fc46ac0a0d Mon Sep 17 00:00:00 2001
From: Iuri Chaer <ichaer at splunk.com>
Date: Thu, 27 Jun 2024 22:02:24 +0100
Subject: [PATCH 3/9] Revert bad version number change in docs, break lines in
test string literals.
---
clang/include/clang/Format/Format.h | 2 +-
clang/unittests/Format/FormatTestComments.cpp | 25 +++++++++++++------
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index edb52bb02ee59a..2fd512acb3956a 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3788,7 +3788,7 @@ struct FormatStyle {
};
/// \brief Comment reformatting style.
- /// \version 20
+ /// \version 3.8
ReflowCommentsStyle ReflowComments;
/// Remove optional braces of control statements (``if``, ``else``, ``for``,
diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp
index a89016758719c5..77519b4baa5122 100644
--- a/clang/unittests/Format/FormatTestComments.cpp
+++ b/clang/unittests/Format/FormatTestComments.cpp
@@ -496,9 +496,14 @@ TEST_F(FormatTestComments, CommentReflowingCanBeTurnedOff) {
Style.ReflowComments = FormatStyle::RCS_Never;
verifyNoChange("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
- verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\naaaaaaaaa*/", Style);
- verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n aaaaaaaaa*/", Style);
- verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n * aaaaaaaaa*/",
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
+ "aaaaaaaaa*/",
+ Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
+ " aaaaaaaaa*/",
+ Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
+ " * aaaaaaaaa*/",
Style);
}
@@ -507,10 +512,16 @@ TEST_F(FormatTestComments, CommentReflowingCanApplyOnlyToIndents) {
Style.ReflowComments = FormatStyle::RCS_IndentOnly;
verifyNoChange("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
- verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\naaaaaaaaa*/", Style);
- verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n aaaaaaaaa*/", Style);
- verifyFormat("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n * aaaaaaaaa*/",
- "/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n * aaaaaaaaa*/",
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa"
+ "\naaaaaaaaa*/",
+ Style);
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
+ " aaaaaaaaa*/",
+ Style);
+ verifyFormat("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
+ " * aaaaaaaaa*/",
+ "/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
+ " * aaaaaaaaa*/",
Style);
}
>From 3b3c762c9589f89c1281a0fed5c70b6777af73eb Mon Sep 17 00:00:00 2001
From: Iuri Chaer <ichaer at splunk.com>
Date: Thu, 27 Jun 2024 22:07:52 +0100
Subject: [PATCH 4/9] Oops
---
clang/unittests/Format/FormatTestComments.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp
index 77519b4baa5122..0355ed0bacd3da 100644
--- a/clang/unittests/Format/FormatTestComments.cpp
+++ b/clang/unittests/Format/FormatTestComments.cpp
@@ -512,8 +512,8 @@ TEST_F(FormatTestComments, CommentReflowingCanApplyOnlyToIndents) {
Style.ReflowComments = FormatStyle::RCS_IndentOnly;
verifyNoChange("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
- verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa"
- "\naaaaaaaaa*/",
+ verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
+ "aaaaaaaaa*/",
Style);
verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
" aaaaaaaaa*/",
>From 159281a325841575b519dbf93bf0f981c319157e Mon Sep 17 00:00:00 2001
From: Iuri Chaer <ichaer at splunk.com>
Date: Mon, 8 Jul 2024 18:56:36 +0100
Subject: [PATCH 5/9] Oh no, I regenerated the docs before I made the version
change :(. Sorry!
---
clang/docs/ClangFormatStyleOptions.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 6b6d8a93579e44..6958d5a3472b20 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -5204,7 +5204,7 @@ the configuration (without a prefix: ``Auto``).
.. _ReflowComments:
-**ReflowComments** (``ReflowCommentsStyle``) :versionbadge:`clang-format 20` :ref:`¶ <ReflowComments>`
+**ReflowComments** (``ReflowCommentsStyle``) :versionbadge:`clang-format 3.8` :ref:`¶ <ReflowComments>`
Comment reformatting style.
Possible values:
>From 1d653048fc9084be2f52fbd7aeb4bf3e0f9e7326 Mon Sep 17 00:00:00 2001
From: Iuri Chaer <ichaer at splunk.com>
Date: Wed, 7 Aug 2024 18:09:29 +0100
Subject: [PATCH 6/9] Move `clang-format off` and `clang-format on` comments
outside of the `enum` and re-generate documentation.
---
clang/docs/ClangFormatStyleOptions.rst | 6 +++---
clang/include/clang/Format/Format.h | 8 ++------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 6958d5a3472b20..d82e8deab29cdc 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -5209,7 +5209,7 @@ the configuration (without a prefix: ``Auto``).
Possible values:
- * ``// clang-format on`` (in configuration: ``// clang-format on``)
+ * ``RCS_Never`` (in configuration: ``Never``)
Leave comments untouched.
.. code-block:: c++
@@ -5219,7 +5219,7 @@ the configuration (without a prefix: ``Auto``).
/* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
* and a misaligned second line */
- * ``// clang-format on`` (in configuration: ``// clang-format on``)
+ * ``RCS_IndentOnly`` (in configuration: ``IndentOnly``)
Only apply indentation rules, moving comments left or right, without
changing formatting inside the comments.
@@ -5230,7 +5230,7 @@ the configuration (without a prefix: ``Auto``).
/* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
* and a misaligned second line */
- * ``// clang-format on`` (in configuration: ``// clang-format on``)
+ * ``RCS_Always`` (in configuration: ``Always``)
Apply indentation rules and re-flow long comments into new lines, trying
to obey the ``ColumnLimit``.
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index 2fd512acb3956a..f783236443119e 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3749,9 +3749,9 @@ struct FormatStyle {
/// \version 13
ReferenceAlignmentStyle ReferenceAlignment;
+ // clang-format off
/// \brief Types of comment re-flow style.
enum ReflowCommentsStyle : int8_t {
- // clang-format off
/// Leave comments untouched.
/// \code
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
@@ -3759,9 +3759,7 @@ struct FormatStyle {
/// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
/// * and a misaligned second line */
/// \endcode
- // clang-format on
RCS_Never,
- // clang-format off
/// Only apply indentation rules, moving comments left or right, without
/// changing formatting inside the comments.
/// \code
@@ -3770,9 +3768,7 @@ struct FormatStyle {
/// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
/// * and a misaligned second line */
/// \endcode
- // clang-format on
RCS_IndentOnly,
- // clang-format off
/// Apply indentation rules and re-flow long comments into new lines, trying
/// to obey the ``ColumnLimit``.
/// \code
@@ -3783,9 +3779,9 @@ struct FormatStyle {
/// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
/// * information and a misaligned second line */
/// \endcode
- // clang-format on
RCS_Always
};
+ // clang-format on
/// \brief Comment reformatting style.
/// \version 3.8
>From 1b2c79021b19653d435e31692168ab9db00d3743 Mon Sep 17 00:00:00 2001
From: Iuri Chaer <ichaer at splunk.com>
Date: Wed, 14 Aug 2024 15:28:34 +0100
Subject: [PATCH 7/9] Addressing @owenca's feedback.
---
clang/include/clang/Format/Format.h | 4 ++--
clang/lib/Format/BreakableToken.cpp | 12 ++++--------
clang/lib/Format/BreakableToken.h | 2 ++
clang/lib/Format/Format.cpp | 1 +
clang/lib/Format/UnwrappedLineParser.cpp | 16 ++++++++--------
5 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index 7975fcf363db8e..4980c9de9dae5c 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3814,7 +3814,7 @@ struct FormatStyle {
ReferenceAlignmentStyle ReferenceAlignment;
// clang-format off
- /// \brief Types of comment re-flow style.
+ /// \brief Types of comment reflow style.
enum ReflowCommentsStyle : int8_t {
/// Leave comments untouched.
/// \code
@@ -3833,7 +3833,7 @@ struct FormatStyle {
/// * and a misaligned second line */
/// \endcode
RCS_IndentOnly,
- /// Apply indentation rules and re-flow long comments into new lines, trying
+ /// Apply indentation rules and reflow long comments into new lines, trying
/// to obey the ``ColumnLimit``.
/// \code
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp
index 0ccc8a690c2087..bde77578769906 100644
--- a/clang/lib/Format/BreakableToken.cpp
+++ b/clang/lib/Format/BreakableToken.cpp
@@ -420,10 +420,8 @@ BreakableComment::getSplit(unsigned LineIndex, unsigned TailOffset,
unsigned ColumnLimit, unsigned ContentStartColumn,
const llvm::Regex &CommentPragmasRegex) const {
// Don't break lines matching the comment pragmas regex.
- if (Style.ReflowComments != FormatStyle::RCS_Always ||
- CommentPragmasRegex.match(Content[LineIndex])) {
+ if (!AlwaysReflow || CommentPragmasRegex.match(Content[LineIndex]))
return Split(StringRef::npos, 0);
- }
return getCommentSplit(Content[LineIndex].substr(TailOffset),
ContentStartColumn, ColumnLimit, Style.TabWidth,
Encoding, Style);
@@ -610,10 +608,8 @@ BreakableToken::Split BreakableBlockComment::getSplit(
unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit,
unsigned ContentStartColumn, const llvm::Regex &CommentPragmasRegex) const {
// Don't break lines matching the comment pragmas regex.
- if (Style.ReflowComments != FormatStyle::RCS_Always ||
- CommentPragmasRegex.match(Content[LineIndex])) {
+ if (!AlwaysReflow || CommentPragmasRegex.match(Content[LineIndex]))
return Split(StringRef::npos, 0);
- }
return getCommentSplit(Content[LineIndex].substr(TailOffset),
ContentStartColumn, ColumnLimit, Style.TabWidth,
Encoding, Style, Decoration.ends_with("*"));
@@ -859,7 +855,7 @@ bool BreakableBlockComment::mayReflow(
StringRef IndentContent = Content[LineIndex];
if (Lines[LineIndex].ltrim(Blanks).starts_with("*"))
IndentContent = Lines[LineIndex].ltrim(Blanks).substr(1);
- return LineIndex > 0 && Style.ReflowComments == FormatStyle::RCS_Always &&
+ return LineIndex > 0 && AlwaysReflow &&
!CommentPragmasRegex.match(IndentContent) &&
mayReflowContent(Content[LineIndex]) && !Tok.Finalized &&
!switchesFormatting(tokenAt(LineIndex));
@@ -1165,7 +1161,7 @@ bool BreakableLineCommentSection::mayReflow(
// // text that protrudes
// // into text with different indent
// We do reflow in that case in block comments.
- return LineIndex > 0 && Style.ReflowComments == FormatStyle::RCS_Always &&
+ return LineIndex > 0 && AlwaysReflow &&
!CommentPragmasRegex.match(IndentContent) &&
mayReflowContent(Content[LineIndex]) && !Tok.Finalized &&
!switchesFormatting(tokenAt(LineIndex)) &&
diff --git a/clang/lib/Format/BreakableToken.h b/clang/lib/Format/BreakableToken.h
index 8b9360a3335ef4..45c00b35fd01ed 100644
--- a/clang/lib/Format/BreakableToken.h
+++ b/clang/lib/Format/BreakableToken.h
@@ -384,6 +384,8 @@ class BreakableComment : public BreakableToken {
// The intended start column of the first line of text from this section.
unsigned StartColumn;
+ const bool AlwaysReflow = Style.ReflowComments == FormatStyle::RCS_Always;
+
// The prefix to use in front a line that has been reflown up.
// For example, when reflowing the second line after the first here:
// // comment 1
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 389801423716e8..ebc3ddc165aee8 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -520,6 +520,7 @@ template <> struct ScalarEnumerationTraits<FormatStyle::ReflowCommentsStyle> {
IO.enumCase(Value, "Never", FormatStyle::RCS_Never);
IO.enumCase(Value, "IndentOnly", FormatStyle::RCS_IndentOnly);
IO.enumCase(Value, "Always", FormatStyle::RCS_Always);
+ // For backward compatibility:
IO.enumCase(Value, "false", FormatStyle::RCS_Never);
IO.enumCase(Value, "true", FormatStyle::RCS_Always);
}
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 83f42cc4c791cf..77c41456943d63 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -4605,11 +4605,11 @@ bool UnwrappedLineParser::isOnNewLine(const FormatToken &FormatTok) {
// Checks if \p FormatTok is a line comment that continues the line comment
// section on \p Line.
-static bool continuesLineCommentSection(
- const FormatToken &FormatTok, const UnwrappedLine &Line,
- const FormatStyle::ReflowCommentsStyle ReflowCommentsStyle,
- const llvm::Regex &CommentPragmasRegex) {
- if (Line.Tokens.empty() || ReflowCommentsStyle != FormatStyle::RCS_Always)
+static bool
+continuesLineCommentSection(const FormatToken &FormatTok,
+ const UnwrappedLine &Line, const FormatStyle &Style,
+ const llvm::Regex &CommentPragmasRegex) {
+ if (Line.Tokens.empty() || Style.ReflowComments != FormatStyle::RCS_Always)
return false;
StringRef IndentContent = FormatTok.TokenText;
@@ -4721,8 +4721,8 @@ void UnwrappedLineParser::flushComments(bool NewlineBeforeNext) {
//
// FIXME: Consider putting separate line comment sections as children to the
// unwrapped line instead.
- Tok->ContinuesLineCommentSection = continuesLineCommentSection(
- *Tok, *Line, Style.ReflowComments, CommentPragmasRegex);
+ Tok->ContinuesLineCommentSection =
+ continuesLineCommentSection(*Tok, *Line, Style, CommentPragmasRegex);
if (isOnNewLine(*Tok) && JustComments && !Tok->ContinuesLineCommentSection)
addUnwrappedLine();
pushToken(Tok);
@@ -4796,7 +4796,7 @@ void UnwrappedLineParser::distributeComments(
FormatTok->ContinuesLineCommentSection = false;
} else {
FormatTok->ContinuesLineCommentSection = continuesLineCommentSection(
- *FormatTok, *Line, Style.ReflowComments, CommentPragmasRegex);
+ *FormatTok, *Line, Style, CommentPragmasRegex);
}
if (!FormatTok->ContinuesLineCommentSection &&
(isOnNewLine(*FormatTok) || FormatTok->IsFirst)) {
>From f72fe9fe4bc462da483237927945c03c8b4cb3c8 Mon Sep 17 00:00:00 2001
From: Iuri Chaer <ichaer at splunk.com>
Date: Thu, 15 Aug 2024 13:20:28 +0100
Subject: [PATCH 8/9] verifyFormat() and verifyFormat.py
---
clang/docs/ClangFormatStyleOptions.rst | 2 +-
clang/unittests/Format/FormatTestComments.cpp | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 1ad40cbf26b150..4d8501318fa490 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -5299,7 +5299,7 @@ the configuration (without a prefix: ``Auto``).
* and a misaligned second line */
* ``RCS_Always`` (in configuration: ``Always``)
- Apply indentation rules and re-flow long comments into new lines, trying
+ Apply indentation rules and reflow long comments into new lines, trying
to obey the ``ColumnLimit``.
.. code-block:: c++
diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp
index 7bcb78fb92d156..1c6aea683f8c22 100644
--- a/clang/unittests/Format/FormatTestComments.cpp
+++ b/clang/unittests/Format/FormatTestComments.cpp
@@ -494,8 +494,8 @@ TEST_F(FormatTestComments, AlignsBlockComments) {
TEST_F(FormatTestComments, CommentReflowingCanBeTurnedOff) {
FormatStyle Style = getLLVMStyleWithColumns(20);
Style.ReflowComments = FormatStyle::RCS_Never;
- verifyNoChange("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
- verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
+ verifyFormat("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
+ verifyFormat("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
"aaaaaaaaa*/",
Style);
@@ -510,8 +510,8 @@ TEST_F(FormatTestComments, CommentReflowingCanBeTurnedOff) {
TEST_F(FormatTestComments, CommentReflowingCanApplyOnlyToIndents) {
FormatStyle Style = getLLVMStyleWithColumns(20);
Style.ReflowComments = FormatStyle::RCS_IndentOnly;
- verifyNoChange("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
- verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
+ verifyFormat("// aaaaaaaaa aaaaaaaaaa aaaaaaaaaa", Style);
+ verifyFormat("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa */", Style);
verifyNoChange("/* aaaaaaaaa aaaaaaaaaa aaaaaaaaaa\n"
"aaaaaaaaa*/",
Style);
>From 39ccdc0d288a95cb308a20df67ac0ef5a79a3626 Mon Sep 17 00:00:00 2001
From: Iuri Chaer <ichaer at splunk.com>
Date: Fri, 11 Oct 2024 14:57:42 +0100
Subject: [PATCH 9/9] Update release notes.
---
clang/docs/ReleaseNotes.rst | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 39e1b0fcb09bbd..1baf87c153244b 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -319,6 +319,8 @@ clang-format
------------
- Adds ``BreakBinaryOperations`` option.
+- Adds ``IndentOnly`` suboption to ``ReflowComments`` to fix the indentation of multi-line comments
+ without touching their contents, renames ``false`` to ``Never``, and ``true`` to ``Always``.
libclang
--------
More information about the cfe-commits
mailing list