Debian Codegraph @

.clang-format

raw
1 # Clang-format configuration file for FlightGear.
2 #
3 # The settings below were chosen based largely on two criteria:
4 #
5 # 1) The "average flightgear coding style", defined as producing a minimal diff
6 # in the flightgear repository when running the following commands:
7 #
8 # $ find src/ -type f \( -iname *.c -o -iname *.cxx -o -iname *.h \
9 # -o -iname *.hxx \) -exec clang-format -i {} \;
10 # $ git diff --shortstat
11 #
12 # 2) The preservation of meticulously formatted code found in many files.
13 #
14 # This file should be considered as a style-guide for new code.
15 #
16 # The comments before each option are reStructuredText formatted text converted
17 # from the https://clang.llvm.org/docs/ClangFormatStyleOptions.html web page.
18
19
20 ---
21 # **Language** (``LanguageKind``)
22 # Language, this format style is targeted at.
23 #
24 # Possible values:
25 #
26 # * ``LK_None`` (in configuration: ``None``) Do not use.
27 # * ``LK_Cpp`` (in configuration: ``Cpp``) Should be used for C, C++.
28 # * ``LK_Java`` (in configuration: ``Java``) Should be used for Java.
29 # * ``LK_JavaScript`` (in configuration: ``JavaScript``) Should be used for JavaScript.
30 # * ``LK_ObjC`` (in configuration: ``ObjC``) Should be used for Objective-C, Objective-C++.
31 # * ``LK_Proto`` (in configuration: ``Proto``) Should be used for Protocol Buffers (https://developers.google.com/protocol-buffers/).
32 # * ``LK_TableGen`` (in configuration: ``TableGen``) Should be used for TableGen code.
33 # * ``LK_TextProto`` (in configuration: ``TextProto``) Should be used for Protocol Buffer messages in text format (https://developers.google.com/protocol-buffers/).
34
35 Language: Cpp
36
37 # **BasedOnStyle** (``string``)
38 # The style used for all options not specifically set in the configuration.
39 #
40 # This option is supported only in the **clang-format** configuration (both within ``-style='{...}'`` and the ``.clang-format`` file).
41 #
42 # Possible values:
43 #
44 # * ``LLVM`` A style complying with the `LLVM coding standards`_
45 # * ``Google`` A style complying with `Google's C++ style guide`_
46 # * ``Chromium`` A style complying with `Chromium's style guide`_
47 # * ``Mozilla`` A style complying with `Mozilla's style guide`_
48 # * ``WebKit`` A style complying with `WebKit's style guide`_
49 #
50 #
51 # .. _LLVM coding standards: http://llvm.org/docs/CodingStandards.html
52 # .. _Google's C++ style guide: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
53 # .. _Chromium's style guide: http://www.chromium.org/developers/coding-style
54 # .. _Mozilla's style guide: https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style
55 # .. _WebKit's style guide: http://www.webkit.org/coding/coding-style.html
56
57 # Rational: Not needed as all options are manually set.
58 #BasedOnStyle: LLVM
59
60
61 # **AccessModifierOffset** (``int``)
62 # The extra indent or outdent of access modifiers, e.g. ``public:``.
63
64 # Rational: Average FG style with minimal diff.
65 AccessModifierOffset: -4
66
67
68 # **AlignAfterOpenBracket** (``BracketAlignmentStyle``)
69 # If ``true``, horizontally aligns arguments after an open bracket.
70 #
71 # This applies to round brackets (parentheses), angle brackets and square brackets.
72 #
73 # Possible values:
74 #
75 # * ``BAS_Align`` (in configuration: ``Align``) Align parameters on the open bracket, e.g.:
76 #
77 # .. parsed-literal::
78 #
79 # someLongFunction(argument1,
80 # argument2);
81 #
82 # * ``BAS_DontAlign`` (in configuration: ``DontAlign``) Don't align, instead use ``ContinuationIndentWidth``, e.g.:
83 #
84 # .. parsed-literal::
85 #
86 # someLongFunction(argument1,
87 # argument2);
88 #
89 # * ``BAS_AlwaysBreak`` (in configuration: ``AlwaysBreak``) Always break after an open bracket, if the parameters don't fit on a single line, e.g.:
90 #
91 # .. parsed-literal::
92 #
93 # someLongFunction(
94 # argument1, argument2);
95
96 # Rational: Average FG style with minimal diff.
97 #AlignAfterOpenBracket: AlwaysBreak
98
99 # Rational: Preservation of formatting.
100 AlignAfterOpenBracket: Align
101
102
103 # **AlignConsecutiveAssignments** (``bool``)
104 # If ``true``, aligns consecutive assignments.
105 #
106 # This will align the assignment operators of consecutive lines. This will result in formattings like
107 #
108 # .. parsed-literal::
109 #
110 # int aaaa = 12;
111 # int b = 23;
112 # int ccc = 23;
113
114 # Rational: Average FG style with minimal diff.
115 AlignConsecutiveAssignments: false
116
117 # Rational: Preservation of formatting.
118 #AlignConsecutiveAssignments: true
119
120
121 # **AlignConsecutiveDeclarations** (``bool``)
122 # If ``true``, aligns consecutive declarations.
123 #
124 # This will align the declaration names of consecutive lines. This will result in formattings like
125 #
126 # .. parsed-literal::
127 #
128 # int aaaa = 12;
129 # float b = 23;
130 # std::string ccc = 23;
131
132 # Rational: Average FG style with minimal diff.
133 # Rational: Preservation of formatting.
134 AlignConsecutiveDeclarations: false
135
136 # **AlignEscapedNewlines** (``EscapedNewlineAlignmentStyle``)
137 # Options for aligning backslashes in escaped newlines.
138 #
139 # Possible values:
140 #
141 # * ``ENAS_DontAlign`` (in configuration: ``DontAlign``) Don't align escaped newlines.
142 #
143 # .. parsed-literal::
144 #
145 # #define A \\
146 # int aaaa; \\
147 # int b; \\
148 # int dddddddddd;
149 #
150 # * ``ENAS_Left`` (in configuration: ``Left``) Align escaped newlines as far left as possible.
151 #
152 # .. parsed-literal::
153 #
154 # true:
155 # #define A \\
156 # int aaaa; \\
157 # int b; \\
158 # int dddddddddd;
159 #
160 # false:
161 #
162 # * ``ENAS_Right`` (in configuration: ``Right``) Align escaped newlines in the right-most column.
163 #
164 # .. parsed-literal::
165 #
166 # #define A \\
167 # int aaaa; \\
168 # int b; \\
169 # int dddddddddd;
170
171 # Clang version >= 5.
172 # Rational: Average FG style with minimal diff.
173 #AlignEscapedNewlines: Left
174
175 # Rational: Preservation of formatting.
176 #AlignEscapedNewlines: Left
177
178
179 # **AlignEscapedNewlinesLeft** (``bool``)
180 # If ``true``, aligns escaped newlines as far left as possible. Otherwise puts them into the right-most column.
181
182 # Clang version < 5.
183 # Rational: Average FG style with minimal diff.
184 # Rational: Preservation of formatting.
185 AlignEscapedNewlinesLeft: true
186
187
188 # **AlignOperands** (``bool``)
189 # If ``true``, horizontally align operands of binary and ternary expressions.
190 #
191 # Specifically, this aligns operands of a single expression that needs to be split over multiple lines, e.g.:
192 #
193 # .. parsed-literal::
194 #
195 # int aaa = bbbbbbbbbbbbbbb +
196 # ccccccccccccccc;
197
198 # Rational: Average FG style with minimal diff.
199 #AlignOperands: false
200
201 # Rational: Preservation of formatting.
202 AlignOperands: true
203
204
205 # **AlignTrailingComments** (``bool``)
206 # If ``true``, aligns trailing comments.
207 #
208 # .. parsed-literal::
209 #
210 # true: false:
211 # int a; // My comment a vs. int a; // My comment a
212 # int b = 2; // comment b int b = 2; // comment about b
213
214 # Rational: Average FG style with minimal diff.
215 #AlignTrailingComments: false
216
217 # Rational: Preservation of formatting.
218 AlignTrailingComments: true
219
220
221 # **AllowAllParametersOfDeclarationOnNextLine** (``bool``)
222 # If the function declaration doesn't fit on a line, allow putting all parameters of a function declaration onto the next line even if ``BinPackParameters`` is ``false``.
223 #
224 # .. parsed-literal::
225 #
226 # true:
227 # void myFunction(
228 # int a, int b, int c, int d, int e);
229 #
230 # false:
231 # void myFunction(int a,
232 # int b,
233 # int c,
234 # int d,
235 # int e);
236
237 # Rational: Average FG style with minimal diff.
238 # Rational: Preservation of formatting.
239 AllowAllParametersOfDeclarationOnNextLine: true
240
241
242 # **AllowShortBlocksOnASingleLine** (``bool``)
243 # Allows contracting simple braced statements to a single line.
244 #
245 # E.g., this allows ``if (a) { return; }`` to be put on a single line.
246
247 # Rational: Average FG style with minimal diff.
248 AllowShortBlocksOnASingleLine: true
249
250
251 # **AllowShortCaseLabelsOnASingleLine** (``bool``)
252 # If ``true``, short case labels will be contracted to a single line.
253 #
254 # .. parsed-literal::
255 #
256 # true: false:
257 # switch (a) { vs. switch (a) {
258 # case 1: x = 1; break; case 1:
259 # case 2: return; x = 1;
260 # } break;
261 # case 2:
262 # return;
263 # }
264
265 # Rational: Average FG style with minimal diff.
266 AllowShortCaseLabelsOnASingleLine: true
267
268
269 # **AllowShortFunctionsOnASingleLine** (``ShortFunctionStyle``)
270 # Dependent on the value, ``int f() { return 0; }`` can be put on a single line.
271 #
272 # Possible values:
273 #
274 # * ``SFS_None`` (in configuration: ``None``) Never merge functions into a single line.
275 #
276 # * ``SFS_InlineOnly`` (in configuration: ``InlineOnly``) Only merge functions defined inside a class. Same as "inline", except it does not implies "empty": i.e. top level empty functions are not merged either.
277 #
278 # .. parsed-literal::
279 #
280 # class Foo {
281 # void f() { foo(); }
282 # };
283 # void f() {
284 # foo();
285 # }
286 # void f() {
287 # }
288 #
289 # * ``SFS_Empty`` (in configuration: ``Empty``) Only merge empty functions.
290 #
291 # .. parsed-literal::
292 #
293 # void f() {}
294 # void f2() {
295 # bar2();
296 # }
297 #
298 # * ``SFS_Inline`` (in configuration: ``Inline``) Only merge functions defined inside a class. Implies "empty".
299 #
300 # .. parsed-literal::
301 #
302 # class Foo {
303 # void f() { foo(); }
304 # };
305 # void f() {
306 # foo();
307 # }
308 # void f() {}
309 #
310 # * ``SFS_All`` (in configuration: ``All``) Merge all functions fitting on a single line.
311 #
312 # .. parsed-literal::
313 #
314 # class Foo {
315 # void f() { foo(); }
316 # };
317 # void f() { bar(); }
318
319 # Rational: Average FG style with minimal diff.
320 AllowShortFunctionsOnASingleLine: All
321
322
323 # **AllowShortIfStatementsOnASingleLine** (``bool``)
324 # If ``true``, ``if (a) return;`` can be put on a single line.
325
326 # Rational: Average FG style with minimal diff.
327 AllowShortIfStatementsOnASingleLine: true
328
329
330 # **AllowShortLoopsOnASingleLine** (``bool``)
331 # If ``true``, ``while (true) continue;`` can be put on a single line.
332
333 # Rational: Average FG style with minimal diff.
334 AllowShortLoopsOnASingleLine: true
335
336
337 # **AlwaysBreakAfterReturnType** (``ReturnTypeBreakingStyle``)
338 # The function declaration return type breaking style to use.
339 #
340 # Possible values:
341 #
342 # * ``RTBS_None`` (in configuration: ``None``) Break after return type automatically. ``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
343 #
344 # .. parsed-literal::
345 #
346 # class A {
347 # int f() { return 0; };
348 # };
349 # int f();
350 # int f() { return 1; }
351 #
352 # * ``RTBS_All`` (in configuration: ``All``) Always break after the return type.
353 #
354 # .. parsed-literal::
355 #
356 # class A {
357 # int
358 # f() {
359 # return 0;
360 # };
361 # };
362 # int
363 # f();
364 # int
365 # f() {
366 # return 1;
367 # }
368 #
369 # * ``RTBS_TopLevel`` (in configuration: ``TopLevel``) Always break after the return types of top-level functions.
370 #
371 # .. parsed-literal::
372 #
373 # class A {
374 # int f() { return 0; };
375 # };
376 # int
377 # f();
378 # int
379 # f() {
380 # return 1;
381 # }
382 #
383 # * ``RTBS_AllDefinitions`` (in configuration: ``AllDefinitions``) Always break after the return type of function definitions.
384 #
385 # .. parsed-literal::
386 #
387 # class A {
388 # int
389 # f() {
390 # return 0;
391 # };
392 # };
393 # int f();
394 # int
395 # f() {
396 # return 1;
397 # }
398 #
399 # * ``RTBS_TopLevelDefinitions`` (in configuration: ``TopLevelDefinitions``) Always break after the return type of top-level definitions.
400 #
401 # .. parsed-literal::
402 #
403 # class A {
404 # int f() { return 0; };
405 # };
406 # int f();
407 # int
408 # f() {
409 # return 1;
410 # }
411
412 # Rational: Average FG style with minimal diff.
413 AlwaysBreakAfterReturnType: None
414
415
416 # **AlwaysBreakBeforeMultilineStrings** (``bool``)
417 # If ``true``, always break before multiline string literals.
418 #
419 # This flag is mean to make cases where there are multiple multiline strings in a file look more consistent. Thus, it will only take effect if wrapping the string at that point leads to it being indented ``ContinuationIndentWidth`` spaces from the start of the line.
420 #
421 # .. parsed-literal::
422 #
423 # true: false:
424 # aaaa = vs. aaaa = "bbbb"
425 # "bbbb" "cccc";
426 # "cccc";
427
428 # Rational: Average FG style with minimal diff.
429 AlwaysBreakBeforeMultilineStrings: false
430
431
432 # **AlwaysBreakTemplateDeclarations** (``bool``)
433 # If ``true``, always break after the ``template<...>`` of a template declaration.
434 #
435 # .. parsed-literal::
436 #
437 # true: false:
438 # template <typename T> vs. template <typename T> class C {};
439 # class C {};
440
441 # Rational: Average FG style with minimal diff.
442 AlwaysBreakTemplateDeclarations: false
443
444
445 # **BinPackArguments** (``bool``)
446 # If ``false``, a function call's arguments will either be all on the same line or will have one line each.
447 #
448 # .. parsed-literal::
449 #
450 # true:
451 # void f() {
452 # f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,
453 # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
454 # }
455 #
456 # false:
457 # void f() {
458 # f(aaaaaaaaaaaaaaaaaaaa,
459 # aaaaaaaaaaaaaaaaaaaa,
460 # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
461 # }
462
463 # Rational: Average FG style with minimal diff.
464 BinPackArguments: true
465
466
467 # **BinPackParameters** (``bool``)
468 # If ``false``, a function declaration's or function definition's parameters will either all be on the same line or will have one line each.
469 #
470 # .. parsed-literal::
471 #
472 # true:
473 # void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,
474 # int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
475 #
476 # false:
477 # void f(int aaaaaaaaaaaaaaaaaaaa,
478 # int aaaaaaaaaaaaaaaaaaaa,
479 # int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
480
481 # Rational: Average FG style with minimal diff.
482 BinPackParameters: true
483
484
485 # **BraceWrapping** (``BraceWrappingFlags``)
486 # Control of individual brace wrapping cases.
487 #
488 # If ``BreakBeforeBraces`` is set to ``BS_Custom``, use this to specify how each individual brace case should be handled. Otherwise, this is ignored.
489 #
490 # .. parsed-literal::
491 #
492 # # Example of usage:
493 # BreakBeforeBraces: Custom
494 # BraceWrapping:
495 # AfterEnum: true
496 # AfterStruct: false
497 # SplitEmptyFunction: false
498 #
499 # Nested configuration flags:
500 #
501 # * ``bool AfterClass`` Wrap class definitions.
502 #
503 # .. parsed-literal::
504 #
505 # true:
506 # class foo {};
507 #
508 # false:
509 # class foo
510 # {};
511 #
512 # * ``bool AfterControlStatement`` Wrap control statements (``if``/``for``/``while``/``switch``/..).
513 #
514 # .. parsed-literal::
515 #
516 # true:
517 # if (foo())
518 # {
519 # } else
520 # {}
521 # for (int i = 0; i < 10; ++i)
522 # {}
523 #
524 # false:
525 # if (foo()) {
526 # } else {
527 # }
528 # for (int i = 0; i < 10; ++i) {
529 # }
530 #
531 # * ``bool AfterEnum`` Wrap enum definitions.
532 #
533 # .. parsed-literal::
534 #
535 # true:
536 # enum X : int
537 # {
538 # B
539 # };
540 #
541 # false:
542 # enum X : int { B };
543 #
544 # * ``bool AfterFunction`` Wrap function definitions.
545 #
546 # .. parsed-literal::
547 #
548 # true:
549 # void foo()
550 # {
551 # bar();
552 # bar2();
553 # }
554 #
555 # false:
556 # void foo() {
557 # bar();
558 # bar2();
559 # }
560 #
561 # * ``bool AfterNamespace`` Wrap namespace definitions.
562 #
563 # .. parsed-literal::
564 #
565 # true:
566 # namespace
567 # {
568 # int foo();
569 # int bar();
570 # }
571 #
572 # false:
573 # namespace {
574 # int foo();
575 # int bar();
576 # }
577 #
578 # * ``bool AfterObjCDeclaration`` Wrap ObjC definitions (interfaces, implementations...). @autoreleasepool and @synchronized blocks are wrapped according to *AfterControlStatement* flag.
579 #
580 # * ``bool AfterStruct`` Wrap struct definitions.
581 #
582 # .. parsed-literal::
583 #
584 # true:
585 # struct foo
586 # {
587 # int x;
588 # };
589 #
590 # false:
591 # struct foo {
592 # int x;
593 # };
594 #
595 # * ``bool AfterUnion`` Wrap union definitions.
596 #
597 # .. parsed-literal::
598 #
599 # true:
600 # union foo
601 # {
602 # int x;
603 # }
604 #
605 # false:
606 # union foo {
607 # int x;
608 # }
609 #
610 # * ``bool AfterExternBlock`` Wrap extern blocks.
611 #
612 # .. parsed-literal::
613 #
614 # true:
615 # extern "C"
616 # {
617 # int foo();
618 # }
619 #
620 # false:
621 # extern "C" {
622 # int foo();
623 # }
624 #
625 # * ``bool BeforeCatch`` Wrap before ``catch``.
626 #
627 # .. parsed-literal::
628 #
629 # true:
630 # try {
631 # foo();
632 # }
633 # catch () {
634 # }
635 #
636 # false:
637 # try {
638 # foo();
639 # } catch () {
640 # }
641 #
642 # * ``bool BeforeElse`` Wrap before ``else``.
643 #
644 # .. parsed-literal::
645 #
646 # true:
647 # if (foo()) {
648 # }
649 # else {
650 # }
651 #
652 # false:
653 # if (foo()) {
654 # } else {
655 # }
656 #
657 # * ``bool IndentBraces`` Indent the wrapped braces themselves.
658 #
659 # * ``bool SplitEmptyFunction`` If ``false``, empty function body can be put on a single line. This option is used only if the opening brace of the function has already been wrapped, i.e. the *AfterFunction* brace wrapping mode is set, and the function could/should not be put on a single line (as per *AllowShortFunctionsOnASingleLine* and constructor formatting options).
660 #
661 # .. parsed-literal::
662 #
663 # int f() vs. inf f()
664 # {} {
665 # }
666 #
667 # * ``bool SplitEmptyRecord`` If ``false``, empty record (e.g. class, struct or union) body can be put on a single line. This option is used only if the opening brace of the record has already been wrapped, i.e. the *AfterClass* (for classes) brace wrapping mode is set.
668 #
669 # .. parsed-literal::
670 #
671 # class Foo vs. class Foo
672 # {} {
673 # }
674 #
675 # * ``bool SplitEmptyNamespace`` If ``false``, empty namespace body can be put on a single line. This option is used only if the opening brace of the namespace has already been wrapped, i.e. the *AfterNamespace* brace wrapping mode is set.
676 #
677 # .. parsed-literal::
678 #
679 # namespace Foo vs. namespace Foo
680 # {} {
681 # }
682
683 # Rational: Average FG style with minimal diff.
684 BraceWrapping:
685 AfterClass: true
686 AfterControlStatement: false
687 AfterEnum: false
688 AfterFunction: true
689 AfterNamespace: false
690 AfterStruct: false
691 AfterUnion: false
692 BeforeCatch: false
693 BeforeElse: false
694 IndentBraces: false
695
696 # Clang version >= 6.
697 # AfterExternBlock: false
698 # SplitEmptyFunction: false
699 # SplitEmptyRecord: false
700 # SplitEmptyNamespace: false
701
702
703 # **BreakBeforeBinaryOperators** (``BinaryOperatorStyle``)
704 # The way to wrap binary operators.
705 #
706 # Possible values:
707 #
708 # * ``BOS_None`` (in configuration: ``None``) Break after operators.
709 #
710 # .. parsed-literal::
711 #
712 # LooooooooooongType loooooooooooooooooooooongVariable =
713 # someLooooooooooooooooongFunction();
714 #
715 # bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
716 # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ==
717 # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
718 # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >
719 # ccccccccccccccccccccccccccccccccccccccccc;
720 # * ``BOS_NonAssignment`` (in configuration: ``NonAssignment``) Break before operators that aren't assignments.
721 #
722 # .. parsed-literal::
723 #
724 # LooooooooooongType loooooooooooooooooooooongVariable =
725 # someLooooooooooooooooongFunction();
726 #
727 # bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
728 # + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
729 # == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
730 # && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
731 # > ccccccccccccccccccccccccccccccccccccccccc;
732 # * ``BOS_All`` (in configuration: ``All``) Break before operators.
733 #
734 # .. parsed-literal::
735 #
736 # LooooooooooongType loooooooooooooooooooooongVariable
737 # = someLooooooooooooooooongFunction();
738 #
739 # bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
740 # + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
741 # == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
742 # && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
743 # > ccccccccccccccccccccccccccccccccccccccccc;
744
745 # Rational: Average FG style with minimal diff.
746 BreakBeforeBinaryOperators: None
747
748
749 # **BreakBeforeBraces** (``BraceBreakingStyle``)
750 # The brace breaking style to use.
751 #
752 # Possible values:
753 #
754 # * ``BS_Attach`` (in configuration: ``Attach``) Always attach braces to surrounding context.
755 #
756 # .. parsed-literal::
757 #
758 # try {
759 # foo();
760 # } catch () {
761 # }
762 # void foo() { bar(); }
763 # class foo {};
764 # if (foo()) {
765 # } else {
766 # }
767 # enum X : int { A, B };
768 #
769 # * ``BS_Linux`` (in configuration: ``Linux``) Like ``Attach``, but break before braces on function, namespace and class definitions.
770 #
771 # .. parsed-literal::
772 #
773 # try {
774 # foo();
775 # } catch () {
776 # }
777 # void foo() { bar(); }
778 # class foo
779 # {
780 # };
781 # if (foo()) {
782 # } else {
783 # }
784 # enum X : int { A, B };
785 #
786 # * ``BS_Mozilla`` (in configuration: ``Mozilla``) Like ``Attach``, but break before braces on enum, function, and record definitions.
787 #
788 # .. parsed-literal::
789 #
790 # try {
791 # foo();
792 # } catch () {
793 # }
794 # void foo() { bar(); }
795 # class foo
796 # {
797 # };
798 # if (foo()) {
799 # } else {
800 # }
801 # enum X : int { A, B };
802 #
803 # * ``BS_Stroustrup`` (in configuration: ``Stroustrup``) Like ``Attach``, but break before function definitions, ``catch``, and ``else``.
804 #
805 # .. parsed-literal::
806 #
807 # try {
808 # foo();
809 # } catch () {
810 # }
811 # void foo() { bar(); }
812 # class foo
813 # {
814 # };
815 # if (foo()) {
816 # } else {
817 # }
818 # enum X : int
819 # {
820 # A,
821 # B
822 # };
823 #
824 # * ``BS_Allman`` (in configuration: ``Allman``) Always break before braces.
825 #
826 # .. parsed-literal::
827 #
828 # try {
829 # foo();
830 # }
831 # catch () {
832 # }
833 # void foo() { bar(); }
834 # class foo {
835 # };
836 # if (foo()) {
837 # }
838 # else {
839 # }
840 # enum X : int { A, B };
841 #
842 # * ``BS_GNU`` (in configuration: ``GNU``) Always break before braces and add an extra level of indentation to braces of control statements, not to those of class, function or other definitions.
843 #
844 # .. parsed-literal::
845 #
846 # try
847 # {
848 # foo();
849 # }
850 # catch ()
851 # {
852 # }
853 # void foo() { bar(); }
854 # class foo
855 # {
856 # };
857 # if (foo())
858 # {
859 # }
860 # else
861 # {
862 # }
863 # enum X : int
864 # {
865 # A,
866 # B
867 # };
868 #
869 # * ``BS_WebKit`` (in configuration: ``WebKit``) Like ``Attach``, but break before functions.
870 #
871 # .. parsed-literal::
872 #
873 # try {
874 # foo();
875 # } catch () {
876 # }
877 # void foo() { bar(); }
878 # class foo {
879 # };
880 # if (foo()) {
881 # } else {
882 # }
883 # enum X : int { A, B };
884 #
885 # * ``BS_Custom`` (in configuration: ``Custom``) Configure each individual brace in *BraceWrapping*.
886
887 # Rational: Average FG style with minimal diff.
888 BreakBeforeBraces: Custom
889
890
891 # **BreakBeforeInheritanceComma** (``bool``)
892 # If ``true``, in the class inheritance expression clang-format will break before ``:`` and ``,`` if there is multiple inheritance.
893 #
894 # .. parsed-literal::
895 #
896 # true: false:
897 # class MyClass vs. class MyClass : public X, public Y {
898 # : public X };
899 # , public Y {
900 # };
901
902 # Clang version >= 5.
903 #BreakBeforeInheritanceComma: false
904
905
906 # **BreakBeforeTernaryOperators** (``bool``)
907 # If ``true``, ternary operators will be placed after line breaks.
908 #
909 # .. parsed-literal::
910 #
911 # true:
912 # veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
913 # ? firstValue
914 # : SecondValueVeryVeryVeryVeryLong;
915 #
916 # false:
917 # veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?
918 # firstValue :
919 # SecondValueVeryVeryVeryVeryLong;
920
921 # Rational: Average FG style with minimal diff.
922 BreakBeforeTernaryOperators: true
923
924
925 # **BreakConstructorInitializers** (``BreakConstructorInitializersStyle``)
926 # The constructor initializers style to use.
927 #
928 # Possible values:
929 #
930 # * ``BCIS_BeforeColon`` (in configuration: ``BeforeColon``) Break constructor initializers before the colon and after the commas.
931 #
932 # Constructor()
933 # : initializer1(),
934 # initializer2()
935 #
936 # * ``BCIS_BeforeComma`` (in configuration: ``BeforeComma``) Break constructor initializers before the colon and commas, and align the commas with the colon.
937 #
938 # Constructor()
939 # : initializer1() , initializer2()
940 #
941 # * ``BCIS_AfterColon`` (in configuration: ``AfterColon``) Break constructor initializers after the colon and commas.
942 #
943 # Constructor() :
944 # initializer1(), initializer2()
945
946 # Clang version >= 5.
947 # Rational: Average FG style with minimal diff.
948 #BreakConstructorInitializers: None
949
950
951 # **BreakConstructorInitializersBeforeComma** (``bool``)
952 # Always break constructor initializers before commas and align the commas with the colon.
953
954 # Clang version < 5.
955 # Rational: Average FG style with minimal diff.
956 BreakConstructorInitializersBeforeComma: false
957
958
959 # **BreakStringLiterals** (``bool``)
960 # Allow breaking string literals when formatting.
961
962 # Rational: Average FG style with minimal diff.
963 BreakStringLiterals: false
964
965
966 # **ColumnLimit** (``unsigned``)
967 # The column limit.
968 #
969 # A column limit of ``0`` means that there is no column limit. In this case, clang-format will respect the input's line breaking decisions within statements unless they contradict other rules.
970
971 # Rational: Average FG style with minimal diff.
972 ColumnLimit: 0
973
974
975 # **CommentPragmas** (``std::string``)
976 # A regular expression that describes comments with special meaning, which should not be split into lines or otherwise changed.
977 #
978 # .. parsed-literal::
979 #
980 # // CommentPragmas: '^ FOOBAR pragma:'
981 # // Will leave the following line unaffected
982 # #include <vector> // FOOBAR pragma: keep
983
984 # Rational: Average FG style with minimal diff.
985 CommentPragmas: None
986
987
988 # **CompactNamespaces** (``bool``)
989 # If ``true``, consecutive namespace declarations will be on the same line. If ``false``, each namespace is declared on a new line.
990 #
991 # .. parsed-literal::
992 #
993 # true:
994 # namespace Foo { namespace Bar {
995 # }}
996 #
997 # false:
998 # namespace Foo {
999 # namespace Bar {
1000 # }
1001 # }
1002 #
1003 # If it does not fit on a single line, the overflowing namespaces get wrapped:
1004 #
1005 # .. parsed-literal::
1006 #
1007 # namespace Foo { namespace Bar {
1008 # namespace Extra {
1009 # }}}
1010
1011 # Clang version >= 5.
1012 # Rational: Average FG style with minimal diff.
1013 #CompactNamespaces: false
1014
1015
1016 # **ConstructorInitializerAllOnOneLineOrOnePerLine** (``bool``)
1017 # If the constructor initializers don't fit on a line, put each initializer on its own line.
1018 #
1019 # .. parsed-literal::
1020 #
1021 # true:
1022 # SomeClass\:\:Constructor()
1023 # : aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) {
1024 # return 0;
1025 # }
1026 #
1027 # false:
1028 # SomeClass\:\:Constructor()
1029 # : aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaa),
1030 # aaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) {
1031 # return 0;
1032 # }
1033
1034 # Rational: Average FG style with minimal diff.
1035 ConstructorInitializerAllOnOneLineOrOnePerLine: false
1036
1037
1038 # **ConstructorInitializerIndentWidth** (``unsigned``)
1039 # The number of characters to use for indentation of constructor initializer lists.
1040
1041 # Rational: Preservation of formatting.
1042 ConstructorInitializerIndentWidth: 4
1043
1044
1045 # **ContinuationIndentWidth** (``unsigned``)
1046 # Indent width for line continuations.
1047 #
1048 # .. parsed-literal::
1049 #
1050 # ContinuationIndentWidth: 2
1051 #
1052 # int i = // VeryVeryVeryVeryVeryLongComment
1053 # longFunction( // Again a long comment
1054 # arg);
1055
1056 # Rational: Average FG style with minimal diff.
1057 ContinuationIndentWidth: 4
1058
1059
1060 # **Cpp11BracedListStyle** (``bool``)
1061 # If ``true``, format braced lists as best suited for C++11 braced lists.
1062 #
1063 # Important differences: - No spaces inside the braced list. - No line break before the closing brace. - Indentation with the continuation indent, not with the block indent.
1064 #
1065 # Fundamentally, C++11 braced lists are formatted exactly like function calls would be formatted in their place. If the braced list follows a name (e.g. a type or variable name), clang-format formats as if the ``{}`` were the parentheses of a function call with that name. If there is no name, a zero-length name is assumed.
1066 #
1067 # .. parsed-literal::
1068 #
1069 # true: false:
1070 # vector<int> x{1, 2, 3, 4}; vs. vector<int> x{ 1, 2, 3, 4 };
1071 # vector<T> x{{}, {}, {}, {}}; vector<T> x{ {}, {}, {}, {} };
1072 # f(MyMap[{composite, key}]); f(MyMap[{ composite, key }]);
1073 # new int[3]{1, 2, 3}; new int[3]{ 1, 2, 3 };
1074
1075 # Rational: Switch to the C++11 braced lists format.
1076 Cpp11BracedListStyle: true
1077
1078
1079 # **DerivePointerAlignment** (``bool``)
1080 # If ``true``, analyze the formatted file for the most common alignment of ``&`` and ``*``. Pointer and reference alignment styles are going to be updated according to the preferences found in the file. ``PointerAlignment`` is then used only as fallback.
1081
1082 # Rational: Do not override PointerAlignment!
1083 DerivePointerAlignment: false
1084
1085
1086 # **DisableFormat** (``bool``)
1087 # Disables formatting completely.
1088
1089 # Rational: N/A.
1090 DisableFormat: false
1091
1092
1093 # **ExperimentalAutoDetectBinPacking** (``bool``)
1094 # If ``true``, clang-format detects whether function calls and definitions are formatted with one parameter per line.
1095 #
1096 # Each call can be bin-packed, one-per-line or inconclusive. If it is inconclusive, e.g. completely on one line, but a decision needs to be made, clang-format analyzes whether there are other bin-packed cases in the input file and act accordingly.
1097 #
1098 # NOTE: This is an experimental flag, that might go away or be renamed. Do not use this in config files, etc. Use at your own risk.
1099
1100 # Rational: N/A.
1101 #ExperimentalAutoDetectBinPacking: false
1102
1103
1104 # **FixNamespaceComments** (``bool``)
1105 # If ``true``, clang-format adds missing namespace end comments and fixes invalid existing ones.
1106 #
1107 # .. parsed-literal::
1108 #
1109 # true: false:
1110 # namespace a { vs. namespace a {
1111 # foo(); foo();
1112 # } // namespace a; }
1113
1114 # Clang version >= 5.
1115 # Rational: This should be set to ``true`` when possible.
1116 #FixNamespaceComments: true
1117
1118
1119 # **ForEachMacros** (``std::vector<std::string>``)
1120 # A vector of macros that should be interpreted as foreach loops instead of as function calls.
1121 #
1122 # These are expected to be macros of the form:
1123 #
1124 # .. parsed-literal::
1125 #
1126 # FOREACH(<variable-declaration>, ...)
1127 # <loop-body>
1128 #
1129 # In the .clang-format configuration file, this can be configured like:
1130 #
1131 # .. parsed-literal::
1132 #
1133 # ForEachMacros: \['RANGES_FOR', 'FOREACH']
1134 #
1135 # For example: BOOST_FOREACH.
1136
1137 # Rational: Average FG style with minimal diff.
1138 ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
1139
1140
1141 # **IncludeBlocks** (``IncludeBlocksStyle``)
1142 # Dependent on the value, multiple ``#include`` blocks can be sorted as one and divided based on category.
1143 #
1144 # Possible values:
1145 #
1146 # * ``IBS_Preserve`` (in configuration: ``Preserve``) Sort each ``#include`` block separately.
1147 #
1148 # .. parsed-literal::
1149 #
1150 # #include "b.h" into #include "b.h"
1151 #
1152 # #include <lib/main.h> #include "a.h"
1153 # #include "a.h" #include <lib/main.h>
1154 #
1155 # * ``IBS_Merge`` (in configuration: ``Merge``) Merge multiple ``#include`` blocks together and sort as one.
1156 #
1157 # .. parsed-literal::
1158 #
1159 # #include "b.h" into #include "a.h"
1160 # #include "b.h"
1161 # #include <lib/main.h> #include <lib/main.h>
1162 # #include "a.h"
1163 #
1164 # * ``IBS_Regroup`` (in configuration: ``Regroup``) Merge multiple ``#include`` blocks together and sort as one. Then split into groups based on category priority. See ``IncludeCategories``.
1165 #
1166 # .. parsed-literal::
1167 #
1168 # #include "b.h" into #include "a.h"
1169 # #include "b.h"
1170 # #include <lib/main.h>
1171 # #include "a.h" #include <lib/main.h>
1172
1173 # Clang version >= 6.
1174 # Rational: Formatting clean up.
1175 #IncludeBlocks: Regroup
1176
1177
1178 # **IncludeCategories** (``std::vector<IncludeCategory>``)
1179 # Regular expressions denoting the different ``#include`` categories used for ordering ``#includes``.
1180 #
1181 # These regular expressions are matched against the filename of an include (including the <> or "") in order. The value belonging to the first matching regular expression is assigned and ``#includes`` are sorted first according to increasing category number and then alphabetically within each category.
1182 #
1183 # If none of the regular expressions match, INT_MAX is assigned as category. The main header for a source file automatically gets category 0. so that it is generally kept at the beginning of the ``#includes`` (http://llvm.org/docs/CodingStandards.html#include-style). However, you can also assign negative priorities if you have certain headers that always need to be first.
1184 #
1185 # To configure this in the .clang-format file, use:
1186 #
1187 # .. parsed-literal::
1188 #
1189 # IncludeCategories:
1190 # - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
1191 # Priority: 2
1192 # - Regex: '^(<|"(gtest|gmock|isl|json)/)'
1193 # Priority: 3
1194 # - Regex: '.*'
1195 # Priority: 1
1196
1197 # Rational: Left on the default LLVM values.
1198 IncludeCategories:
1199 - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
1200 Priority: 2
1201 - Regex: '^(<|"(gtest|isl|json)/)'
1202 Priority: 3
1203 - Regex: '.*'
1204 Priority: 1
1205
1206
1207 # **IncludeIsMainRegex** (``std::string``)
1208 # Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping.
1209 #
1210 # When guessing whether a #include is the "main" include (to assign category 0, see above), use this regex of allowed suffixes to the header stem. A partial match is done, so that: - "" means "arbitrary suffix" - "$" means "no suffix"
1211 #
1212 # For example, if configured to "(_test)?$", then a header a.h would be seen as the "main" include in both a.cc and a_test.cc.
1213
1214 # Rational: Average FG style with minimal diff.
1215 IncludeIsMainRegex: '$'
1216
1217
1218 # **IndentCaseLabels** (``bool``)
1219 # Indent case labels one level from the switch statement.
1220 #
1221 # When ``false``, use the same indentation level as for the switch statement. Switch statement body is always indented one level more than case labels.
1222 #
1223 # .. parsed-literal::
1224 #
1225 # false: true:
1226 # switch (fool) { vs. switch (fool) {
1227 # case 1: case 1:
1228 # bar(); bar();
1229 # break; break;
1230 # default: default:
1231 # plop(); plop();
1232 # } }
1233
1234 # Rational: Average FG style with minimal diff.
1235 IndentCaseLabels: false
1236
1237
1238 # **IndentPPDirectives** (``PPDirectiveIndentStyle``)
1239 # The preprocessor directive indenting style to use.
1240 #
1241 # Possible values:
1242 #
1243 # * ``PPDIS_None`` (in configuration: ``None``) Does not indent any directives.
1244 #
1245 # .. parsed-literal::
1246 #
1247 # #if FOO
1248 # #if BAR
1249 # #include <foo>
1250 # #endif
1251 # #endif
1252 #
1253 # * ``PPDIS_AfterHash`` (in configuration: ``AfterHash``) Indents directives after the hash.
1254 #
1255 # .. parsed-literal::
1256 #
1257 # #if FOO
1258 # # if BAR
1259 # # include <foo>
1260 # # endif
1261 # #endif
1262
1263 # Clang version >= 6.
1264 # Rational: Average FG style with minimal diff.
1265 #IndentPPDirectives: AfterHash
1266
1267
1268 # **IndentWidth** (``unsigned``)
1269 # The number of columns to use for indentation.
1270 #
1271 # .. parsed-literal::
1272 #
1273 # IndentWidth: 3
1274 #
1275 # void f() {
1276 # someFunction();
1277 # if (true, false) {
1278 # f();
1279 # }
1280 # }
1281
1282 # Rational: Average FG style with minimal diff.
1283 IndentWidth: 4
1284
1285
1286 # **IndentWrappedFunctionNames** (``bool``)
1287 # Indent if a function definition or declaration is wrapped after the type.
1288 #
1289 # .. parsed-literal::
1290 #
1291 # true:
1292 # LoooooooooooooooooooooooooooooooooooooooongReturnType
1293 # LoooooooooooooooooooooooooooooooongFunctionDeclaration();
1294 #
1295 # false:
1296 # LoooooooooooooooooooooooooooooooooooooooongReturnType
1297 # LoooooooooooooooooooooooooooooooongFunctionDeclaration();
1298
1299 # Rational: Average FG style with minimal diff.
1300 IndentWrappedFunctionNames: false
1301
1302
1303 # **KeepEmptyLinesAtTheStartOfBlocks** (``bool``)
1304 # If true, the empty line at the start of blocks is kept.
1305 #
1306 # .. parsed-literal::
1307 #
1308 # true: false:
1309 # if (foo) { vs. if (foo) {
1310 # bar();
1311 # bar(); }
1312 # }
1313
1314 # Rational: Average FG style with minimal diff.
1315 KeepEmptyLinesAtTheStartOfBlocks: false
1316
1317
1318 # **MacroBlockBegin** (``std::string``)
1319 # A regular expression matching macros that start a block.
1320 #
1321 # .. parsed-literal::
1322 #
1323 # # With:
1324 # MacroBlockBegin: "^NS_MAP_BEGIN|\\
1325 # NS_TABLE_HEAD$"
1326 # MacroBlockEnd: "^\\
1327 # NS_MAP_END|\\
1328 # NS_TABLE\_.*_END$"
1329 #
1330 # NS_MAP_BEGIN
1331 # foo();
1332 # NS_MAP_END
1333 #
1334 # NS_TABLE_HEAD
1335 # bar();
1336 # NS_TABLE_FOO_END
1337 #
1338 # # Without:
1339 # NS_MAP_BEGIN
1340 # foo();
1341 # NS_MAP_END
1342 #
1343 # NS_TABLE_HEAD
1344 # bar();
1345 # NS_TABLE_FOO_END
1346
1347 # Rational: Average FG style with minimal diff.
1348 MacroBlockBegin: ''
1349
1350
1351 # **MacroBlockEnd** (``std::string``)
1352 # A regular expression matching macros that end a block.
1353
1354 # Rational: Average FG style with minimal diff.
1355 MacroBlockEnd: ''
1356
1357
1358 # **MaxEmptyLinesToKeep** (``unsigned``)
1359 # The maximum number of consecutive empty lines to keep.
1360 #
1361 # .. parsed-literal::
1362 #
1363 # MaxEmptyLinesToKeep: 1 vs. MaxEmptyLinesToKeep: 0
1364 # int f() { int f() {
1365 # int = 1; int i = 1;
1366 # i = foo();
1367 # i = foo(); return i;
1368 # }
1369 # return i;
1370 # }
1371
1372 # Rational: Avoid 3 or more empty lines.
1373 MaxEmptyLinesToKeep: 2
1374
1375
1376 # **NamespaceIndentation** (``NamespaceIndentationKind``)
1377 # The indentation used for namespaces.
1378 #
1379 # Possible values:
1380 #
1381 # * ``NI_None`` (in configuration: ``None``) Don't indent in namespaces.
1382 #
1383 # .. parsed-literal::
1384 #
1385 # namespace out {
1386 # int i;
1387 # namespace in {
1388 # int i;
1389 # }
1390 # }
1391 #
1392 # * ``NI_Inner`` (in configuration: ``Inner``) Indent only in inner namespaces (nested in other namespaces).
1393 #
1394 # .. parsed-literal::
1395 #
1396 # namespace out {
1397 # int i;
1398 # namespace in {
1399 # int i;
1400 # }
1401 # }
1402 #
1403 # * ``NI_All`` (in configuration: ``All``) Indent in all namespaces.
1404 #
1405 # .. parsed-literal::
1406 #
1407 # namespace out {
1408 # int i;
1409 # namespace in {
1410 # int i;
1411 # }
1412 # }
1413 #
1414
1415 # Rational: Average FG style with minimal diff.
1416 NamespaceIndentation: None
1417
1418
1419 # **PenaltyBreakAssignment** (``unsigned``)
1420 # The penalty for breaking around an assignment operator.
1421
1422 # Clang version >= 5.
1423 #PenaltyBreakAssignment:
1424
1425
1426 # **PenaltyBreakBeforeFirstCallParameter** (``unsigned``)
1427 # The penalty for breaking a function call after ``call(``.
1428
1429 # Rational: Left to default.
1430 PenaltyBreakBeforeFirstCallParameter: 19
1431
1432
1433 # **PenaltyBreakComment** (``unsigned``)
1434 # The penalty for each line break introduced inside a comment.
1435
1436 # Rational: Left to default.
1437 PenaltyBreakComment: 300
1438
1439
1440 # **PenaltyBreakFirstLessLess** (``unsigned``)
1441 # The penalty for breaking before the first ``<<``.
1442
1443 # Rational: Left to default.
1444 PenaltyBreakFirstLessLess: 120
1445
1446
1447 # **PenaltyBreakString** (``unsigned``)
1448 # The penalty for each line break introduced inside a string literal.
1449
1450 # Rational: Left to default.
1451 PenaltyBreakString: 1000
1452
1453
1454 # **PenaltyExcessCharacter** (``unsigned``)
1455 # The penalty for each character outside of the column limit.
1456
1457 # Rational: Left to default.
1458 PenaltyExcessCharacter: 1000000
1459
1460
1461 # **PenaltyReturnTypeOnItsOwnLine** (``unsigned``)
1462 # Penalty for putting the return type of a function onto its own line.
1463
1464 # Rational: Left to default.
1465 PenaltyReturnTypeOnItsOwnLine: 60
1466
1467
1468 # **PointerAlignment** (``PointerAlignmentStyle``)
1469 # Pointer and reference alignment style.
1470 #
1471 # Possible values:
1472 #
1473 # * ``PAS_Left`` (in configuration: ``Left``) Align pointer to the left.
1474 #
1475 # .. parsed-literal::
1476 #
1477 # int* a;
1478 #
1479 # * ``PAS_Right`` (in configuration: ``Right``) Align pointer to the right.
1480 #
1481 # .. parsed-literal::
1482 #
1483 # int \*a;
1484 #
1485 # * ``PAS_Middle`` (in configuration: ``Middle``) Align pointer in the middle.
1486 #
1487 # .. parsed-literal::
1488 #
1489 # int * a;
1490
1491 # Rational: Average FG style with minimal diff.
1492 PointerAlignment: Left
1493
1494
1495 # **RawStringFormats** (``std::vector<RawStringFormat>``)
1496 # Defines hints for detecting supported languages code blocks in raw strings.
1497 #
1498 # A raw string with a matching delimiter or a matching enclosing function name will be reformatted assuming the specified language based on the style for that language defined in the .clang-format file. If no style has been defined in the .clang-format file for the specific language, a predefined style given by 'BasedOnStyle' is used. If 'BasedOnStyle' is not found, the formatting is based on llvm style. A matching delimiter takes precedence over a matching enclosing function name for determining the language of the raw string contents.
1499 #
1500 # If a canonical delimiter is specified, occurrences of other delimiters for the same language will be updated to the canonical if possible.
1501 #
1502 # There should be at most one specification per language and each delimiter and enclosing function should not occur in multiple specifications.
1503 #
1504 # To configure this in the .clang-format file, use:
1505 #
1506 # .. parsed-literal::
1507 #
1508 # RawStringFormats:
1509 # - Language: TextProto
1510 # Delimiters:
1511 # - 'pb'
1512 # - 'proto'
1513 # EnclosingFunctions:
1514 # - 'PARSE_TEXT_PROTO'
1515 # BasedOnStyle: google
1516 # - Language: Cpp
1517 # Delimiters:
1518 # - 'cc'
1519 # - 'cpp'
1520 # BasedOnStyle: llvm
1521 # CanonicalDelimiter: 'cc'
1522
1523 # Clang version >= 6.
1524 #RawStringFormats:
1525
1526
1527 # **ReflowComments** (``bool``)
1528 # If ``true``, clang-format will attempt to re-flow comments.
1529 #
1530 # .. parsed-literal::
1531 #
1532 # false:
1533 # // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
1534 # /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information \*/
1535 #
1536 # true:
1537 # // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
1538 # // information
1539 # /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
1540 # * information \*/
1541
1542 # Rational: Seems to require ColumnLimit to be set.
1543 ReflowComments: false
1544
1545
1546 # **SortIncludes** (``bool``)
1547 # If ``true``, clang-format will sort ``#includes``.
1548 #
1549 # .. parsed-literal::
1550 #
1551 # false: true:
1552 # #include "b.h" vs. #include "a.h"
1553 # #include "a.h" #include "b.h"
1554
1555 # Rational: Formatting clean up.
1556 SortIncludes: true
1557
1558
1559 # **SortUsingDeclarations** (``bool``)
1560 # If ``true``, clang-format will sort using declarations.
1561 #
1562 # The order of using declarations is defined as follows: Split the strings by "\:\:" and discard any initial empty strings. The last element of each list is a non-namespace name; all others are namespace names. Sort the lists of names lexicographically, where the sort order of individual names is that all non-namespace names come before all namespace names, and within those groups, names are in case-insensitive lexicographic order.
1563 #
1564 # .. parsed-literal::
1565 #
1566 # false: true:
1567 # using std::cout; vs. using std::cin;
1568 # using std::cin; using std::cout;
1569
1570 # Clang version >= 5.
1571 # Rational: Formatting clean up.
1572 #SortUsingDeclarations: true
1573
1574
1575 # **SpaceAfterCStyleCast** (``bool``)
1576 # If ``true``, a space is inserted after C style casts.
1577 #
1578 # .. parsed-literal::
1579 #
1580 # true: false:
1581 # (int) i; vs. (int)i;
1582
1583 # Rational: Average FG style with minimal diff.
1584 SpaceAfterCStyleCast: false
1585
1586
1587 # **SpaceAfterTemplateKeyword** (``bool``)
1588 # If ``true``, a space will be inserted after the 'template' keyword.
1589 #
1590 # .. parsed-literal::
1591 #
1592 # true: false:
1593 # template <int> void foo(); vs. template<int> void foo();
1594
1595 # Clang version >= 4.
1596 # Rational: Average FG style with minimal diff.
1597 #SpaceAfterTemplateKeyword: true
1598
1599
1600 # **SpaceBeforeAssignmentOperators** (``bool``)
1601 # If ``false``, spaces will be removed before assignment operators.
1602 #
1603 # .. parsed-literal::
1604 #
1605 # true: false:
1606 # int a = 5; vs. int a=5;
1607 # a += 42 a+=42;
1608
1609 # Rational: Average FG style with minimal diff.
1610 SpaceBeforeAssignmentOperators: true
1611
1612
1613 # **SpaceBeforeCtorInitializerColon** (``bool``)
1614 # If ``false``, spaces will be removed before constructor initializer colon.
1615 #
1616 # .. parsed-literal::
1617 #
1618 # true: false:
1619 # Foo::Foo() : a(a) {} Foo::Foo(): a(a) {}
1620
1621 # Clang version >= 7.
1622 # Rational: Average FG style with minimal diff.
1623 #SpaceBeforeCtorInitializerColon: true
1624
1625
1626 # **SpaceBeforeInheritanceColon** (``bool``)
1627 # If ``false``, spaces will be removed before inheritance colon.
1628 #
1629 # .. parsed-literal::
1630 #
1631 # true: false:
1632 # class Foo : Bar {} vs. class Foo: Bar {}
1633
1634 # Clang version >= 7.
1635 # Rational: Average FG style with minimal diff.
1636 #SpaceBeforeInheritanceColon: true
1637
1638
1639 # **SpaceBeforeParens** (``SpaceBeforeParensOptions``)
1640 # Defines in which cases to put a space before opening parentheses.
1641 #
1642 # Possible values:
1643 #
1644 # * ``SBPO_Never`` (in configuration: ``Never``) Never put a space before opening parentheses.
1645 #
1646 # .. parsed-literal::
1647 #
1648 # void f() {
1649 # if(true) {
1650 # f();
1651 # }
1652 # }
1653 #
1654 # * ``SBPO_ControlStatements`` (in configuration: ``ControlStatements``) Put a space before opening parentheses only after control statement keywords (``for/if/while...``).
1655 #
1656 # .. parsed-literal::
1657 #
1658 # void f() {
1659 # if (true) {
1660 # f();
1661 # }
1662 # }
1663 #
1664 # * ``SBPO_Always`` (in configuration: ``Always``) Always put a space before opening parentheses, except when it's prohibited by the syntax rules (in function-like macro definitions) or when determined by other style rules (after unary operators, opening parentheses, etc.)
1665 #
1666 # .. parsed-literal::
1667 #
1668 # void f () {
1669 # if (true) {
1670 # f ();
1671 # }
1672 # }
1673 #
1674
1675 # Rational: Average FG style with minimal diff.
1676 SpaceBeforeParens: ControlStatements
1677
1678
1679 # **SpaceBeforeRangeBasedForLoopColon** (``bool``)
1680 # If ``false``, spaces will be removed before range-based for loop colon.
1681 #
1682 # .. parsed-literal::
1683 #
1684 # true: false:
1685 # for (auto v : values) {} vs. for(auto v: values) {}
1686
1687 # Clang version >= 7.
1688 # Rational: Average FG style with minimal diff.
1689 #SpaceBeforeRangeBasedForLoopColon: true
1690
1691
1692 # **SpaceInEmptyParentheses** (``bool``)
1693 # If ``true``, spaces may be inserted into ``()``.
1694 #
1695 # .. parsed-literal::
1696 #
1697 # true: false:
1698 # void f( ) { vs. void f() {
1699 # int x[] = {foo( ), bar( )}; int x[] = {foo(), bar()};
1700 # if (true) { if (true) {
1701 # f( ); f();
1702 # } }
1703 # } }
1704
1705 # Rational: Average FG style with minimal diff.
1706 SpaceInEmptyParentheses: false
1707
1708
1709 # **SpacesBeforeTrailingComments** (``unsigned``)
1710 # The number of spaces before trailing line comments (``//`` - comments).
1711 #
1712 # This does not affect trailing block comments (``/*`` - comments) as those commonly have different usage patterns and a number of special cases.
1713 #
1714 # .. parsed-literal::
1715 #
1716 # SpacesBeforeTrailingComments: 3
1717 # void f() {
1718 # if (true) { // foo1
1719 # f(); // bar
1720 # } // foo
1721 # }
1722
1723 # Rational: Average FG style with minimal diff.
1724 SpacesBeforeTrailingComments: 1
1725
1726
1727 # **SpacesInAngles** (``bool``)
1728 # If ``true``, spaces will be inserted after ``<`` and before ``>`` in template argument lists.
1729 #
1730 # .. parsed-literal::
1731 #
1732 # true: false:
1733 # static_cast< int >(arg); vs. static_cast<int>(arg);
1734 # std\:\:function< void(int) > fct; std\:\:function<void(int)> fct;
1735
1736 # Rational: Average FG style with minimal diff.
1737 SpacesInAngles: false
1738
1739
1740 # **SpacesInContainerLiterals** (``bool``)
1741 # If ``true``, spaces are inserted inside container literals (e.g. ObjC and Javascript array and dict literals).
1742 #
1743 # .. parsed-literal::
1744 #
1745 # true: false:
1746 # var arr = [ 1, 2, 3 ]; vs. var arr = [1, 2, 3];
1747 # f({a : 1, b : 2, c : 3}); f({a: 1, b: 2, c: 3});
1748
1749 # Rational: Average FG style with minimal diff.
1750 SpacesInContainerLiterals: false
1751
1752
1753 # **SpacesInCStyleCastParentheses** (``bool``)
1754 # If ``true``, spaces may be inserted into C style casts.
1755 #
1756 # .. parsed-literal::
1757 #
1758 # true: false:
1759 # x = ( int32 )y vs. x = (int32)y
1760
1761 # Rational: Average FG style with minimal diff.
1762 SpacesInCStyleCastParentheses: false
1763
1764
1765 # **SpacesInParentheses** (``bool``)
1766 # If ``true``, spaces will be inserted after ``(`` and before ``)``.
1767 #
1768 # .. parsed-literal::
1769 #
1770 # true: false:
1771 # t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete;
1772
1773 # Rational: Average FG style with minimal diff.
1774 SpacesInParentheses: false
1775
1776
1777 # **SpacesInSquareBrackets** (``bool``)
1778 # If ``true``, spaces will be inserted after ``[`` and before ``]``. Lambdas or unspecified size array declarations will not be affected.
1779 #
1780 # .. parsed-literal::
1781 #
1782 # true: false:
1783 # int a[ 5 ]; vs. int a[5];
1784 # std::unique_ptr<int[]> foo() {} // Won't be affected
1785
1786 # Rational: Average FG style with minimal diff.
1787 SpacesInSquareBrackets: false
1788
1789
1790
1791 # **Standard** (``LanguageStandard``)
1792 # Format compatible with this standard, e.g. use ``A<A<int> >`` instead of ``A<A<int>>`` for ``LS_Cpp03``.
1793 #
1794 # Possible values:
1795 #
1796 # * ``LS_Cpp03`` (in configuration: ``Cpp03``) Use C++03-compatible syntax.
1797 # * ``LS_Cpp11`` (in configuration: ``Cpp11``) Use features of C++11, C++14 and C++1z (e.g. ``A<A<int>>`` instead of ``A<A<int> >``).
1798 # * ``LS_Auto`` (in configuration: ``Auto``) Automatic detection based on the input.
1799
1800 # Rational: FlightGear currently uses the C++11 standard.
1801 Standard: Cpp11
1802
1803
1804 # **TabWidth** (``unsigned``)
1805 # The number of columns used for tab stops.
1806
1807 # Rational: Average FG style with minimal diff.
1808 TabWidth: 4
1809
1810
1811 # **UseTab** (``UseTabStyle``)
1812 # The way to use tab characters in the resulting file.
1813 #
1814 # Possible values:
1815 #
1816 # * ``UT_Never`` (in configuration: ``Never``) Never use tab.
1817 # * ``UT_ForIndentation`` (in configuration: ``ForIndentation``) Use tabs only for indentation.
1818 # * ``UT_ForContinuationAndIndentation`` (in configuration: ``ForContinuationAndIndentation``) Use tabs only for line continuation and indentation.
1819 # * ``UT_Always`` (in configuration: ``Always``) Use tabs whenever we need to fill whitespace that spans at least from one tab stop to the next one.
1820
1821 # Rational: Don't use "\t".
1822 UseTab: Never
1823
1824
1825 ...
1826
1827 Language: ObjC
1828