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

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 01:36:53 PDT 2024


================
@@ -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)
----------------
owenca wrote:

```suggestion
  if (Line.Tokens.empty() || Style.ReflowComments != FormatStyle::RCS_Always)
```

https://github.com/llvm/llvm-project/pull/96804


More information about the cfe-commits mailing list