• Home
  • Raw
  • Download

Lines Matching +full:clang +full:- +full:format

2 Clang-Format 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
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:
29 .. code-block:: yaml
44 When :program:`clang-format` formats a file, it auto-detects the language using
46 extension corresponding to its language, ``-assume-filename=`` option can be
47 used to override the file name :program:`clang-format` uses to detect the
52 .. code-block:: yaml
54 ---
58 ---
63 ---
67 ---
69 # Don't format .proto files.
73 An easy way to get a valid ``.clang-format`` file containing all configuration
76 .. code-block:: console
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:
83 .. code-block:: console
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
97 .. code-block:: c++
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>`_
115 Configurable Format Style Options
127 This option is supported only in the :program:`clang-format` configuration
128 (both within ``-style='{...}'`` and the ``.clang-format`` file).
137 <http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml>`_
140 <http://www.chromium.org/developers/coding-style>`_
143 <https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style>`_
146 <http://www.webkit.org/coding/coding-style.html>`_
164 .. code-block:: c++
172 .. code-block:: c++
181 .. code-block:: c++
194 .. code-block:: c++
206 .. code-block:: c++
214 Otherwise puts them into the right-most column.
223 .. code-block:: c++
284 Always break after the return types of top-level functions.
301 Always break after the return types of top-level functions.
307 Always break after the return type of top-level definitions.
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
444 - No spaces inside the braced list.
445 - No line break before the closing brace.
446 - Indentation with the continuation indent, not with the block indent.
450 (e.g. a type or variable name), clang-format formats as if the ``{}`` were
452 a zero-length name is assumed.
463 If ``true``, clang-format detects whether function calls and
466 Each call can be bin-packed, one-per-line or inconclusive. If it is
468 made, clang-format analyzes whether there are other bin-packed cases in
480 .. code-block:: c++
482 FOREACH(<variable-declaration>, ...)
483 <loop-body>
485 In the .clang-format configuration file, this can be configured like:
487 .. code-block:: yaml
506 (http://llvm.org/docs/CodingStandards.html#include-style). However, you
510 To configure this in the .clang-format file, use:
512 .. code-block:: yaml
515 - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
517 - Regex: '^(<|"(gtest|isl|json)/)'
519 - Regex: '.\*'
524 file-to-main-include mapping.
529 - "" means "arbitrary suffix"
530 - "$" means "no suffix"
568 Language, this format style is targeted at.
586 (https://developers.google.com/protocol-buffers/).
622 Add a space after ``@property`` in Objective-C, i.e. use
626 Add a space in front of an Objective-C protocol list, i.e. use
665 If ``true``, clang-format will attempt to re-flow comments.
668 If ``true``, clang-format will sort ``#includes``.
690 prohibited by the syntax rules (in function-like macro definitions) or
701 (``//`` - comments).
703 This does not affect trailing block comments (``/*`` - comments) as
725 Format compatible with this standard, e.g. use ``A<A<int> >``
731 Use C++03-compatible syntax.
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
789 .. code-block:: yaml
800 .. code-block:: c++
829 .. code-block:: yaml
840 .. code-block:: c++