summaryrefslogtreecommitdiffstats
path: root/clang/docs/ClangFormatStyleOptions.rst
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: Add MacroBlock{Begin,End} optionsBirunthan Mohanathas2015-07-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MacroBlockBegin and MacroBlockEnd options make matching macro identifiers behave like '{' and '}', respectively, in terms of indentation. Mozilla code, for example, uses several macros that begin and end a scope. Previously, Clang-Format removed the indentation resulting in: MACRO_BEGIN(...) MACRO_ENTRY(...) MACRO_ENTRY(...) MACRO_END Now, using the options MacroBlockBegin: "^[A-Z_]+_BEGIN$" MacroBlockEnd: "^[A-Z_]+_END$" will yield the expected result: MACRO_BEGIN(...) MACRO_ENTRY(...) MACRO_ENTRY(...) MACRO_END Differential Revision: http://reviews.llvm.org/D10840 llvm-svn: 241363
* clang-format: Add option to break after definition return type for top-level ↵Birunthan Mohanathas2015-06-291-5/+12
| | | | | | | | functions only Differential Revision: http://reviews.llvm.org/D10774 llvm-svn: 240959
* clang-format: Fix language of DisableFormat descriptionBirunthan Mohanathas2015-06-271-1/+1
| | | | | | This is a comment-only change to test commit access. llvm-svn: 240879
* clang-format: Make AlwaysBreakBeforeMultilineStrings more conservative.Daniel Jasper2015-06-181-0/+5
| | | | | | | | | | | | | | | | | In essence this is meant to consistently indent multiline strings by a fixed amount of spaces from the start of the line. Don't do this in cases where it wouldn't help anyway. Before: someFunction(aaaaa, "aaaaa" "bbbbb"); After: someFunction(aaaaa, "aaaaa" "bbbbb"); llvm-svn: 240004
* clang-format: Make SFS_Inline imply SFS_Empty.Daniel Jasper2015-06-111-18/+15
| | | | | | | | | | In the long run, these two might be independent or we might to only allow specific combinations. Until we have a corresponding request, however, it is hard to do the right thing and choose the right configuration options. Thus, just don't touch the options yet and just modify the behavior slightly. llvm-svn: 239531
* Fix indentation problem introduced in r236964. NFCJonathan Roelofs2015-05-111-10/+10
| | | | llvm-svn: 236965
* Fix formatting of a few code blocks. NFCJonathan Roelofs2015-05-111-6/+9
| | | | llvm-svn: 236964
* clang-format: Add ability to align assignment operators.Daniel Jasper2015-04-291-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | In Objective-C some style guides use a style where assignment operators are aligned, in an effort to increase code readability. This patch adds an option to the format library which allows this functionality. It is disabled by default for all the included styles, so it must be explicitly enabled. The option will change code such as: - (void)method { NSNumber *one = @1; NSNumber *twentyFive = @25; } to: - (void)method { NSNumber *one = @1; NSNumber *twentyFive = @25; } Patch by Matt Oakes. Thank you! Accidentally reformatted all the tests... llvm-svn: 236100
* clang-format: Escape '*' in generated flag documentation.Daniel Jasper2014-12-021-1/+1
| | | | llvm-svn: 223118
* clang-format: Add option to suppress operator alignment.Daniel Jasper2014-12-021-1/+17
| | | | | | | | | | | | | | | | With alignment: int aaaaaa = aa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb * cccccccccccccccccccccccccccccccc; Without alignment: int aaaaaa = aa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb * cccccccccccccccccccccccccccccccc; This fixes llvm.org/PR21666. llvm-svn: 223117
* clang-format: Update generated documentation with new flag.Daniel Jasper2014-10-281-0/+3
| | | | llvm-svn: 220786
* Escaping a special character in the documentation.Aaron Ballman2014-10-091-1/+1
| | | | llvm-svn: 219407
* clang-format: Add option to control call argument bin-packing separatelyDaniel Jasper2014-10-091-3/+9
| | | | | | | This is desirable for the Chromium style guide: http://www.chromium.org/developers/coding-style llvm-svn: 219400
* clang-format: Add documentation about disabling formatting.Daniel Jasper2014-10-071-0/+18
| | | | | | Patch by Marek Kurdej, thanks! llvm-svn: 219204
* [sphinx cleanup]Dan Liew2014-09-161-1/+1
| | | | | | Fix warning introduced by r211098. llvm-svn: 217864
* clang-format: Add option to break before non-assignment operators.Daniel Jasper2014-09-151-3/+13
| | | | | | | | | This will allow: int aaaaaaaaaaaaaa = bbbbbbbbbbbbbb + ccccccccccccccc; llvm-svn: 217757
* [sphinx cleanup]Dan Liew2014-09-101-1/+1
| | | | | | Fix sphinx warning introduced by r217501. llvm-svn: 217524
* clang-format: Add option to allow short case labels on a single line.Daniel Jasper2014-09-101-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | On a single line: switch (a) { case 1: x = 1; return; case 2: x = 2; return; default: break; } Not on a single line: switch (a) { case 1: x = 1; return; case 2: x = 2; return; default: break; } This partly addresses llvm.org/PR16535. In the long run, we probably want to lay these out in columns. llvm-svn: 217501
* clang-format: Add an option 'SpaceAfterCStyleCast'.Daniel Jasper2014-09-031-0/+3
| | | | | | | | | | | | | | | | | This permits to add a space after closing parenthesis of a C-style cast. Defaults to false to preserve old behavior. Fixes llvm.org/PR19982. Before: (int)i; After: (int) i; Patch by Marek Kurdej. llvm-svn: 217022
* clang-format: New option SpacesInSquareBrackets.Daniel Jasper2014-08-261-0/+4
| | | | | | | | | | | | | | | | Before: int a[5]; a[3] += 42; After: int a[ 5 ]; a[ 3 ] += 42; Fixes LLVM bug #17887 (http://llvm.org/bugs/show_bug.cgi?id=17887). Patch by Marek Kurdej, thank you! llvm-svn: 216449
* Add documentation on how Language option in .clang-format files work.Alexander Kornienko2014-08-121-0/+37
| | | | llvm-svn: 215443
* Fix sphinx warning.Dan Liew2014-08-061-1/+1
| | | | llvm-svn: 214967
* clang-format: Add option to always break after a function's return type.Daniel Jasper2014-08-051-2/+9
| | | | | | | | | | This is required for GNU coding style, among others. Also update the configuration documentation. Modified from an original patch by Jarkko Hietaniemi, thank you! llvm-svn: 214858
* Escaping an RST character to correct a Sphinx warning.Aaron Ballman2014-07-221-1/+1
| | | | llvm-svn: 213651
* clang-format: Add new option to indent wrapped function declarations.Daniel Jasper2014-07-091-0/+4
| | | | | | | | | Though not completely identical, make former IndentFunctionDeclarationAfterType change this flag for backwards compatibility (it is somewhat close in meaning and better the err'ing on an unknown config flag). llvm-svn: 212597
* clang-format: Update flag documentation.Daniel Jasper2014-07-091-5/+1
| | | | llvm-svn: 212594
* Escaping a literal character to fix an RST warning.Aaron Ballman2014-06-251-1/+1
| | | | llvm-svn: 211690
* clang-format: Introduce style with spaces on both sides of */&.Daniel Jasper2014-06-171-5/+18
| | | | | | | Patch by Janusz Sobczak (slightly extended). This fixes llvm.org/19929. llvm-svn: 211098
* clang-format: Fix Sphinx build error.Daniel Jasper2014-05-151-2/+3
| | | | | | Patch by Adam Strzelecki, thank you! llvm-svn: 208882
* clang-format: Add option to allow short blocks on a single line.Daniel Jasper2014-05-141-2/+7
| | | | | | | | | With AllowShortBlocksOnASingleLine, clang-format allows: if (a) { return; } Based on patch by Gonzalo BG, thank you! llvm-svn: 208765
* Fix sphinx-build warnings in clang docs.Reid Kleckner2014-04-181-1/+1
| | | | llvm-svn: 206661
* clang-format: Update flag documentation, and generation script.Daniel Jasper2014-04-091-9/+29
| | | | llvm-svn: 205853
* clang-format: Support configurable list of foreach-macros.Daniel Jasper2014-04-011-0/+8
| | | | | | | | This fixes llvm.org/PR17242. Patch by Brian Green, thank you! llvm-svn: 205307
* clang-format: Improve documentation of DerivePointerBinding.Daniel Jasper2014-02-131-3/+23
| | | | | | | | For reference: llvm.org/PR18690. Also updated generated help page and page creation script. llvm-svn: 201323
* Support GNU style rule to put a space before opening parenthesis.Alexander Kornienko2013-12-101-7/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Updated examples of UseTab optionAlexander Kornienko2013-09-271-2/+2
| | | | llvm-svn: 191529
* Updated clang-format style options doc.Alexander Kornienko2013-09-271-5/+18
| | | | llvm-svn: 191528
* clang-format: Option to removing the space before assignment operators.Daniel Jasper2013-09-251-0/+3
| | | | | | Patch contributed by Aaron Wishnick. Thank you! llvm-svn: 191375
* Allow _clang-format as alternative to .clang-format config filenameHans Wennborg2013-09-101-2/+2
| | | | | | | | | | | 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
* A minor fix in the documentation.Alexander Kornienko2013-09-041-2/+2
| | | | llvm-svn: 189947
* Added documentation for clang-format style options.Alexander Kornienko2013-09-041-0/+375
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
OpenPOWER on IntegriCloud