[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
================
@@ -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 ||
----------------
owenca wrote:
```suggestion
if (!AlwaysReflow ||
```
after adding the following to `BreakableToken.h`:
```c++
@@ -393,6 +393,8 @@ protected:
// and not:
// // comment 1comment 2
StringRef ReflowPrefix = " ";
+
+ const bool AlwaysReflow = Style.ReflowComments == FormatStyle::RCS_Always;
};
class BreakableBlockComment : public BreakableComment {
```
https://github.com/llvm/llvm-project/pull/96804
More information about the cfe-commits
mailing list