[clang] [clang-format] Add ObjCSpaceBeforeMethodDeclColon option to control space before Objective-C method return type (PR #170579)

Vikas Patel via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 24 15:54:54 PST 2025


vkpatel186 wrote:

> Please link a public style guide that wants no space after the +/- prefix. See https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options. Also, add a CHECK_PARSE_BOOL test.
> https://github.com/cocos2d/cocos2d-objc has files without space and i would like add clang formatter for given project
> That's not really a style guide, I can't find anyone there. And the last commit 8 years ago? Even the last issue is over 2 years old. Why not just add a DisableFormat: true?

The reference wasn’t meant to endorse cocos2d-objc as a style guide, only to illustrate that this convention exists in real codebases.

We maintain a large internal fork with this requirement, and DisableFormat isn’t viable because we still want clang-format applied to the remainder of the file. Without a dedicated option, this results in persistent diffs or having to opt out of formatting entirely.

We already support this behavior in an internal fork of clang-format, where it has been used successfully in production. This change simply upstreams that functionality as an opt-in, non-breaking style option.

The intent is to support existing codebases with established conventions, not to recommend or promote a particular formatting style.

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


More information about the cfe-commits mailing list