xref: /aosp_15_r20/external/clang/docs/ClangFormatStyleOptions.rst (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li==========================
2*67e74705SXin LiClang-Format Style Options
3*67e74705SXin Li==========================
4*67e74705SXin Li
5*67e74705SXin Li:doc:`ClangFormatStyleOptions` describes configurable formatting style options
6*67e74705SXin Lisupported by :doc:`LibFormat` and :doc:`ClangFormat`.
7*67e74705SXin Li
8*67e74705SXin LiWhen using :program:`clang-format` command line utility or
9*67e74705SXin Li``clang::format::reformat(...)`` functions from code, one can either use one of
10*67e74705SXin Lithe predefined styles (LLVM, Google, Chromium, Mozilla, WebKit) or create a
11*67e74705SXin Licustom style by configuring specific style options.
12*67e74705SXin Li
13*67e74705SXin Li
14*67e74705SXin LiConfiguring Style with clang-format
15*67e74705SXin Li===================================
16*67e74705SXin Li
17*67e74705SXin Li:program:`clang-format` supports two ways to provide custom style options:
18*67e74705SXin Lidirectly specify style configuration in the ``-style=`` command line option or
19*67e74705SXin Liuse ``-style=file`` and put style configuration in the ``.clang-format`` or
20*67e74705SXin Li``_clang-format`` file in the project directory.
21*67e74705SXin Li
22*67e74705SXin LiWhen using ``-style=file``, :program:`clang-format` for each input file will
23*67e74705SXin Litry to find the ``.clang-format`` file located in the closest parent directory
24*67e74705SXin Liof the input file. When the standard input is used, the search is started from
25*67e74705SXin Lithe current directory.
26*67e74705SXin Li
27*67e74705SXin LiThe ``.clang-format`` file uses YAML format:
28*67e74705SXin Li
29*67e74705SXin Li.. code-block:: yaml
30*67e74705SXin Li
31*67e74705SXin Li  key1: value1
32*67e74705SXin Li  key2: value2
33*67e74705SXin Li  # A comment.
34*67e74705SXin Li  ...
35*67e74705SXin Li
36*67e74705SXin LiThe configuration file can consist of several sections each having different
37*67e74705SXin Li``Language:`` parameter denoting the programming language this section of the
38*67e74705SXin Liconfiguration is targeted at. See the description of the **Language** option
39*67e74705SXin Libelow for the list of supported languages. The first section may have no
40*67e74705SXin Lilanguage set, it will set the default style options for all lanugages.
41*67e74705SXin LiConfiguration sections for specific language will override options set in the
42*67e74705SXin Lidefault section.
43*67e74705SXin Li
44*67e74705SXin LiWhen :program:`clang-format` formats a file, it auto-detects the language using
45*67e74705SXin Lithe file name. When formatting standard input or a file that doesn't have the
46*67e74705SXin Liextension corresponding to its language, ``-assume-filename=`` option can be
47*67e74705SXin Liused to override the file name :program:`clang-format` uses to detect the
48*67e74705SXin Lilanguage.
49*67e74705SXin Li
50*67e74705SXin LiAn example of a configuration file for multiple languages:
51*67e74705SXin Li
52*67e74705SXin Li.. code-block:: yaml
53*67e74705SXin Li
54*67e74705SXin Li  ---
55*67e74705SXin Li  # We'll use defaults from the LLVM style, but with 4 columns indentation.
56*67e74705SXin Li  BasedOnStyle: LLVM
57*67e74705SXin Li  IndentWidth: 4
58*67e74705SXin Li  ---
59*67e74705SXin Li  Language: Cpp
60*67e74705SXin Li  # Force pointers to the type for C++.
61*67e74705SXin Li  DerivePointerAlignment: false
62*67e74705SXin Li  PointerAlignment: Left
63*67e74705SXin Li  ---
64*67e74705SXin Li  Language: JavaScript
65*67e74705SXin Li  # Use 100 columns for JS.
66*67e74705SXin Li  ColumnLimit: 100
67*67e74705SXin Li  ---
68*67e74705SXin Li  Language: Proto
69*67e74705SXin Li  # Don't format .proto files.
70*67e74705SXin Li  DisableFormat: true
71*67e74705SXin Li  ...
72*67e74705SXin Li
73*67e74705SXin LiAn easy way to get a valid ``.clang-format`` file containing all configuration
74*67e74705SXin Lioptions of a certain predefined style is:
75*67e74705SXin Li
76*67e74705SXin Li.. code-block:: console
77*67e74705SXin Li
78*67e74705SXin Li  clang-format -style=llvm -dump-config > .clang-format
79*67e74705SXin Li
80*67e74705SXin LiWhen specifying configuration in the ``-style=`` option, the same configuration
81*67e74705SXin Liis applied for all input files. The format of the configuration is:
82*67e74705SXin Li
83*67e74705SXin Li.. code-block:: console
84*67e74705SXin Li
85*67e74705SXin Li  -style='{key1: value1, key2: value2, ...}'
86*67e74705SXin Li
87*67e74705SXin Li
88*67e74705SXin LiDisabling Formatting on a Piece of Code
89*67e74705SXin Li=======================================
90*67e74705SXin Li
91*67e74705SXin LiClang-format understands also special comments that switch formatting in a
92*67e74705SXin Lidelimited range. The code between a comment ``// clang-format off`` or
93*67e74705SXin Li``/* clang-format off */`` up to a comment ``// clang-format on`` or
94*67e74705SXin Li``/* clang-format on */`` will not be formatted. The comments themselves
95*67e74705SXin Liwill be formatted (aligned) normally.
96*67e74705SXin Li
97*67e74705SXin Li.. code-block:: c++
98*67e74705SXin Li
99*67e74705SXin Li  int formatted_code;
100*67e74705SXin Li  // clang-format off
101*67e74705SXin Li      void    unformatted_code  ;
102*67e74705SXin Li  // clang-format on
103*67e74705SXin Li  void formatted_code_again;
104*67e74705SXin Li
105*67e74705SXin Li
106*67e74705SXin LiConfiguring Style in Code
107*67e74705SXin Li=========================
108*67e74705SXin Li
109*67e74705SXin LiWhen using ``clang::format::reformat(...)`` functions, the format is specified
110*67e74705SXin Liby supplying the `clang::format::FormatStyle
111*67e74705SXin Li<http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html>`_
112*67e74705SXin Listructure.
113*67e74705SXin Li
114*67e74705SXin Li
115*67e74705SXin LiConfigurable Format Style Options
116*67e74705SXin Li=================================
117*67e74705SXin Li
118*67e74705SXin LiThis section lists the supported style options. Value type is specified for
119*67e74705SXin Lieach option. For enumeration types possible values are specified both as a C++
120*67e74705SXin Lienumeration member (with a prefix, e.g. ``LS_Auto``), and as a value usable in
121*67e74705SXin Lithe configuration (without a prefix: ``Auto``).
122*67e74705SXin Li
123*67e74705SXin Li
124*67e74705SXin Li**BasedOnStyle** (``string``)
125*67e74705SXin Li  The style used for all options not specifically set in the configuration.
126*67e74705SXin Li
127*67e74705SXin Li  This option is supported only in the :program:`clang-format` configuration
128*67e74705SXin Li  (both within ``-style='{...}'`` and the ``.clang-format`` file).
129*67e74705SXin Li
130*67e74705SXin Li  Possible values:
131*67e74705SXin Li
132*67e74705SXin Li  * ``LLVM``
133*67e74705SXin Li    A style complying with the `LLVM coding standards
134*67e74705SXin Li    <http://llvm.org/docs/CodingStandards.html>`_
135*67e74705SXin Li  * ``Google``
136*67e74705SXin Li    A style complying with `Google's C++ style guide
137*67e74705SXin Li    <http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml>`_
138*67e74705SXin Li  * ``Chromium``
139*67e74705SXin Li    A style complying with `Chromium's style guide
140*67e74705SXin Li    <http://www.chromium.org/developers/coding-style>`_
141*67e74705SXin Li  * ``Mozilla``
142*67e74705SXin Li    A style complying with `Mozilla's style guide
143*67e74705SXin Li    <https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style>`_
144*67e74705SXin Li  * ``WebKit``
145*67e74705SXin Li    A style complying with `WebKit's style guide
146*67e74705SXin Li    <http://www.webkit.org/coding/coding-style.html>`_
147*67e74705SXin Li
148*67e74705SXin Li.. START_FORMAT_STYLE_OPTIONS
149*67e74705SXin Li
150*67e74705SXin Li**AccessModifierOffset** (``int``)
151*67e74705SXin Li  The extra indent or outdent of access modifiers, e.g. ``public:``.
152*67e74705SXin Li
153*67e74705SXin Li**AlignAfterOpenBracket** (``BracketAlignmentStyle``)
154*67e74705SXin Li  If ``true``, horizontally aligns arguments after an open bracket.
155*67e74705SXin Li
156*67e74705SXin Li  This applies to round brackets (parentheses), angle brackets and square
157*67e74705SXin Li  brackets.
158*67e74705SXin Li
159*67e74705SXin Li  Possible values:
160*67e74705SXin Li
161*67e74705SXin Li  * ``BAS_Align`` (in configuration: ``Align``)
162*67e74705SXin Li    Align parameters on the open bracket, e.g.:
163*67e74705SXin Li
164*67e74705SXin Li    .. code-block:: c++
165*67e74705SXin Li
166*67e74705SXin Li      someLongFunction(argument1,
167*67e74705SXin Li                       argument2);
168*67e74705SXin Li
169*67e74705SXin Li  * ``BAS_DontAlign`` (in configuration: ``DontAlign``)
170*67e74705SXin Li    Don't align, instead use ``ContinuationIndentWidth``, e.g.:
171*67e74705SXin Li
172*67e74705SXin Li    .. code-block:: c++
173*67e74705SXin Li
174*67e74705SXin Li      someLongFunction(argument1,
175*67e74705SXin Li          argument2);
176*67e74705SXin Li
177*67e74705SXin Li  * ``BAS_AlwaysBreak`` (in configuration: ``AlwaysBreak``)
178*67e74705SXin Li    Always break after an open bracket, if the parameters don't fit
179*67e74705SXin Li    on a single line, e.g.:
180*67e74705SXin Li
181*67e74705SXin Li    .. code-block:: c++
182*67e74705SXin Li
183*67e74705SXin Li      someLongFunction(
184*67e74705SXin Li          argument1, argument2);
185*67e74705SXin Li
186*67e74705SXin Li
187*67e74705SXin Li
188*67e74705SXin Li**AlignConsecutiveAssignments** (``bool``)
189*67e74705SXin Li  If ``true``, aligns consecutive assignments.
190*67e74705SXin Li
191*67e74705SXin Li  This will align the assignment operators of consecutive lines. This
192*67e74705SXin Li  will result in formattings like
193*67e74705SXin Li
194*67e74705SXin Li  .. code-block:: c++
195*67e74705SXin Li
196*67e74705SXin Li    int aaaa = 12;
197*67e74705SXin Li    int b    = 23;
198*67e74705SXin Li    int ccc  = 23;
199*67e74705SXin Li
200*67e74705SXin Li**AlignConsecutiveDeclarations** (``bool``)
201*67e74705SXin Li  If ``true``, aligns consecutive declarations.
202*67e74705SXin Li
203*67e74705SXin Li  This will align the declaration names of consecutive lines. This
204*67e74705SXin Li  will result in formattings like
205*67e74705SXin Li
206*67e74705SXin Li  .. code-block:: c++
207*67e74705SXin Li
208*67e74705SXin Li    int         aaaa = 12;
209*67e74705SXin Li    float       b = 23;
210*67e74705SXin Li    std::string ccc = 23;
211*67e74705SXin Li
212*67e74705SXin Li**AlignEscapedNewlinesLeft** (``bool``)
213*67e74705SXin Li  If ``true``, aligns escaped newlines as far left as possible.
214*67e74705SXin Li  Otherwise puts them into the right-most column.
215*67e74705SXin Li
216*67e74705SXin Li**AlignOperands** (``bool``)
217*67e74705SXin Li  If ``true``, horizontally align operands of binary and ternary
218*67e74705SXin Li  expressions.
219*67e74705SXin Li
220*67e74705SXin Li  Specifically, this aligns operands of a single expression that needs to be
221*67e74705SXin Li  split over multiple lines, e.g.:
222*67e74705SXin Li
223*67e74705SXin Li  .. code-block:: c++
224*67e74705SXin Li
225*67e74705SXin Li    int aaa = bbbbbbbbbbbbbbb +
226*67e74705SXin Li              ccccccccccccccc;
227*67e74705SXin Li
228*67e74705SXin Li**AlignTrailingComments** (``bool``)
229*67e74705SXin Li  If ``true``, aligns trailing comments.
230*67e74705SXin Li
231*67e74705SXin Li**AllowAllParametersOfDeclarationOnNextLine** (``bool``)
232*67e74705SXin Li  Allow putting all parameters of a function declaration onto
233*67e74705SXin Li  the next line even if ``BinPackParameters`` is ``false``.
234*67e74705SXin Li
235*67e74705SXin Li**AllowShortBlocksOnASingleLine** (``bool``)
236*67e74705SXin Li  Allows contracting simple braced statements to a single line.
237*67e74705SXin Li
238*67e74705SXin Li  E.g., this allows ``if (a) { return; }`` to be put on a single line.
239*67e74705SXin Li
240*67e74705SXin Li**AllowShortCaseLabelsOnASingleLine** (``bool``)
241*67e74705SXin Li  If ``true``, short case labels will be contracted to a single line.
242*67e74705SXin Li
243*67e74705SXin Li**AllowShortFunctionsOnASingleLine** (``ShortFunctionStyle``)
244*67e74705SXin Li  Dependent on the value, ``int f() { return 0; }`` can be put on a
245*67e74705SXin Li  single line.
246*67e74705SXin Li
247*67e74705SXin Li  Possible values:
248*67e74705SXin Li
249*67e74705SXin Li  * ``SFS_None`` (in configuration: ``None``)
250*67e74705SXin Li    Never merge functions into a single line.
251*67e74705SXin Li
252*67e74705SXin Li  * ``SFS_Empty`` (in configuration: ``Empty``)
253*67e74705SXin Li    Only merge empty functions.
254*67e74705SXin Li
255*67e74705SXin Li  * ``SFS_Inline`` (in configuration: ``Inline``)
256*67e74705SXin Li    Only merge functions defined inside a class. Implies "empty".
257*67e74705SXin Li
258*67e74705SXin Li  * ``SFS_All`` (in configuration: ``All``)
259*67e74705SXin Li    Merge all functions fitting on a single line.
260*67e74705SXin Li
261*67e74705SXin Li
262*67e74705SXin Li
263*67e74705SXin Li**AllowShortIfStatementsOnASingleLine** (``bool``)
264*67e74705SXin Li  If ``true``, ``if (a) return;`` can be put on a single line.
265*67e74705SXin Li
266*67e74705SXin Li**AllowShortLoopsOnASingleLine** (``bool``)
267*67e74705SXin Li  If ``true``, ``while (true) continue;`` can be put on a single
268*67e74705SXin Li  line.
269*67e74705SXin Li
270*67e74705SXin Li**AlwaysBreakAfterDefinitionReturnType** (``DefinitionReturnTypeBreakingStyle``)
271*67e74705SXin Li  The function definition return type breaking style to use.  This
272*67e74705SXin Li  option is deprecated and is retained for backwards compatibility.
273*67e74705SXin Li
274*67e74705SXin Li  Possible values:
275*67e74705SXin Li
276*67e74705SXin Li  * ``DRTBS_None`` (in configuration: ``None``)
277*67e74705SXin Li    Break after return type automatically.
278*67e74705SXin Li    ``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
279*67e74705SXin Li
280*67e74705SXin Li  * ``DRTBS_All`` (in configuration: ``All``)
281*67e74705SXin Li    Always break after the return type.
282*67e74705SXin Li
283*67e74705SXin Li  * ``DRTBS_TopLevel`` (in configuration: ``TopLevel``)
284*67e74705SXin Li    Always break after the return types of top-level functions.
285*67e74705SXin Li
286*67e74705SXin Li
287*67e74705SXin Li
288*67e74705SXin Li**AlwaysBreakAfterReturnType** (``ReturnTypeBreakingStyle``)
289*67e74705SXin Li  The function declaration return type breaking style to use.
290*67e74705SXin Li
291*67e74705SXin Li  Possible values:
292*67e74705SXin Li
293*67e74705SXin Li  * ``RTBS_None`` (in configuration: ``None``)
294*67e74705SXin Li    Break after return type automatically.
295*67e74705SXin Li    ``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
296*67e74705SXin Li
297*67e74705SXin Li  * ``RTBS_All`` (in configuration: ``All``)
298*67e74705SXin Li    Always break after the return type.
299*67e74705SXin Li
300*67e74705SXin Li  * ``RTBS_TopLevel`` (in configuration: ``TopLevel``)
301*67e74705SXin Li    Always break after the return types of top-level functions.
302*67e74705SXin Li
303*67e74705SXin Li  * ``RTBS_AllDefinitions`` (in configuration: ``AllDefinitions``)
304*67e74705SXin Li    Always break after the return type of function definitions.
305*67e74705SXin Li
306*67e74705SXin Li  * ``RTBS_TopLevelDefinitions`` (in configuration: ``TopLevelDefinitions``)
307*67e74705SXin Li    Always break after the return type of top-level definitions.
308*67e74705SXin Li
309*67e74705SXin Li
310*67e74705SXin Li
311*67e74705SXin Li**AlwaysBreakBeforeMultilineStrings** (``bool``)
312*67e74705SXin Li  If ``true``, always break before multiline string literals.
313*67e74705SXin Li
314*67e74705SXin Li  This flag is mean to make cases where there are multiple multiline strings
315*67e74705SXin Li  in a file look more consistent. Thus, it will only take effect if wrapping
316*67e74705SXin Li  the string at that point leads to it being indented
317*67e74705SXin Li  ``ContinuationIndentWidth`` spaces from the start of the line.
318*67e74705SXin Li
319*67e74705SXin Li**AlwaysBreakTemplateDeclarations** (``bool``)
320*67e74705SXin Li  If ``true``, always break after the ``template<...>`` of a template
321*67e74705SXin Li  declaration.
322*67e74705SXin Li
323*67e74705SXin Li**BinPackArguments** (``bool``)
324*67e74705SXin Li  If ``false``, a function call's arguments will either be all on the
325*67e74705SXin Li  same line or will have one line each.
326*67e74705SXin Li
327*67e74705SXin Li**BinPackParameters** (``bool``)
328*67e74705SXin Li  If ``false``, a function declaration's or function definition's
329*67e74705SXin Li  parameters will either all be on the same line or will have one line each.
330*67e74705SXin Li
331*67e74705SXin Li**BraceWrapping** (``BraceWrappingFlags``)
332*67e74705SXin Li  Control of individual brace wrapping cases.
333*67e74705SXin Li
334*67e74705SXin Li  If ``BreakBeforeBraces`` is set to ``BS_Custom``, use this to specify how
335*67e74705SXin Li  each individual brace case should be handled. Otherwise, this is ignored.
336*67e74705SXin Li
337*67e74705SXin Li  Nested configuration flags:
338*67e74705SXin Li
339*67e74705SXin Li  * ``bool AfterClass`` Wrap class definitions.
340*67e74705SXin Li  * ``bool AfterControlStatement`` Wrap control statements (``if``/``for``/``while``/``switch``/..).
341*67e74705SXin Li  * ``bool AfterEnum`` Wrap enum definitions.
342*67e74705SXin Li  * ``bool AfterFunction`` Wrap function definitions.
343*67e74705SXin Li  * ``bool AfterNamespace`` Wrap namespace definitions.
344*67e74705SXin Li  * ``bool AfterObjCDeclaration`` Wrap ObjC definitions (``@autoreleasepool``, interfaces, ..).
345*67e74705SXin Li  * ``bool AfterStruct`` Wrap struct definitions.
346*67e74705SXin Li  * ``bool AfterUnion`` Wrap union definitions.
347*67e74705SXin Li  * ``bool BeforeCatch`` Wrap before ``catch``.
348*67e74705SXin Li  * ``bool BeforeElse`` Wrap before ``else``.
349*67e74705SXin Li  * ``bool IndentBraces`` Indent the wrapped braces themselves.
350*67e74705SXin Li
351*67e74705SXin Li
352*67e74705SXin Li**BreakAfterJavaFieldAnnotations** (``bool``)
353*67e74705SXin Li  Break after each annotation on a field in Java files.
354*67e74705SXin Li
355*67e74705SXin Li**BreakBeforeBinaryOperators** (``BinaryOperatorStyle``)
356*67e74705SXin Li  The way to wrap binary operators.
357*67e74705SXin Li
358*67e74705SXin Li  Possible values:
359*67e74705SXin Li
360*67e74705SXin Li  * ``BOS_None`` (in configuration: ``None``)
361*67e74705SXin Li    Break after operators.
362*67e74705SXin Li
363*67e74705SXin Li  * ``BOS_NonAssignment`` (in configuration: ``NonAssignment``)
364*67e74705SXin Li    Break before operators that aren't assignments.
365*67e74705SXin Li
366*67e74705SXin Li  * ``BOS_All`` (in configuration: ``All``)
367*67e74705SXin Li    Break before operators.
368*67e74705SXin Li
369*67e74705SXin Li
370*67e74705SXin Li
371*67e74705SXin Li**BreakBeforeBraces** (``BraceBreakingStyle``)
372*67e74705SXin Li  The brace breaking style to use.
373*67e74705SXin Li
374*67e74705SXin Li  Possible values:
375*67e74705SXin Li
376*67e74705SXin Li  * ``BS_Attach`` (in configuration: ``Attach``)
377*67e74705SXin Li    Always attach braces to surrounding context.
378*67e74705SXin Li
379*67e74705SXin Li  * ``BS_Linux`` (in configuration: ``Linux``)
380*67e74705SXin Li    Like ``Attach``, but break before braces on function, namespace and
381*67e74705SXin Li    class definitions.
382*67e74705SXin Li
383*67e74705SXin Li  * ``BS_Mozilla`` (in configuration: ``Mozilla``)
384*67e74705SXin Li    Like ``Attach``, but break before braces on enum, function, and record
385*67e74705SXin Li    definitions.
386*67e74705SXin Li
387*67e74705SXin Li  * ``BS_Stroustrup`` (in configuration: ``Stroustrup``)
388*67e74705SXin Li    Like ``Attach``, but break before function definitions, ``catch``, and
389*67e74705SXin Li    ``else``.
390*67e74705SXin Li
391*67e74705SXin Li  * ``BS_Allman`` (in configuration: ``Allman``)
392*67e74705SXin Li    Always break before braces.
393*67e74705SXin Li
394*67e74705SXin Li  * ``BS_GNU`` (in configuration: ``GNU``)
395*67e74705SXin Li    Always break before braces and add an extra level of indentation to
396*67e74705SXin Li    braces of control statements, not to those of class, function
397*67e74705SXin Li    or other definitions.
398*67e74705SXin Li
399*67e74705SXin Li  * ``BS_WebKit`` (in configuration: ``WebKit``)
400*67e74705SXin Li    Like ``Attach``, but break before functions.
401*67e74705SXin Li
402*67e74705SXin Li  * ``BS_Custom`` (in configuration: ``Custom``)
403*67e74705SXin Li    Configure each individual brace in `BraceWrapping`.
404*67e74705SXin Li
405*67e74705SXin Li
406*67e74705SXin Li
407*67e74705SXin Li**BreakBeforeTernaryOperators** (``bool``)
408*67e74705SXin Li  If ``true``, ternary operators will be placed after line breaks.
409*67e74705SXin Li
410*67e74705SXin Li**BreakConstructorInitializersBeforeComma** (``bool``)
411*67e74705SXin Li  Always break constructor initializers before commas and align
412*67e74705SXin Li  the commas with the colon.
413*67e74705SXin Li
414*67e74705SXin Li**BreakStringLiterals** (``bool``)
415*67e74705SXin Li  Allow breaking string literals when formatting.
416*67e74705SXin Li
417*67e74705SXin Li**ColumnLimit** (``unsigned``)
418*67e74705SXin Li  The column limit.
419*67e74705SXin Li
420*67e74705SXin Li  A column limit of ``0`` means that there is no column limit. In this case,
421*67e74705SXin Li  clang-format will respect the input's line breaking decisions within
422*67e74705SXin Li  statements unless they contradict other rules.
423*67e74705SXin Li
424*67e74705SXin Li**CommentPragmas** (``std::string``)
425*67e74705SXin Li  A regular expression that describes comments with special meaning,
426*67e74705SXin Li  which should not be split into lines or otherwise changed.
427*67e74705SXin Li
428*67e74705SXin Li**ConstructorInitializerAllOnOneLineOrOnePerLine** (``bool``)
429*67e74705SXin Li  If the constructor initializers don't fit on a line, put each
430*67e74705SXin Li  initializer on its own line.
431*67e74705SXin Li
432*67e74705SXin Li**ConstructorInitializerIndentWidth** (``unsigned``)
433*67e74705SXin Li  The number of characters to use for indentation of constructor
434*67e74705SXin Li  initializer lists.
435*67e74705SXin Li
436*67e74705SXin Li**ContinuationIndentWidth** (``unsigned``)
437*67e74705SXin Li  Indent width for line continuations.
438*67e74705SXin Li
439*67e74705SXin Li**Cpp11BracedListStyle** (``bool``)
440*67e74705SXin Li  If ``true``, format braced lists as best suited for C++11 braced
441*67e74705SXin Li  lists.
442*67e74705SXin Li
443*67e74705SXin Li  Important differences:
444*67e74705SXin Li  - No spaces inside the braced list.
445*67e74705SXin Li  - No line break before the closing brace.
446*67e74705SXin Li  - Indentation with the continuation indent, not with the block indent.
447*67e74705SXin Li
448*67e74705SXin Li  Fundamentally, C++11 braced lists are formatted exactly like function
449*67e74705SXin Li  calls would be formatted in their place. If the braced list follows a name
450*67e74705SXin Li  (e.g. a type or variable name), clang-format formats as if the ``{}`` were
451*67e74705SXin Li  the parentheses of a function call with that name. If there is no name,
452*67e74705SXin Li  a zero-length name is assumed.
453*67e74705SXin Li
454*67e74705SXin Li**DerivePointerAlignment** (``bool``)
455*67e74705SXin Li  If ``true``, analyze the formatted file for the most common
456*67e74705SXin Li  alignment of ``&`` and ``\*``. ``PointerAlignment`` is then used only as
457*67e74705SXin Li  fallback.
458*67e74705SXin Li
459*67e74705SXin Li**DisableFormat** (``bool``)
460*67e74705SXin Li  Disables formatting completely.
461*67e74705SXin Li
462*67e74705SXin Li**ExperimentalAutoDetectBinPacking** (``bool``)
463*67e74705SXin Li  If ``true``, clang-format detects whether function calls and
464*67e74705SXin Li  definitions are formatted with one parameter per line.
465*67e74705SXin Li
466*67e74705SXin Li  Each call can be bin-packed, one-per-line or inconclusive. If it is
467*67e74705SXin Li  inconclusive, e.g. completely on one line, but a decision needs to be
468*67e74705SXin Li  made, clang-format analyzes whether there are other bin-packed cases in
469*67e74705SXin Li  the input file and act accordingly.
470*67e74705SXin Li
471*67e74705SXin Li  NOTE: This is an experimental flag, that might go away or be renamed. Do
472*67e74705SXin Li  not use this in config files, etc. Use at your own risk.
473*67e74705SXin Li
474*67e74705SXin Li**ForEachMacros** (``std::vector<std::string>``)
475*67e74705SXin Li  A vector of macros that should be interpreted as foreach loops
476*67e74705SXin Li  instead of as function calls.
477*67e74705SXin Li
478*67e74705SXin Li  These are expected to be macros of the form:
479*67e74705SXin Li
480*67e74705SXin Li  .. code-block:: c++
481*67e74705SXin Li
482*67e74705SXin Li    FOREACH(<variable-declaration>, ...)
483*67e74705SXin Li      <loop-body>
484*67e74705SXin Li
485*67e74705SXin Li  In the .clang-format configuration file, this can be configured like:
486*67e74705SXin Li
487*67e74705SXin Li  .. code-block:: yaml
488*67e74705SXin Li
489*67e74705SXin Li    ForEachMacros: ['RANGES_FOR', 'FOREACH']
490*67e74705SXin Li
491*67e74705SXin Li  For example: BOOST_FOREACH.
492*67e74705SXin Li
493*67e74705SXin Li**IncludeCategories** (``std::vector<IncludeCategory>``)
494*67e74705SXin Li  Regular expressions denoting the different ``#include`` categories
495*67e74705SXin Li  used for ordering ``#includes``.
496*67e74705SXin Li
497*67e74705SXin Li  These regular expressions are matched against the filename of an include
498*67e74705SXin Li  (including the <> or "") in order. The value belonging to the first
499*67e74705SXin Li  matching regular expression is assigned and ``#includes`` are sorted first
500*67e74705SXin Li  according to increasing category number and then alphabetically within
501*67e74705SXin Li  each category.
502*67e74705SXin Li
503*67e74705SXin Li  If none of the regular expressions match, INT_MAX is assigned as
504*67e74705SXin Li  category. The main header for a source file automatically gets category 0.
505*67e74705SXin Li  so that it is generally kept at the beginning of the ``#includes``
506*67e74705SXin Li  (http://llvm.org/docs/CodingStandards.html#include-style). However, you
507*67e74705SXin Li  can also assign negative priorities if you have certain headers that
508*67e74705SXin Li  always need to be first.
509*67e74705SXin Li
510*67e74705SXin Li  To configure this in the .clang-format file, use:
511*67e74705SXin Li
512*67e74705SXin Li  .. code-block:: yaml
513*67e74705SXin Li
514*67e74705SXin Li    IncludeCategories:
515*67e74705SXin Li      - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
516*67e74705SXin Li        Priority:        2
517*67e74705SXin Li      - Regex:           '^(<|"(gtest|isl|json)/)'
518*67e74705SXin Li        Priority:        3
519*67e74705SXin Li      - Regex:           '.\*'
520*67e74705SXin Li        Priority:        1
521*67e74705SXin Li
522*67e74705SXin Li**IncludeIsMainRegex** (``std::string``)
523*67e74705SXin Li  Specify a regular expression of suffixes that are allowed in the
524*67e74705SXin Li  file-to-main-include mapping.
525*67e74705SXin Li
526*67e74705SXin Li  When guessing whether a #include is the "main" include (to assign
527*67e74705SXin Li  category 0, see above), use this regex of allowed suffixes to the header
528*67e74705SXin Li  stem. A partial match is done, so that:
529*67e74705SXin Li  - "" means "arbitrary suffix"
530*67e74705SXin Li  - "$" means "no suffix"
531*67e74705SXin Li
532*67e74705SXin Li  For example, if configured to "(_test)?$", then a header a.h would be seen
533*67e74705SXin Li  as the "main" include in both a.cc and a_test.cc.
534*67e74705SXin Li
535*67e74705SXin Li**IndentCaseLabels** (``bool``)
536*67e74705SXin Li  Indent case labels one level from the switch statement.
537*67e74705SXin Li
538*67e74705SXin Li  When ``false``, use the same indentation level as for the switch statement.
539*67e74705SXin Li  Switch statement body is always indented one level more than case labels.
540*67e74705SXin Li
541*67e74705SXin Li**IndentWidth** (``unsigned``)
542*67e74705SXin Li  The number of columns to use for indentation.
543*67e74705SXin Li
544*67e74705SXin Li**IndentWrappedFunctionNames** (``bool``)
545*67e74705SXin Li  Indent if a function definition or declaration is wrapped after the
546*67e74705SXin Li  type.
547*67e74705SXin Li
548*67e74705SXin Li**JavaScriptQuotes** (``JavaScriptQuoteStyle``)
549*67e74705SXin Li  The JavaScriptQuoteStyle to use for JavaScript strings.
550*67e74705SXin Li
551*67e74705SXin Li  Possible values:
552*67e74705SXin Li
553*67e74705SXin Li  * ``JSQS_Leave`` (in configuration: ``Leave``)
554*67e74705SXin Li    Leave string quotes as they are.
555*67e74705SXin Li
556*67e74705SXin Li  * ``JSQS_Single`` (in configuration: ``Single``)
557*67e74705SXin Li    Always use single quotes.
558*67e74705SXin Li
559*67e74705SXin Li  * ``JSQS_Double`` (in configuration: ``Double``)
560*67e74705SXin Li    Always use double quotes.
561*67e74705SXin Li
562*67e74705SXin Li
563*67e74705SXin Li
564*67e74705SXin Li**KeepEmptyLinesAtTheStartOfBlocks** (``bool``)
565*67e74705SXin Li  If true, empty lines at the start of blocks are kept.
566*67e74705SXin Li
567*67e74705SXin Li**Language** (``LanguageKind``)
568*67e74705SXin Li  Language, this format style is targeted at.
569*67e74705SXin Li
570*67e74705SXin Li  Possible values:
571*67e74705SXin Li
572*67e74705SXin Li  * ``LK_None`` (in configuration: ``None``)
573*67e74705SXin Li    Do not use.
574*67e74705SXin Li
575*67e74705SXin Li  * ``LK_Cpp`` (in configuration: ``Cpp``)
576*67e74705SXin Li    Should be used for C, C++, ObjectiveC, ObjectiveC++.
577*67e74705SXin Li
578*67e74705SXin Li  * ``LK_Java`` (in configuration: ``Java``)
579*67e74705SXin Li    Should be used for Java.
580*67e74705SXin Li
581*67e74705SXin Li  * ``LK_JavaScript`` (in configuration: ``JavaScript``)
582*67e74705SXin Li    Should be used for JavaScript.
583*67e74705SXin Li
584*67e74705SXin Li  * ``LK_Proto`` (in configuration: ``Proto``)
585*67e74705SXin Li    Should be used for Protocol Buffers
586*67e74705SXin Li    (https://developers.google.com/protocol-buffers/).
587*67e74705SXin Li
588*67e74705SXin Li  * ``LK_TableGen`` (in configuration: ``TableGen``)
589*67e74705SXin Li    Should be used for TableGen code.
590*67e74705SXin Li
591*67e74705SXin Li
592*67e74705SXin Li
593*67e74705SXin Li**MacroBlockBegin** (``std::string``)
594*67e74705SXin Li  A regular expression matching macros that start a block.
595*67e74705SXin Li
596*67e74705SXin Li**MacroBlockEnd** (``std::string``)
597*67e74705SXin Li  A regular expression matching macros that end a block.
598*67e74705SXin Li
599*67e74705SXin Li**MaxEmptyLinesToKeep** (``unsigned``)
600*67e74705SXin Li  The maximum number of consecutive empty lines to keep.
601*67e74705SXin Li
602*67e74705SXin Li**NamespaceIndentation** (``NamespaceIndentationKind``)
603*67e74705SXin Li  The indentation used for namespaces.
604*67e74705SXin Li
605*67e74705SXin Li  Possible values:
606*67e74705SXin Li
607*67e74705SXin Li  * ``NI_None`` (in configuration: ``None``)
608*67e74705SXin Li    Don't indent in namespaces.
609*67e74705SXin Li
610*67e74705SXin Li  * ``NI_Inner`` (in configuration: ``Inner``)
611*67e74705SXin Li    Indent only in inner namespaces (nested in other namespaces).
612*67e74705SXin Li
613*67e74705SXin Li  * ``NI_All`` (in configuration: ``All``)
614*67e74705SXin Li    Indent in all namespaces.
615*67e74705SXin Li
616*67e74705SXin Li
617*67e74705SXin Li
618*67e74705SXin Li**ObjCBlockIndentWidth** (``unsigned``)
619*67e74705SXin Li  The number of characters to use for indentation of ObjC blocks.
620*67e74705SXin Li
621*67e74705SXin Li**ObjCSpaceAfterProperty** (``bool``)
622*67e74705SXin Li  Add a space after ``@property`` in Objective-C, i.e. use
623*67e74705SXin Li  ``@property (readonly)`` instead of ``@property(readonly)``.
624*67e74705SXin Li
625*67e74705SXin Li**ObjCSpaceBeforeProtocolList** (``bool``)
626*67e74705SXin Li  Add a space in front of an Objective-C protocol list, i.e. use
627*67e74705SXin Li  ``Foo <Protocol>`` instead of ``Foo<Protocol>``.
628*67e74705SXin Li
629*67e74705SXin Li**PenaltyBreakBeforeFirstCallParameter** (``unsigned``)
630*67e74705SXin Li  The penalty for breaking a function call after ``call(``.
631*67e74705SXin Li
632*67e74705SXin Li**PenaltyBreakComment** (``unsigned``)
633*67e74705SXin Li  The penalty for each line break introduced inside a comment.
634*67e74705SXin Li
635*67e74705SXin Li**PenaltyBreakFirstLessLess** (``unsigned``)
636*67e74705SXin Li  The penalty for breaking before the first ``<<``.
637*67e74705SXin Li
638*67e74705SXin Li**PenaltyBreakString** (``unsigned``)
639*67e74705SXin Li  The penalty for each line break introduced inside a string literal.
640*67e74705SXin Li
641*67e74705SXin Li**PenaltyExcessCharacter** (``unsigned``)
642*67e74705SXin Li  The penalty for each character outside of the column limit.
643*67e74705SXin Li
644*67e74705SXin Li**PenaltyReturnTypeOnItsOwnLine** (``unsigned``)
645*67e74705SXin Li  Penalty for putting the return type of a function onto its own
646*67e74705SXin Li  line.
647*67e74705SXin Li
648*67e74705SXin Li**PointerAlignment** (``PointerAlignmentStyle``)
649*67e74705SXin Li  Pointer and reference alignment style.
650*67e74705SXin Li
651*67e74705SXin Li  Possible values:
652*67e74705SXin Li
653*67e74705SXin Li  * ``PAS_Left`` (in configuration: ``Left``)
654*67e74705SXin Li    Align pointer to the left.
655*67e74705SXin Li
656*67e74705SXin Li  * ``PAS_Right`` (in configuration: ``Right``)
657*67e74705SXin Li    Align pointer to the right.
658*67e74705SXin Li
659*67e74705SXin Li  * ``PAS_Middle`` (in configuration: ``Middle``)
660*67e74705SXin Li    Align pointer in the middle.
661*67e74705SXin Li
662*67e74705SXin Li
663*67e74705SXin Li
664*67e74705SXin Li**ReflowComments** (``bool``)
665*67e74705SXin Li  If ``true``, clang-format will attempt to re-flow comments.
666*67e74705SXin Li
667*67e74705SXin Li**SortIncludes** (``bool``)
668*67e74705SXin Li  If ``true``, clang-format will sort ``#includes``.
669*67e74705SXin Li
670*67e74705SXin Li**SpaceAfterCStyleCast** (``bool``)
671*67e74705SXin Li  If ``true``, a space may be inserted after C style casts.
672*67e74705SXin Li
673*67e74705SXin Li**SpaceBeforeAssignmentOperators** (``bool``)
674*67e74705SXin Li  If ``false``, spaces will be removed before assignment operators.
675*67e74705SXin Li
676*67e74705SXin Li**SpaceBeforeParens** (``SpaceBeforeParensOptions``)
677*67e74705SXin Li  Defines in which cases to put a space before opening parentheses.
678*67e74705SXin Li
679*67e74705SXin Li  Possible values:
680*67e74705SXin Li
681*67e74705SXin Li  * ``SBPO_Never`` (in configuration: ``Never``)
682*67e74705SXin Li    Never put a space before opening parentheses.
683*67e74705SXin Li
684*67e74705SXin Li  * ``SBPO_ControlStatements`` (in configuration: ``ControlStatements``)
685*67e74705SXin Li    Put a space before opening parentheses only after control statement
686*67e74705SXin Li    keywords (``for/if/while...``).
687*67e74705SXin Li
688*67e74705SXin Li  * ``SBPO_Always`` (in configuration: ``Always``)
689*67e74705SXin Li    Always put a space before opening parentheses, except when it's
690*67e74705SXin Li    prohibited by the syntax rules (in function-like macro definitions) or
691*67e74705SXin Li    when determined by other style rules (after unary operators, opening
692*67e74705SXin Li    parentheses, etc.)
693*67e74705SXin Li
694*67e74705SXin Li
695*67e74705SXin Li
696*67e74705SXin Li**SpaceInEmptyParentheses** (``bool``)
697*67e74705SXin Li  If ``true``, spaces may be inserted into ``()``.
698*67e74705SXin Li
699*67e74705SXin Li**SpacesBeforeTrailingComments** (``unsigned``)
700*67e74705SXin Li  The number of spaces before trailing line comments
701*67e74705SXin Li  (``//`` - comments).
702*67e74705SXin Li
703*67e74705SXin Li  This does not affect trailing block comments (``/*`` - comments) as
704*67e74705SXin Li  those commonly have different usage patterns and a number of special
705*67e74705SXin Li  cases.
706*67e74705SXin Li
707*67e74705SXin Li**SpacesInAngles** (``bool``)
708*67e74705SXin Li  If ``true``, spaces will be inserted after ``<`` and before ``>``
709*67e74705SXin Li  in template argument lists.
710*67e74705SXin Li
711*67e74705SXin Li**SpacesInCStyleCastParentheses** (``bool``)
712*67e74705SXin Li  If ``true``, spaces may be inserted into C style casts.
713*67e74705SXin Li
714*67e74705SXin Li**SpacesInContainerLiterals** (``bool``)
715*67e74705SXin Li  If ``true``, spaces are inserted inside container literals (e.g.
716*67e74705SXin Li  ObjC and Javascript array and dict literals).
717*67e74705SXin Li
718*67e74705SXin Li**SpacesInParentheses** (``bool``)
719*67e74705SXin Li  If ``true``, spaces will be inserted after ``(`` and before ``)``.
720*67e74705SXin Li
721*67e74705SXin Li**SpacesInSquareBrackets** (``bool``)
722*67e74705SXin Li  If ``true``, spaces will be inserted after ``[`` and before ``]``.
723*67e74705SXin Li
724*67e74705SXin Li**Standard** (``LanguageStandard``)
725*67e74705SXin Li  Format compatible with this standard, e.g. use ``A<A<int> >``
726*67e74705SXin Li  instead of ``A<A<int>>`` for ``LS_Cpp03``.
727*67e74705SXin Li
728*67e74705SXin Li  Possible values:
729*67e74705SXin Li
730*67e74705SXin Li  * ``LS_Cpp03`` (in configuration: ``Cpp03``)
731*67e74705SXin Li    Use C++03-compatible syntax.
732*67e74705SXin Li
733*67e74705SXin Li  * ``LS_Cpp11`` (in configuration: ``Cpp11``)
734*67e74705SXin Li    Use features of C++11 (e.g. ``A<A<int>>`` instead of ``A<A<int> >``).
735*67e74705SXin Li
736*67e74705SXin Li  * ``LS_Auto`` (in configuration: ``Auto``)
737*67e74705SXin Li    Automatic detection based on the input.
738*67e74705SXin Li
739*67e74705SXin Li
740*67e74705SXin Li
741*67e74705SXin Li**TabWidth** (``unsigned``)
742*67e74705SXin Li  The number of columns used for tab stops.
743*67e74705SXin Li
744*67e74705SXin Li**UseTab** (``UseTabStyle``)
745*67e74705SXin Li  The way to use tab characters in the resulting file.
746*67e74705SXin Li
747*67e74705SXin Li  Possible values:
748*67e74705SXin Li
749*67e74705SXin Li  * ``UT_Never`` (in configuration: ``Never``)
750*67e74705SXin Li    Never use tab.
751*67e74705SXin Li
752*67e74705SXin Li  * ``UT_ForIndentation`` (in configuration: ``ForIndentation``)
753*67e74705SXin Li    Use tabs only for indentation.
754*67e74705SXin Li
755*67e74705SXin Li  * ``UT_Always`` (in configuration: ``Always``)
756*67e74705SXin Li    Use tabs whenever we need to fill whitespace that spans at least from
757*67e74705SXin Li    one tab stop to the next one.
758*67e74705SXin Li
759*67e74705SXin Li
760*67e74705SXin Li
761*67e74705SXin Li.. END_FORMAT_STYLE_OPTIONS
762*67e74705SXin Li
763*67e74705SXin LiAdding additional style options
764*67e74705SXin Li===============================
765*67e74705SXin Li
766*67e74705SXin LiEach additional style option adds costs to the clang-format project. Some of
767*67e74705SXin Lithese costs affect the clang-format development itself, as we need to make
768*67e74705SXin Lisure that any given combination of options work and that new features don't
769*67e74705SXin Libreak any of the existing options in any way. There are also costs for end users
770*67e74705SXin Lias options become less discoverable and people have to think about and make a
771*67e74705SXin Lidecision on options they don't really care about.
772*67e74705SXin Li
773*67e74705SXin LiThe goal of the clang-format project is more on the side of supporting a
774*67e74705SXin Lilimited set of styles really well as opposed to supporting every single style
775*67e74705SXin Liused by a codebase somewhere in the wild. Of course, we do want to support all
776*67e74705SXin Limajor projects and thus have established the following bar for adding style
777*67e74705SXin Lioptions. Each new style option must ..
778*67e74705SXin Li
779*67e74705SXin Li  * be used in a project of significant size (have dozens of contributors)
780*67e74705SXin Li  * have a publicly accessible style guide
781*67e74705SXin Li  * have a person willing to contribute and maintain patches
782*67e74705SXin Li
783*67e74705SXin LiExamples
784*67e74705SXin Li========
785*67e74705SXin Li
786*67e74705SXin LiA style similar to the `Linux Kernel style
787*67e74705SXin Li<https://www.kernel.org/doc/Documentation/CodingStyle>`_:
788*67e74705SXin Li
789*67e74705SXin Li.. code-block:: yaml
790*67e74705SXin Li
791*67e74705SXin Li  BasedOnStyle: LLVM
792*67e74705SXin Li  IndentWidth: 8
793*67e74705SXin Li  UseTab: Always
794*67e74705SXin Li  BreakBeforeBraces: Linux
795*67e74705SXin Li  AllowShortIfStatementsOnASingleLine: false
796*67e74705SXin Li  IndentCaseLabels: false
797*67e74705SXin Li
798*67e74705SXin LiThe result is (imagine that tabs are used for indentation here):
799*67e74705SXin Li
800*67e74705SXin Li.. code-block:: c++
801*67e74705SXin Li
802*67e74705SXin Li  void test()
803*67e74705SXin Li  {
804*67e74705SXin Li          switch (x) {
805*67e74705SXin Li          case 0:
806*67e74705SXin Li          case 1:
807*67e74705SXin Li                  do_something();
808*67e74705SXin Li                  break;
809*67e74705SXin Li          case 2:
810*67e74705SXin Li                  do_something_else();
811*67e74705SXin Li                  break;
812*67e74705SXin Li          default:
813*67e74705SXin Li                  break;
814*67e74705SXin Li          }
815*67e74705SXin Li          if (condition)
816*67e74705SXin Li                  do_something_completely_different();
817*67e74705SXin Li
818*67e74705SXin Li          if (x == y) {
819*67e74705SXin Li                  q();
820*67e74705SXin Li          } else if (x > y) {
821*67e74705SXin Li                  w();
822*67e74705SXin Li          } else {
823*67e74705SXin Li                  r();
824*67e74705SXin Li          }
825*67e74705SXin Li  }
826*67e74705SXin Li
827*67e74705SXin LiA style similar to the default Visual Studio formatting style:
828*67e74705SXin Li
829*67e74705SXin Li.. code-block:: yaml
830*67e74705SXin Li
831*67e74705SXin Li  UseTab: Never
832*67e74705SXin Li  IndentWidth: 4
833*67e74705SXin Li  BreakBeforeBraces: Allman
834*67e74705SXin Li  AllowShortIfStatementsOnASingleLine: false
835*67e74705SXin Li  IndentCaseLabels: false
836*67e74705SXin Li  ColumnLimit: 0
837*67e74705SXin Li
838*67e74705SXin LiThe result is:
839*67e74705SXin Li
840*67e74705SXin Li.. code-block:: c++
841*67e74705SXin Li
842*67e74705SXin Li  void test()
843*67e74705SXin Li  {
844*67e74705SXin Li      switch (suffix)
845*67e74705SXin Li      {
846*67e74705SXin Li      case 0:
847*67e74705SXin Li      case 1:
848*67e74705SXin Li          do_something();
849*67e74705SXin Li          break;
850*67e74705SXin Li      case 2:
851*67e74705SXin Li          do_something_else();
852*67e74705SXin Li          break;
853*67e74705SXin Li      default:
854*67e74705SXin Li          break;
855*67e74705SXin Li      }
856*67e74705SXin Li      if (condition)
857*67e74705SXin Li          do_somthing_completely_different();
858*67e74705SXin Li
859*67e74705SXin Li      if (x == y)
860*67e74705SXin Li      {
861*67e74705SXin Li          q();
862*67e74705SXin Li      }
863*67e74705SXin Li      else if (x > y)
864*67e74705SXin Li      {
865*67e74705SXin Li          w();
866*67e74705SXin Li      }
867*67e74705SXin Li      else
868*67e74705SXin Li      {
869*67e74705SXin Li          r();
870*67e74705SXin Li      }
871*67e74705SXin Li  }
872*67e74705SXin Li
873