[clang] [clang-format] Add `SpaceInComments` option to control spacing around `/* */` (PR #162105)

via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 29 05:02:01 PST 2025


Men-cotton wrote:

@owenca
Thanks for the clarification.

To provide a bit of context on how this evolved into a struct: I initially split out inline parameter comments from regular block comments based on [earlier feedback](https://github.com/llvm/llvm-project/pull/162105#discussion_r2414578200) from @mydeveloperday.
The concern was that a single global `Always` setting would negatively impact parameter hints, turning `foo(/*bar=*/true)` into `foo(/* bar= */true)`.

I’m planning to rework the patch to follow your proposal and expose a single `SpacesInComments` enum, similar to `SpacesInAngles`.

For the actual behavior, my current thought is to apply this option only to “ordinary” block comments and to treat `/*param=*/`-style parameter comments and documentation comments (`/** ... */`, `/*! ... */`, etc.) as out of scope, so they remain unchanged regardless of the setting. Does that match what you had in mind, or would you prefer a different treatment for `/*param=*/` comments in particular?

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


More information about the cfe-commits mailing list