[cfe-dev] [PATCH] clang-format: Add SpacesInParenthesesStyle

Aaron Wishnick aaron.s.wishnick at gmail.com
Mon Mar 31 10:13:15 PDT 2014


This patch adds an option to control when spaces are added inside of
parentheses. My employer's style guide mandates that spaces go inside the
outermost pair of parentheses, but not the rest. For example:

if( someFunction(a, b, c) ) {
  doThing( f(x), f(g(x)) );
}

My attached patch implements this feature with a new option,
SpacesInParenthesesStyle, which can either be "Always" (the previous
behavior, and the default), or "Outermost", the new behavior used by my
organization.

Does this seem like a reasonable strategy? The new option defaults to the
previous behavior. I see that a different approach was taken with
SpaceBeforeParensOptions. I went with this approach, because the option
applies to spaces inserted inside of parentheses due to
SpacesInParentheses, SpaceInEmptyParentheses,
SpacesInCStyleCastParentheses, etc.

Thanks,
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140331/63587119/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SpacesInParenthesesStyle.patch
Type: application/octet-stream
Size: 9337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140331/63587119/attachment.obj>


More information about the cfe-dev mailing list