[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
Wed Aug 7 10:07:57 PDT 2024


================
@@ -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 3.8` :ref:`¶ <ReflowComments>`
+  Comment reformatting style.
 
-  .. code-block:: c++
+  Possible values:
+
+  * ``// clang-format on`` (in configuration: ``// clang-format on``)
----------------
ichaer wrote:

lol, no, I hadn't noticed it. All I did was `cd clang/docs/tools; ./dump_format_style.py`, following the recommendation in the script's header comment... but I think I know what's happening: I've moved the `clang-format` enabling and disabling comments inside `clang/include/clang/Format/Format.h`, and `dump_format_style.py` can't seem to cope with that...

Hah, yeah, it's a special case: [double-slash comments are interpreted as `config`](https://github.com/llvm/llvm-project/blob/159281a325841575b519dbf93bf0f981c319157e/clang/docs/tools/dump_format_style.py#L433), and printed like that. I don't know what that's used for, I think I'll simply move my `clang-format off` and `clang-format on` comments outside of the `enum` rather than disturb that functionality.

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


More information about the cfe-commits mailing list