[clang] [clang-format] Option to insert spaces before the closing `*/` (PR #162105)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 26 23:48:12 PDT 2025


================
@@ -4684,6 +4684,15 @@ struct FormatStyle {
   /// \version 17
   bool SpaceBeforeJsonColon;
 
+  /// If ``true``, a space is inserted immediately before the closing ``*/`` in
+  /// block comments that contain content.
+  /// \code
+  ///    true:                                  false:
+  ///    /* comment */                  vs.     /* comment*/
----------------
Men-cotton wrote:

I’ve wired up `SpaceInComments` per your struct.

At the moment, `AfterOpeningParamComment` defaults to `Leave`, which means parameter comments fall back to whatever AfterOpeningComment specifies—e.g., if the general option is `Always`, we still insert the leading space in `/*param=*/`, and if it’s `Never`, we remove it. Setting `AfterOpeningParamComment` to `Always` or `Never` overrides that fallback.

Is that the interaction you were expecting, or should `Leave` on the parameter knob preserve the existing spacing even when the general control is driving changes?

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


More information about the cfe-commits mailing list