Lines Matching +refs:clang +refs:format +refs:style
5 :doc:`ClangFormatStyleOptions` describes configurable formatting style options
8 When using :program:`clang-format` command line utility or
9 ``clang::format::reformat(...)`` functions from code, one can either use one of
11 custom style by configuring specific style options.
14 Configuring Style with clang-format
17 :program:`clang-format` supports two ways to provide custom style options:
18 directly specify style configuration in the ``-style=`` command line option or
19 use ``-style=file`` and put style configuration in the ``.clang-format`` or
20 ``_clang-format`` file in the project directory.
22 When using ``-style=file``, :program:`clang-format` for each input file will
23 try to find the ``.clang-format`` file located in the closest parent directory
27 The ``.clang-format`` file uses YAML format:
40 language set, it will set the default style options for all lanugages.
44 When :program:`clang-format` formats a file, it auto-detects the language using
47 used to override the file name :program:`clang-format` uses to detect the
55 # We'll use defaults from the LLVM style, but with 4 columns indentation.
69 # Don't format .proto files.
73 An easy way to get a valid ``.clang-format`` file containing all configuration
74 options of a certain predefined style is:
78 clang-format -style=llvm -dump-config > .clang-format
80 When specifying configuration in the ``-style=`` option, the same configuration
81 is applied for all input files. The format of the configuration is:
85 -style='{key1: value1, key2: value2, ...}'
91 Clang-format understands also special comments that switch formatting in a
92 delimited range. The code between a comment ``// clang-format off`` or
93 ``/* clang-format off */`` up to a comment ``// clang-format on`` or
94 ``/* clang-format on */`` will not be formatted. The comments themselves
100 // clang-format off
102 // clang-format on
109 When using ``clang::format::reformat(...)`` functions, the format is specified
110 by supplying the `clang::format::FormatStyle
111 <http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html>`_
118 This section lists the supported style options. Value type is specified for
125 The style used for all options not specifically set in the configuration.
127 This option is supported only in the :program:`clang-format` configuration
128 (both within ``-style='{...}'`` and the ``.clang-format`` file).
133 A style complying with the `LLVM coding standards
136 A style complying with `Google's C++ style guide
139 A style complying with `Chromium's style guide
140 <http://www.chromium.org/developers/coding-style>`_
142 A style complying with `Mozilla's style guide
145 A style complying with `WebKit's style guide
146 <http://www.webkit.org/coding/coding-style.html>`_
271 The function definition return type breaking style to use. This
289 The function declaration return type breaking style to use.
372 The brace breaking style to use.
421 clang-format will respect the input's line breaking decisions within
440 If ``true``, format braced lists as best suited for C++11 braced
450 (e.g. a type or variable name), clang-format formats as if the ``{}`` were
463 If ``true``, clang-format detects whether function calls and
468 made, clang-format analyzes whether there are other bin-packed cases in
485 In the .clang-format configuration file, this can be configured like:
506 (http://llvm.org/docs/CodingStandards.html#include-style). However, you
510 To configure this in the .clang-format file, use:
515 - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
568 Language, this format style is targeted at.
649 Pointer and reference alignment style.
665 If ``true``, clang-format will attempt to re-flow comments.
668 If ``true``, clang-format will sort ``#includes``.
671 If ``true``, a space may be inserted after C style casts.
691 when determined by other style rules (after unary operators, opening
712 If ``true``, spaces may be inserted into C style casts.
763 Adding additional style options
766 Each additional style option adds costs to the clang-format project. Some of
767 these costs affect the clang-format development itself, as we need to make
773 The goal of the clang-format project is more on the side of supporting a
774 limited set of styles really well as opposed to supporting every single style
776 major projects and thus have established the following bar for adding style
777 options. Each new style option must ..
780 * have a publicly accessible style guide
786 A style similar to the `Linux Kernel style
827 A style similar to the default Visual Studio formatting style: