Commit Graph

7 Commits

Author SHA1 Message Date
Alexander Kornienko fdca83d487 Support GNU style rule to put a space before opening parenthesis.
Summary:
The rule from the GNU style states:
"We find it easier to read a program when it has spaces before the open-parentheses and after the commas."

http://www.gnu.org/prep/standards/standards.html#index-spaces-before-open_002dparen

This patch makes clang-format adds an option to put spaces before almost all open parentheses, except the cases, where different behavior is dictated by the style rules or language syntax:
  * preprocessor:
    ** function-like macro definitions can't have a space between the macro name and the parenthesis;
    ** `#if defined(...)` can have a space, but it seems, that it's more frequently used without a space in GCC, for example;
  * never add spaces after unary operators;
  * adding spaces between two opening parentheses is controlled with the `SpacesInParentheses` option;
  * never add spaces between `[` and `(` (there's no option yet).

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D2326

llvm-svn: 196901
2013-12-10 10:18:34 +00:00
Alexander Kornienko 8ba68f6802 Updated examples of UseTab option
llvm-svn: 191529
2013-09-27 16:19:25 +00:00
Alexander Kornienko 45ca09b3f5 Updated clang-format style options doc.
llvm-svn: 191528
2013-09-27 16:16:55 +00:00
Daniel Jasper d94bff3721 clang-format: Option to removing the space before assignment operators.
Patch contributed by Aaron Wishnick. Thank you!

llvm-svn: 191375
2013-09-25 15:15:02 +00:00
Hans Wennborg 9f6581bb88 Allow _clang-format as alternative to .clang-format config filename
Dotfiles are impractical on Windows. This makes clang-format search
for the style configuration file as '_clang-format' in addition to
the usual '.clang-format'. This is similar to how VIM searches for
'_vimrc' on Windows.

Differential Revision: http://llvm-reviews.chandlerc.com/D1629

llvm-svn: 190413
2013-09-10 15:41:12 +00:00
Alexander Kornienko 472d27aa22 A minor fix in the documentation.
llvm-svn: 189947
2013-09-04 15:14:18 +00:00
Alexander Kornienko d278e0eee3 Added documentation for clang-format style options.
Summary:
The main contents is in the ClangFormatStyleOptions.rst, which can be
updated from the Format.h by the dump_format_style.py script.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1597

llvm-svn: 189946
2013-09-04 15:09:13 +00:00