clang  14.0.0git
Format.h
Go to the documentation of this file.
1 //===--- Format.h - Format C++ code -----------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// Various functions to configurably format source code.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_FORMAT_FORMAT_H
15 #define LLVM_CLANG_FORMAT_FORMAT_H
16 
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/Support/Regex.h"
22 #include "llvm/Support/SourceMgr.h"
23 #include <system_error>
24 
25 namespace llvm {
26 namespace vfs {
27 class FileSystem;
28 }
29 } // namespace llvm
30 
31 namespace clang {
32 namespace format {
33 
34 enum class ParseError {
35  Success = 0,
36  Error,
37  Unsuitable,
43 };
44 class ParseErrorCategory final : public std::error_category {
45 public:
46  const char *name() const noexcept override;
47  std::string message(int EV) const override;
48 };
49 const std::error_category &getParseCategory();
50 std::error_code make_error_code(ParseError e);
51 
52 /// The ``FormatStyle`` is used to configure the formatting to follow
53 /// specific guidelines.
54 struct FormatStyle {
55  // If the BasedOn: was InheritParentConfig and this style needs the file from
56  // the parent directories. It is not part of the actual style for formatting.
57  // Thus the // instead of ///.
59 
60  /// The extra indent or outdent of access modifiers, e.g. ``public:``.
61  /// \version 3.3
63 
64  /// Different styles for aligning after open brackets.
65  enum BracketAlignmentStyle : unsigned char {
66  /// Align parameters on the open bracket, e.g.:
67  /// \code
68  /// someLongFunction(argument1,
69  /// argument2);
70  /// \endcode
72  /// Don't align, instead use ``ContinuationIndentWidth``, e.g.:
73  /// \code
74  /// someLongFunction(argument1,
75  /// argument2);
76  /// \endcode
78  /// Always break after an open bracket, if the parameters don't fit
79  /// on a single line, e.g.:
80  /// \code
81  /// someLongFunction(
82  /// argument1, argument2);
83  /// \endcode
85  /// Always break after an open bracket, if the parameters don't fit
86  /// on a single line. Closing brackets will be placed on a new line.
87  /// E.g.:
88  /// \code
89  /// someLongFunction(
90  /// argument1, argument2
91  /// )
92  /// \endcode
93  ///
94  /// \warning
95  /// Note: This currently only applies to parentheses.
96  /// \endwarning
98  };
99 
100  /// If ``true``, horizontally aligns arguments after an open bracket.
101  ///
102  /// This applies to round brackets (parentheses), angle brackets and square
103  /// brackets.
104  /// \version 3.8
106 
107  /// Different style for aligning array initializers.
109  /// Align array column and left justify the columns e.g.:
110  /// \code
111  /// struct test demo[] =
112  /// {
113  /// {56, 23, "hello"},
114  /// {-1, 93463, "world"},
115  /// {7, 5, "!!" }
116  /// };
117  /// \endcode
119  /// Align array column and right justify the columns e.g.:
120  /// \code
121  /// struct test demo[] =
122  /// {
123  /// {56, 23, "hello"},
124  /// {-1, 93463, "world"},
125  /// { 7, 5, "!!"}
126  /// };
127  /// \endcode
129  /// Don't align array initializer columns.
131  };
132  /// if not ``None``, when using initialization for an array of structs
133  /// aligns the fields into columns.
134  /// \version 13
136 
137  /// Styles for alignment of consecutive tokens. Tokens can be assignment signs
138  /// (see
139  /// ``AlignConsecutiveAssignments``), bitfield member separators (see
140  /// ``AlignConsecutiveBitFields``), names in declarations (see
141  /// ``AlignConsecutiveDeclarations``) or macro definitions (see
142  /// ``AlignConsecutiveMacros``).
149  };
150 
151  /// Style of aligning consecutive macro definitions.
152  ///
153  /// ``Consecutive`` will result in formattings like:
154  /// \code
155  /// #define SHORT_NAME 42
156  /// #define LONGER_NAME 0x007f
157  /// #define EVEN_LONGER_NAME (2)
158  /// #define foo(x) (x * x)
159  /// #define bar(y, z) (y + z)
160  /// \endcode
161  ///
162  /// Possible values:
163  ///
164  /// * ``ACS_None`` (in configuration: ``None``)
165  /// Do not align macro definitions on consecutive lines.
166  ///
167  /// * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
168  /// Align macro definitions on consecutive lines. This will result in
169  /// formattings like:
170  /// \code
171  /// #define SHORT_NAME 42
172  /// #define LONGER_NAME 0x007f
173  /// #define EVEN_LONGER_NAME (2)
174  ///
175  /// #define foo(x) (x * x)
176  /// /* some comment */
177  /// #define bar(y, z) (y + z)
178  /// \endcode
179  ///
180  /// * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
181  /// Same as ACS_Consecutive, but also spans over empty lines, e.g.
182  /// \code
183  /// #define SHORT_NAME 42
184  /// #define LONGER_NAME 0x007f
185  /// #define EVEN_LONGER_NAME (2)
186  ///
187  /// #define foo(x) (x * x)
188  /// /* some comment */
189  /// #define bar(y, z) (y + z)
190  /// \endcode
191  ///
192  /// * ``ACS_AcrossComments`` (in configuration: ``AcrossComments``)
193  /// Same as ACS_Consecutive, but also spans over lines only containing
194  /// comments, e.g.
195  /// \code
196  /// #define SHORT_NAME 42
197  /// #define LONGER_NAME 0x007f
198  /// #define EVEN_LONGER_NAME (2)
199  ///
200  /// #define foo(x) (x * x)
201  /// /* some comment */
202  /// #define bar(y, z) (y + z)
203  /// \endcode
204  ///
205  /// * ``ACS_AcrossEmptyLinesAndComments``
206  /// (in configuration: ``AcrossEmptyLinesAndComments``)
207  ///
208  /// Same as ACS_Consecutive, but also spans over lines only containing
209  /// comments and empty lines, e.g.
210  /// \code
211  /// #define SHORT_NAME 42
212  /// #define LONGER_NAME 0x007f
213  /// #define EVEN_LONGER_NAME (2)
214  ///
215  /// #define foo(x) (x * x)
216  /// /* some comment */
217  /// #define bar(y, z) (y + z)
218  /// \endcode
219  /// \version 9
221 
222  /// Style of aligning consecutive assignments.
223  ///
224  /// ``Consecutive`` will result in formattings like:
225  /// \code
226  /// int a = 1;
227  /// int somelongname = 2;
228  /// double c = 3;
229  /// \endcode
230  ///
231  /// Possible values:
232  ///
233  /// * ``ACS_None`` (in configuration: ``None``)
234  /// Do not align assignments on consecutive lines.
235  ///
236  /// * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
237  /// Align assignments on consecutive lines. This will result in
238  /// formattings like:
239  /// \code
240  /// int a = 1;
241  /// int somelongname = 2;
242  /// double c = 3;
243  ///
244  /// int d = 3;
245  /// /* A comment. */
246  /// double e = 4;
247  /// \endcode
248  ///
249  /// * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
250  /// Same as ACS_Consecutive, but also spans over empty lines, e.g.
251  /// \code
252  /// int a = 1;
253  /// int somelongname = 2;
254  /// double c = 3;
255  ///
256  /// int d = 3;
257  /// /* A comment. */
258  /// double e = 4;
259  /// \endcode
260  ///
261  /// * ``ACS_AcrossComments`` (in configuration: ``AcrossComments``)
262  /// Same as ACS_Consecutive, but also spans over lines only containing
263  /// comments, e.g.
264  /// \code
265  /// int a = 1;
266  /// int somelongname = 2;
267  /// double c = 3;
268  ///
269  /// int d = 3;
270  /// /* A comment. */
271  /// double e = 4;
272  /// \endcode
273  ///
274  /// * ``ACS_AcrossEmptyLinesAndComments``
275  /// (in configuration: ``AcrossEmptyLinesAndComments``)
276  ///
277  /// Same as ACS_Consecutive, but also spans over lines only containing
278  /// comments and empty lines, e.g.
279  /// \code
280  /// int a = 1;
281  /// int somelongname = 2;
282  /// double c = 3;
283  ///
284  /// int d = 3;
285  /// /* A comment. */
286  /// double e = 4;
287  /// \endcode
288  /// \version 3.8
290 
291  /// Style of aligning consecutive bit field.
292  ///
293  /// ``Consecutive`` will align the bitfield separators of consecutive lines.
294  /// This will result in formattings like:
295  /// \code
296  /// int aaaa : 1;
297  /// int b : 12;
298  /// int ccc : 8;
299  /// \endcode
300  ///
301  /// Possible values:
302  ///
303  /// * ``ACS_None`` (in configuration: ``None``)
304  /// Do not align bit fields on consecutive lines.
305  ///
306  /// * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
307  /// Align bit fields on consecutive lines. This will result in
308  /// formattings like:
309  /// \code
310  /// int aaaa : 1;
311  /// int b : 12;
312  /// int ccc : 8;
313  ///
314  /// int d : 2;
315  /// /* A comment. */
316  /// int ee : 3;
317  /// \endcode
318  ///
319  /// * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
320  /// Same as ACS_Consecutive, but also spans over empty lines, e.g.
321  /// \code
322  /// int aaaa : 1;
323  /// int b : 12;
324  /// int ccc : 8;
325  ///
326  /// int d : 2;
327  /// /* A comment. */
328  /// int ee : 3;
329  /// \endcode
330  ///
331  /// * ``ACS_AcrossComments`` (in configuration: ``AcrossComments``)
332  /// Same as ACS_Consecutive, but also spans over lines only containing
333  /// comments, e.g.
334  /// \code
335  /// int aaaa : 1;
336  /// int b : 12;
337  /// int ccc : 8;
338  ///
339  /// int d : 2;
340  /// /* A comment. */
341  /// int ee : 3;
342  /// \endcode
343  ///
344  /// * ``ACS_AcrossEmptyLinesAndComments``
345  /// (in configuration: ``AcrossEmptyLinesAndComments``)
346  ///
347  /// Same as ACS_Consecutive, but also spans over lines only containing
348  /// comments and empty lines, e.g.
349  /// \code
350  /// int aaaa : 1;
351  /// int b : 12;
352  /// int ccc : 8;
353  ///
354  /// int d : 2;
355  /// /* A comment. */
356  /// int ee : 3;
357  /// \endcode
358  /// \version 11
360 
361  /// Style of aligning consecutive declarations.
362  ///
363  /// ``Consecutive`` will align the declaration names of consecutive lines.
364  /// This will result in formattings like:
365  /// \code
366  /// int aaaa = 12;
367  /// float b = 23;
368  /// std::string ccc;
369  /// \endcode
370  ///
371  /// Possible values:
372  ///
373  /// * ``ACS_None`` (in configuration: ``None``)
374  /// Do not align bit declarations on consecutive lines.
375  ///
376  /// * ``ACS_Consecutive`` (in configuration: ``Consecutive``)
377  /// Align declarations on consecutive lines. This will result in
378  /// formattings like:
379  /// \code
380  /// int aaaa = 12;
381  /// float b = 23;
382  /// std::string ccc;
383  ///
384  /// int a = 42;
385  /// /* A comment. */
386  /// bool c = false;
387  /// \endcode
388  ///
389  /// * ``ACS_AcrossEmptyLines`` (in configuration: ``AcrossEmptyLines``)
390  /// Same as ACS_Consecutive, but also spans over empty lines, e.g.
391  /// \code
392  /// int aaaa = 12;
393  /// float b = 23;
394  /// std::string ccc;
395  ///
396  /// int a = 42;
397  /// /* A comment. */
398  /// bool c = false;
399  /// \endcode
400  ///
401  /// * ``ACS_AcrossComments`` (in configuration: ``AcrossComments``)
402  /// Same as ACS_Consecutive, but also spans over lines only containing
403  /// comments, e.g.
404  /// \code
405  /// int aaaa = 12;
406  /// float b = 23;
407  /// std::string ccc;
408  ///
409  /// int a = 42;
410  /// /* A comment. */
411  /// bool c = false;
412  /// \endcode
413  ///
414  /// * ``ACS_AcrossEmptyLinesAndComments``
415  /// (in configuration: ``AcrossEmptyLinesAndComments``)
416  ///
417  /// Same as ACS_Consecutive, but also spans over lines only containing
418  /// comments and empty lines, e.g.
419  /// \code
420  /// int aaaa = 12;
421  /// float b = 23;
422  /// std::string ccc;
423  ///
424  /// int a = 42;
425  /// /* A comment. */
426  /// bool c = false;
427  /// \endcode
428  /// \version 3.8
430 
431  /// Different styles for aligning escaped newlines.
432  enum EscapedNewlineAlignmentStyle : unsigned char {
433  /// Don't align escaped newlines.
434  /// \code
435  /// #define A \
436  /// int aaaa; \
437  /// int b; \
438  /// int dddddddddd;
439  /// \endcode
441  /// Align escaped newlines as far left as possible.
442  /// \code
443  /// true:
444  /// #define A \
445  /// int aaaa; \
446  /// int b; \
447  /// int dddddddddd;
448  ///
449  /// false:
450  /// \endcode
452  /// Align escaped newlines in the right-most column.
453  /// \code
454  /// #define A \
455  /// int aaaa; \
456  /// int b; \
457  /// int dddddddddd;
458  /// \endcode
460  };
461 
462  /// Options for aligning backslashes in escaped newlines.
463  /// \version 5
465 
466  /// Different styles for aligning operands.
467  enum OperandAlignmentStyle : unsigned char {
468  /// Do not align operands of binary and ternary expressions.
469  /// The wrapped lines are indented ``ContinuationIndentWidth`` spaces from
470  /// the start of the line.
472  /// Horizontally align operands of binary and ternary expressions.
473  ///
474  /// Specifically, this aligns operands of a single expression that needs
475  /// to be split over multiple lines, e.g.:
476  /// \code
477  /// int aaa = bbbbbbbbbbbbbbb +
478  /// ccccccccccccccc;
479  /// \endcode
480  ///
481  /// When ``BreakBeforeBinaryOperators`` is set, the wrapped operator is
482  /// aligned with the operand on the first line.
483  /// \code
484  /// int aaa = bbbbbbbbbbbbbbb
485  /// + ccccccccccccccc;
486  /// \endcode
488  /// Horizontally align operands of binary and ternary expressions.
489  ///
490  /// This is similar to ``AO_Align``, except when
491  /// ``BreakBeforeBinaryOperators`` is set, the operator is un-indented so
492  /// that the wrapped operand is aligned with the operand on the first line.
493  /// \code
494  /// int aaa = bbbbbbbbbbbbbbb
495  /// + ccccccccccccccc;
496  /// \endcode
498  };
499 
500  /// If ``true``, horizontally align operands of binary and ternary
501  /// expressions.
502  /// \version 12
504 
505  /// If ``true``, aligns trailing comments.
506  /// \code
507  /// true: false:
508  /// int a; // My comment a vs. int a; // My comment a
509  /// int b = 2; // comment b int b = 2; // comment about b
510  /// \endcode
511  /// \version 3.7
513 
514  /// \brief If a function call or braced initializer list doesn't fit on a
515  /// line, allow putting all arguments onto the next line, even if
516  /// ``BinPackArguments`` is ``false``.
517  /// \code
518  /// true:
519  /// callFunction(
520  /// a, b, c, d);
521  ///
522  /// false:
523  /// callFunction(a,
524  /// b,
525  /// c,
526  /// d);
527  /// \endcode
528  /// \version 9
530 
531  /// This option is **deprecated**. See ``NextLine`` of
532  /// ``PackConstructorInitializers``.
533  /// \version 9
535 
536  /// If the function declaration doesn't fit on a line,
537  /// allow putting all parameters of a function declaration onto
538  /// the next line even if ``BinPackParameters`` is ``false``.
539  /// \code
540  /// true:
541  /// void myFunction(
542  /// int a, int b, int c, int d, int e);
543  ///
544  /// false:
545  /// void myFunction(int a,
546  /// int b,
547  /// int c,
548  /// int d,
549  /// int e);
550  /// \endcode
551  /// \version 3.3
553 
554  /// Allow short enums on a single line.
555  /// \code
556  /// true:
557  /// enum { A, B } myEnum;
558  ///
559  /// false:
560  /// enum {
561  /// A,
562  /// B
563  /// } myEnum;
564  /// \endcode
565  /// \version 12
567 
568  /// Different styles for merging short blocks containing at most one
569  /// statement.
570  enum ShortBlockStyle : unsigned char {
571  /// Never merge blocks into a single line.
572  /// \code
573  /// while (true) {
574  /// }
575  /// while (true) {
576  /// continue;
577  /// }
578  /// \endcode
580  /// Only merge empty blocks.
581  /// \code
582  /// while (true) {}
583  /// while (true) {
584  /// continue;
585  /// }
586  /// \endcode
588  /// Always merge short blocks into a single line.
589  /// \code
590  /// while (true) {}
591  /// while (true) { continue; }
592  /// \endcode
594  };
595 
596  /// Dependent on the value, ``while (true) { continue; }`` can be put on a
597  /// single line.
598  /// \version 11
600 
601  /// If ``true``, short case labels will be contracted to a single line.
602  /// \code
603  /// true: false:
604  /// switch (a) { vs. switch (a) {
605  /// case 1: x = 1; break; case 1:
606  /// case 2: return; x = 1;
607  /// } break;
608  /// case 2:
609  /// return;
610  /// }
611  /// \endcode
612  /// \version 3.6
614 
615  /// Different styles for merging short functions containing at most one
616  /// statement.
617  enum ShortFunctionStyle : unsigned char {
618  /// Never merge functions into a single line.
620  /// Only merge functions defined inside a class. Same as "inline",
621  /// except it does not implies "empty": i.e. top level empty functions
622  /// are not merged either.
623  /// \code
624  /// class Foo {
625  /// void f() { foo(); }
626  /// };
627  /// void f() {
628  /// foo();
629  /// }
630  /// void f() {
631  /// }
632  /// \endcode
634  /// Only merge empty functions.
635  /// \code
636  /// void f() {}
637  /// void f2() {
638  /// bar2();
639  /// }
640  /// \endcode
642  /// Only merge functions defined inside a class. Implies "empty".
643  /// \code
644  /// class Foo {
645  /// void f() { foo(); }
646  /// };
647  /// void f() {
648  /// foo();
649  /// }
650  /// void f() {}
651  /// \endcode
653  /// Merge all functions fitting on a single line.
654  /// \code
655  /// class Foo {
656  /// void f() { foo(); }
657  /// };
658  /// void f() { bar(); }
659  /// \endcode
661  };
662 
663  /// Dependent on the value, ``int f() { return 0; }`` can be put on a
664  /// single line.
665  /// \version 3.5
667 
668  /// Different styles for handling short if statements.
669  enum ShortIfStyle : unsigned char {
670  /// Never put short ifs on the same line.
671  /// \code
672  /// if (a)
673  /// return;
674  ///
675  /// if (b)
676  /// return;
677  /// else
678  /// return;
679  ///
680  /// if (c)
681  /// return;
682  /// else {
683  /// return;
684  /// }
685  /// \endcode
687  /// Put short ifs on the same line only if there is no else statement.
688  /// \code
689  /// if (a) return;
690  ///
691  /// if (b)
692  /// return;
693  /// else
694  /// return;
695  ///
696  /// if (c)
697  /// return;
698  /// else {
699  /// return;
700  /// }
701  /// \endcode
703  /// Put short ifs, but not else ifs nor else statements, on the same line.
704  /// \code
705  /// if (a) return;
706  ///
707  /// if (b) return;
708  /// else if (b)
709  /// return;
710  /// else
711  /// return;
712  ///
713  /// if (c) return;
714  /// else {
715  /// return;
716  /// }
717  /// \endcode
719  /// Always put short ifs, else ifs and else statements on the same
720  /// line.
721  /// \code
722  /// if (a) return;
723  ///
724  /// if (b) return;
725  /// else return;
726  ///
727  /// if (c) return;
728  /// else {
729  /// return;
730  /// }
731  /// \endcode
733  };
734 
735  /// Dependent on the value, ``if (a) return;`` can be put on a single line.
736  /// \version 9
738 
739  /// Different styles for merging short lambdas containing at most one
740  /// statement.
741  enum ShortLambdaStyle : unsigned char {
742  /// Never merge lambdas into a single line.
744  /// Only merge empty lambdas.
745  /// \code
746  /// auto lambda = [](int a) {}
747  /// auto lambda2 = [](int a) {
748  /// return a;
749  /// };
750  /// \endcode
752  /// Merge lambda into a single line if argument of a function.
753  /// \code
754  /// auto lambda = [](int a) {
755  /// return a;
756  /// };
757  /// sort(a.begin(), a.end(), ()[] { return x < y; })
758  /// \endcode
760  /// Merge all lambdas fitting on a single line.
761  /// \code
762  /// auto lambda = [](int a) {}
763  /// auto lambda2 = [](int a) { return a; };
764  /// \endcode
766  };
767 
768  /// Dependent on the value, ``auto lambda []() { return 0; }`` can be put on a
769  /// single line.
770  /// \version 9
772 
773  /// If ``true``, ``while (true) continue;`` can be put on a single
774  /// line.
775  /// \version 3.7
777 
778  /// Different ways to break after the function definition return type.
779  /// This option is **deprecated** and is retained for backwards compatibility.
780  enum DefinitionReturnTypeBreakingStyle : unsigned char {
781  /// Break after return type automatically.
782  /// ``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
784  /// Always break after the return type.
786  /// Always break after the return types of top-level functions.
788  };
789 
790  /// Different ways to break after the function definition or
791  /// declaration return type.
792  enum ReturnTypeBreakingStyle : unsigned char {
793  /// Break after return type automatically.
794  /// ``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
795  /// \code
796  /// class A {
797  /// int f() { return 0; };
798  /// };
799  /// int f();
800  /// int f() { return 1; }
801  /// \endcode
803  /// Always break after the return type.
804  /// \code
805  /// class A {
806  /// int
807  /// f() {
808  /// return 0;
809  /// };
810  /// };
811  /// int
812  /// f();
813  /// int
814  /// f() {
815  /// return 1;
816  /// }
817  /// \endcode
819  /// Always break after the return types of top-level functions.
820  /// \code
821  /// class A {
822  /// int f() { return 0; };
823  /// };
824  /// int
825  /// f();
826  /// int
827  /// f() {
828  /// return 1;
829  /// }
830  /// \endcode
832  /// Always break after the return type of function definitions.
833  /// \code
834  /// class A {
835  /// int
836  /// f() {
837  /// return 0;
838  /// };
839  /// };
840  /// int f();
841  /// int
842  /// f() {
843  /// return 1;
844  /// }
845  /// \endcode
847  /// Always break after the return type of top-level definitions.
848  /// \code
849  /// class A {
850  /// int f() { return 0; };
851  /// };
852  /// int f();
853  /// int
854  /// f() {
855  /// return 1;
856  /// }
857  /// \endcode
859  };
860 
861  /// The function definition return type breaking style to use. This
862  /// option is **deprecated** and is retained for backwards compatibility.
863  /// \version 3.7
865 
866  /// The function declaration return type breaking style to use.
867  /// \version 3.8
869 
870  /// If ``true``, always break before multiline string literals.
871  ///
872  /// This flag is mean to make cases where there are multiple multiline strings
873  /// in a file look more consistent. Thus, it will only take effect if wrapping
874  /// the string at that point leads to it being indented
875  /// ``ContinuationIndentWidth`` spaces from the start of the line.
876  /// \code
877  /// true: false:
878  /// aaaa = vs. aaaa = "bbbb"
879  /// "bbbb" "cccc";
880  /// "cccc";
881  /// \endcode
882  /// \version 3.4
884 
885  /// Different ways to break after the template declaration.
886  enum BreakTemplateDeclarationsStyle : unsigned char {
887  /// Do not force break before declaration.
888  /// ``PenaltyBreakTemplateDeclaration`` is taken into account.
889  /// \code
890  /// template <typename T> T foo() {
891  /// }
892  /// template <typename T> T foo(int aaaaaaaaaaaaaaaaaaaaa,
893  /// int bbbbbbbbbbbbbbbbbbbbb) {
894  /// }
895  /// \endcode
897  /// Force break after template declaration only when the following
898  /// declaration spans multiple lines.
899  /// \code
900  /// template <typename T> T foo() {
901  /// }
902  /// template <typename T>
903  /// T foo(int aaaaaaaaaaaaaaaaaaaaa,
904  /// int bbbbbbbbbbbbbbbbbbbbb) {
905  /// }
906  /// \endcode
908  /// Always break after template declaration.
909  /// \code
910  /// template <typename T>
911  /// T foo() {
912  /// }
913  /// template <typename T>
914  /// T foo(int aaaaaaaaaaaaaaaaaaaaa,
915  /// int bbbbbbbbbbbbbbbbbbbbb) {
916  /// }
917  /// \endcode
919  };
920 
921  /// The template declaration breaking style to use.
922  /// \version 7
924 
925  /// A vector of strings that should be interpreted as attributes/qualifiers
926  /// instead of identifiers. This can be useful for language extensions or
927  /// static analyzer annotations.
928  ///
929  /// For example:
930  /// \code
931  /// x = (char *__capability)&y;
932  /// int function(void) __ununsed;
933  /// void only_writes_to_buffer(char *__output buffer);
934  /// \endcode
935  ///
936  /// In the .clang-format configuration file, this can be configured like:
937  /// \code{.yaml}
938  /// AttributeMacros: ['__capability', '__output', '__ununsed']
939  /// \endcode
940  ///
941  /// \version 12
942  std::vector<std::string> AttributeMacros;
943 
944  /// If ``false``, a function call's arguments will either be all on the
945  /// same line or will have one line each.
946  /// \code
947  /// true:
948  /// void f() {
949  /// f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,
950  /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
951  /// }
952  ///
953  /// false:
954  /// void f() {
955  /// f(aaaaaaaaaaaaaaaaaaaa,
956  /// aaaaaaaaaaaaaaaaaaaa,
957  /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
958  /// }
959  /// \endcode
960  /// \version 3.7
962 
963  /// The style of inserting trailing commas into container literals.
964  enum TrailingCommaStyle : unsigned char {
965  /// Do not insert trailing commas.
967  /// Insert trailing commas in container literals that were wrapped over
968  /// multiple lines. Note that this is conceptually incompatible with
969  /// bin-packing, because the trailing comma is used as an indicator
970  /// that a container should be formatted one-per-line (i.e. not bin-packed).
971  /// So inserting a trailing comma counteracts bin-packing.
973  };
974 
975  /// If set to ``TCS_Wrapped`` will insert trailing commas in container
976  /// literals (arrays and objects) that wrap across multiple lines.
977  /// It is currently only available for JavaScript
978  /// and disabled by default ``TCS_None``.
979  /// ``InsertTrailingCommas`` cannot be used together with ``BinPackArguments``
980  /// as inserting the comma disables bin-packing.
981  /// \code
982  /// TSC_Wrapped:
983  /// const someArray = [
984  /// aaaaaaaaaaaaaaaaaaaaaaaaaa,
985  /// aaaaaaaaaaaaaaaaaaaaaaaaaa,
986  /// aaaaaaaaaaaaaaaaaaaaaaaaaa,
987  /// // ^ inserted
988  /// ]
989  /// \endcode
990  /// \version 12
992 
993  /// If ``false``, a function declaration's or function definition's
994  /// parameters will either all be on the same line or will have one line each.
995  /// \code
996  /// true:
997  /// void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,
998  /// int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
999  ///
1000  /// false:
1001  /// void f(int aaaaaaaaaaaaaaaaaaaa,
1002  /// int aaaaaaaaaaaaaaaaaaaa,
1003  /// int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
1004  /// \endcode
1005  /// \version 3.7
1007 
1008  /// The style of wrapping parameters on the same line (bin-packed) or
1009  /// on one line each.
1010  enum BinPackStyle : unsigned char {
1011  /// Automatically determine parameter bin-packing behavior.
1013  /// Always bin-pack parameters.
1015  /// Never bin-pack parameters.
1017  };
1018 
1019  /// The style of breaking before or after binary operators.
1020  enum BinaryOperatorStyle : unsigned char {
1021  /// Break after operators.
1022  /// \code
1023  /// LooooooooooongType loooooooooooooooooooooongVariable =
1024  /// someLooooooooooooooooongFunction();
1025  ///
1026  /// bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
1027  /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ==
1028  /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
1029  /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >
1030  /// ccccccccccccccccccccccccccccccccccccccccc;
1031  /// \endcode
1033  /// Break before operators that aren't assignments.
1034  /// \code
1035  /// LooooooooooongType loooooooooooooooooooooongVariable =
1036  /// someLooooooooooooooooongFunction();
1037  ///
1038  /// bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1039  /// + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1040  /// == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1041  /// && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1042  /// > ccccccccccccccccccccccccccccccccccccccccc;
1043  /// \endcode
1045  /// Break before operators.
1046  /// \code
1047  /// LooooooooooongType loooooooooooooooooooooongVariable
1048  /// = someLooooooooooooooooongFunction();
1049  ///
1050  /// bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1051  /// + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1052  /// == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1053  /// && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1054  /// > ccccccccccccccccccccccccccccccccccccccccc;
1055  /// \endcode
1057  };
1058 
1059  /// The way to wrap binary operators.
1060  /// \version 3.6
1062 
1063  /// Different ways to attach braces to their surrounding context.
1064  enum BraceBreakingStyle : unsigned char {
1065  /// Always attach braces to surrounding context.
1066  /// \code
1067  /// namespace N {
1068  /// enum E {
1069  /// E1,
1070  /// E2,
1071  /// };
1072  ///
1073  /// class C {
1074  /// public:
1075  /// C();
1076  /// };
1077  ///
1078  /// bool baz(int i) {
1079  /// try {
1080  /// do {
1081  /// switch (i) {
1082  /// case 1: {
1083  /// foobar();
1084  /// break;
1085  /// }
1086  /// default: {
1087  /// break;
1088  /// }
1089  /// }
1090  /// } while (--i);
1091  /// return true;
1092  /// } catch (...) {
1093  /// handleError();
1094  /// return false;
1095  /// }
1096  /// }
1097  ///
1098  /// void foo(bool b) {
1099  /// if (b) {
1100  /// baz(2);
1101  /// } else {
1102  /// baz(5);
1103  /// }
1104  /// }
1105  ///
1106  /// void bar() { foo(true); }
1107  /// } // namespace N
1108  /// \endcode
1110  /// Like ``Attach``, but break before braces on function, namespace and
1111  /// class definitions.
1112  /// \code
1113  /// namespace N
1114  /// {
1115  /// enum E {
1116  /// E1,
1117  /// E2,
1118  /// };
1119  ///
1120  /// class C
1121  /// {
1122  /// public:
1123  /// C();
1124  /// };
1125  ///
1126  /// bool baz(int i)
1127  /// {
1128  /// try {
1129  /// do {
1130  /// switch (i) {
1131  /// case 1: {
1132  /// foobar();
1133  /// break;
1134  /// }
1135  /// default: {
1136  /// break;
1137  /// }
1138  /// }
1139  /// } while (--i);
1140  /// return true;
1141  /// } catch (...) {
1142  /// handleError();
1143  /// return false;
1144  /// }
1145  /// }
1146  ///
1147  /// void foo(bool b)
1148  /// {
1149  /// if (b) {
1150  /// baz(2);
1151  /// } else {
1152  /// baz(5);
1153  /// }
1154  /// }
1155  ///
1156  /// void bar() { foo(true); }
1157  /// } // namespace N
1158  /// \endcode
1160  /// Like ``Attach``, but break before braces on enum, function, and record
1161  /// definitions.
1162  /// \code
1163  /// namespace N {
1164  /// enum E
1165  /// {
1166  /// E1,
1167  /// E2,
1168  /// };
1169  ///
1170  /// class C
1171  /// {
1172  /// public:
1173  /// C();
1174  /// };
1175  ///
1176  /// bool baz(int i)
1177  /// {
1178  /// try {
1179  /// do {
1180  /// switch (i) {
1181  /// case 1: {
1182  /// foobar();
1183  /// break;
1184  /// }
1185  /// default: {
1186  /// break;
1187  /// }
1188  /// }
1189  /// } while (--i);
1190  /// return true;
1191  /// } catch (...) {
1192  /// handleError();
1193  /// return false;
1194  /// }
1195  /// }
1196  ///
1197  /// void foo(bool b)
1198  /// {
1199  /// if (b) {
1200  /// baz(2);
1201  /// } else {
1202  /// baz(5);
1203  /// }
1204  /// }
1205  ///
1206  /// void bar() { foo(true); }
1207  /// } // namespace N
1208  /// \endcode
1210  /// Like ``Attach``, but break before function definitions, ``catch``, and
1211  /// ``else``.
1212  /// \code
1213  /// namespace N {
1214  /// enum E {
1215  /// E1,
1216  /// E2,
1217  /// };
1218  ///
1219  /// class C {
1220  /// public:
1221  /// C();
1222  /// };
1223  ///
1224  /// bool baz(int i)
1225  /// {
1226  /// try {
1227  /// do {
1228  /// switch (i) {
1229  /// case 1: {
1230  /// foobar();
1231  /// break;
1232  /// }
1233  /// default: {
1234  /// break;
1235  /// }
1236  /// }
1237  /// } while (--i);
1238  /// return true;
1239  /// }
1240  /// catch (...) {
1241  /// handleError();
1242  /// return false;
1243  /// }
1244  /// }
1245  ///
1246  /// void foo(bool b)
1247  /// {
1248  /// if (b) {
1249  /// baz(2);
1250  /// }
1251  /// else {
1252  /// baz(5);
1253  /// }
1254  /// }
1255  ///
1256  /// void bar() { foo(true); }
1257  /// } // namespace N
1258  /// \endcode
1260  /// Always break before braces.
1261  /// \code
1262  /// namespace N
1263  /// {
1264  /// enum E
1265  /// {
1266  /// E1,
1267  /// E2,
1268  /// };
1269  ///
1270  /// class C
1271  /// {
1272  /// public:
1273  /// C();
1274  /// };
1275  ///
1276  /// bool baz(int i)
1277  /// {
1278  /// try
1279  /// {
1280  /// do
1281  /// {
1282  /// switch (i)
1283  /// {
1284  /// case 1:
1285  /// {
1286  /// foobar();
1287  /// break;
1288  /// }
1289  /// default:
1290  /// {
1291  /// break;
1292  /// }
1293  /// }
1294  /// } while (--i);
1295  /// return true;
1296  /// }
1297  /// catch (...)
1298  /// {
1299  /// handleError();
1300  /// return false;
1301  /// }
1302  /// }
1303  ///
1304  /// void foo(bool b)
1305  /// {
1306  /// if (b)
1307  /// {
1308  /// baz(2);
1309  /// }
1310  /// else
1311  /// {
1312  /// baz(5);
1313  /// }
1314  /// }
1315  ///
1316  /// void bar() { foo(true); }
1317  /// } // namespace N
1318  /// \endcode
1320  /// Like ``Allman`` but always indent braces and line up code with braces.
1321  /// \code
1322  /// namespace N
1323  /// {
1324  /// enum E
1325  /// {
1326  /// E1,
1327  /// E2,
1328  /// };
1329  ///
1330  /// class C
1331  /// {
1332  /// public:
1333  /// C();
1334  /// };
1335  ///
1336  /// bool baz(int i)
1337  /// {
1338  /// try
1339  /// {
1340  /// do
1341  /// {
1342  /// switch (i)
1343  /// {
1344  /// case 1:
1345  /// {
1346  /// foobar();
1347  /// break;
1348  /// }
1349  /// default:
1350  /// {
1351  /// break;
1352  /// }
1353  /// }
1354  /// } while (--i);
1355  /// return true;
1356  /// }
1357  /// catch (...)
1358  /// {
1359  /// handleError();
1360  /// return false;
1361  /// }
1362  /// }
1363  ///
1364  /// void foo(bool b)
1365  /// {
1366  /// if (b)
1367  /// {
1368  /// baz(2);
1369  /// }
1370  /// else
1371  /// {
1372  /// baz(5);
1373  /// }
1374  /// }
1375  ///
1376  /// void bar() { foo(true); }
1377  /// } // namespace N
1378  /// \endcode
1380  /// Always break before braces and add an extra level of indentation to
1381  /// braces of control statements, not to those of class, function
1382  /// or other definitions.
1383  /// \code
1384  /// namespace N
1385  /// {
1386  /// enum E
1387  /// {
1388  /// E1,
1389  /// E2,
1390  /// };
1391  ///
1392  /// class C
1393  /// {
1394  /// public:
1395  /// C();
1396  /// };
1397  ///
1398  /// bool baz(int i)
1399  /// {
1400  /// try
1401  /// {
1402  /// do
1403  /// {
1404  /// switch (i)
1405  /// {
1406  /// case 1:
1407  /// {
1408  /// foobar();
1409  /// break;
1410  /// }
1411  /// default:
1412  /// {
1413  /// break;
1414  /// }
1415  /// }
1416  /// }
1417  /// while (--i);
1418  /// return true;
1419  /// }
1420  /// catch (...)
1421  /// {
1422  /// handleError();
1423  /// return false;
1424  /// }
1425  /// }
1426  ///
1427  /// void foo(bool b)
1428  /// {
1429  /// if (b)
1430  /// {
1431  /// baz(2);
1432  /// }
1433  /// else
1434  /// {
1435  /// baz(5);
1436  /// }
1437  /// }
1438  ///
1439  /// void bar() { foo(true); }
1440  /// } // namespace N
1441  /// \endcode
1443  /// Like ``Attach``, but break before functions.
1444  /// \code
1445  /// namespace N {
1446  /// enum E {
1447  /// E1,
1448  /// E2,
1449  /// };
1450  ///
1451  /// class C {
1452  /// public:
1453  /// C();
1454  /// };
1455  ///
1456  /// bool baz(int i)
1457  /// {
1458  /// try {
1459  /// do {
1460  /// switch (i) {
1461  /// case 1: {
1462  /// foobar();
1463  /// break;
1464  /// }
1465  /// default: {
1466  /// break;
1467  /// }
1468  /// }
1469  /// } while (--i);
1470  /// return true;
1471  /// } catch (...) {
1472  /// handleError();
1473  /// return false;
1474  /// }
1475  /// }
1476  ///
1477  /// void foo(bool b)
1478  /// {
1479  /// if (b) {
1480  /// baz(2);
1481  /// } else {
1482  /// baz(5);
1483  /// }
1484  /// }
1485  ///
1486  /// void bar() { foo(true); }
1487  /// } // namespace N
1488  /// \endcode
1490  /// Configure each individual brace in `BraceWrapping`.
1492  };
1493 
1494  /// The brace breaking style to use.
1495  /// \version 3.7
1497 
1498  /// Different ways to wrap braces after control statements.
1500  /// Never wrap braces after a control statement.
1501  /// \code
1502  /// if (foo()) {
1503  /// } else {
1504  /// }
1505  /// for (int i = 0; i < 10; ++i) {
1506  /// }
1507  /// \endcode
1509  /// Only wrap braces after a multi-line control statement.
1510  /// \code
1511  /// if (foo && bar &&
1512  /// baz)
1513  /// {
1514  /// quux();
1515  /// }
1516  /// while (foo || bar) {
1517  /// }
1518  /// \endcode
1520  /// Always wrap braces after a control statement.
1521  /// \code
1522  /// if (foo())
1523  /// {
1524  /// } else
1525  /// {}
1526  /// for (int i = 0; i < 10; ++i)
1527  /// {}
1528  /// \endcode
1530  };
1531 
1532  /// Precise control over the wrapping of braces.
1533  /// \code
1534  /// # Should be declared this way:
1535  /// BreakBeforeBraces: Custom
1536  /// BraceWrapping:
1537  /// AfterClass: true
1538  /// \endcode
1540  /// Wrap case labels.
1541  /// \code
1542  /// false: true:
1543  /// switch (foo) { vs. switch (foo) {
1544  /// case 1: { case 1:
1545  /// bar(); {
1546  /// break; bar();
1547  /// } break;
1548  /// default: { }
1549  /// plop(); default:
1550  /// } {
1551  /// } plop();
1552  /// }
1553  /// }
1554  /// \endcode
1556  /// Wrap class definitions.
1557  /// \code
1558  /// true:
1559  /// class foo {};
1560  ///
1561  /// false:
1562  /// class foo
1563  /// {};
1564  /// \endcode
1566 
1567  /// Wrap control statements (``if``/``for``/``while``/``switch``/..).
1569  /// Wrap enum definitions.
1570  /// \code
1571  /// true:
1572  /// enum X : int
1573  /// {
1574  /// B
1575  /// };
1576  ///
1577  /// false:
1578  /// enum X : int { B };
1579  /// \endcode
1581  /// Wrap function definitions.
1582  /// \code
1583  /// true:
1584  /// void foo()
1585  /// {
1586  /// bar();
1587  /// bar2();
1588  /// }
1589  ///
1590  /// false:
1591  /// void foo() {
1592  /// bar();
1593  /// bar2();
1594  /// }
1595  /// \endcode
1597  /// Wrap namespace definitions.
1598  /// \code
1599  /// true:
1600  /// namespace
1601  /// {
1602  /// int foo();
1603  /// int bar();
1604  /// }
1605  ///
1606  /// false:
1607  /// namespace {
1608  /// int foo();
1609  /// int bar();
1610  /// }
1611  /// \endcode
1613  /// Wrap ObjC definitions (interfaces, implementations...).
1614  /// \note @autoreleasepool and @synchronized blocks are wrapped
1615  /// according to `AfterControlStatement` flag.
1617  /// Wrap struct definitions.
1618  /// \code
1619  /// true:
1620  /// struct foo
1621  /// {
1622  /// int x;
1623  /// };
1624  ///
1625  /// false:
1626  /// struct foo {
1627  /// int x;
1628  /// };
1629  /// \endcode
1631  /// Wrap union definitions.
1632  /// \code
1633  /// true:
1634  /// union foo
1635  /// {
1636  /// int x;
1637  /// }
1638  ///
1639  /// false:
1640  /// union foo {
1641  /// int x;
1642  /// }
1643  /// \endcode
1645  /// Wrap extern blocks.
1646  /// \code
1647  /// true:
1648  /// extern "C"
1649  /// {
1650  /// int foo();
1651  /// }
1652  ///
1653  /// false:
1654  /// extern "C" {
1655  /// int foo();
1656  /// }
1657  /// \endcode
1658  bool AfterExternBlock; // Partially superseded by IndentExternBlock
1659  /// Wrap before ``catch``.
1660  /// \code
1661  /// true:
1662  /// try {
1663  /// foo();
1664  /// }
1665  /// catch () {
1666  /// }
1667  ///
1668  /// false:
1669  /// try {
1670  /// foo();
1671  /// } catch () {
1672  /// }
1673  /// \endcode
1675  /// Wrap before ``else``.
1676  /// \code
1677  /// true:
1678  /// if (foo()) {
1679  /// }
1680  /// else {
1681  /// }
1682  ///
1683  /// false:
1684  /// if (foo()) {
1685  /// } else {
1686  /// }
1687  /// \endcode
1689  /// Wrap lambda block.
1690  /// \code
1691  /// true:
1692  /// connect(
1693  /// []()
1694  /// {
1695  /// foo();
1696  /// bar();
1697  /// });
1698  ///
1699  /// false:
1700  /// connect([]() {
1701  /// foo();
1702  /// bar();
1703  /// });
1704  /// \endcode
1706  /// Wrap before ``while``.
1707  /// \code
1708  /// true:
1709  /// do {
1710  /// foo();
1711  /// }
1712  /// while (1);
1713  ///
1714  /// false:
1715  /// do {
1716  /// foo();
1717  /// } while (1);
1718  /// \endcode
1720  /// Indent the wrapped braces themselves.
1722  /// If ``false``, empty function body can be put on a single line.
1723  /// This option is used only if the opening brace of the function has
1724  /// already been wrapped, i.e. the `AfterFunction` brace wrapping mode is
1725  /// set, and the function could/should not be put on a single line (as per
1726  /// `AllowShortFunctionsOnASingleLine` and constructor formatting options).
1727  /// \code
1728  /// int f() vs. int f()
1729  /// {} {
1730  /// }
1731  /// \endcode
1732  ///
1734  /// If ``false``, empty record (e.g. class, struct or union) body
1735  /// can be put on a single line. This option is used only if the opening
1736  /// brace of the record has already been wrapped, i.e. the `AfterClass`
1737  /// (for classes) brace wrapping mode is set.
1738  /// \code
1739  /// class Foo vs. class Foo
1740  /// {} {
1741  /// }
1742  /// \endcode
1743  ///
1745  /// If ``false``, empty namespace body can be put on a single line.
1746  /// This option is used only if the opening brace of the namespace has
1747  /// already been wrapped, i.e. the `AfterNamespace` brace wrapping mode is
1748  /// set.
1749  /// \code
1750  /// namespace Foo vs. namespace Foo
1751  /// {} {
1752  /// }
1753  /// \endcode
1754  ///
1756  };
1757 
1758  /// Control of individual brace wrapping cases.
1759  ///
1760  /// If ``BreakBeforeBraces`` is set to ``BS_Custom``, use this to specify how
1761  /// each individual brace case should be handled. Otherwise, this is ignored.
1762  /// \code{.yaml}
1763  /// # Example of usage:
1764  /// BreakBeforeBraces: Custom
1765  /// BraceWrapping:
1766  /// AfterEnum: true
1767  /// AfterStruct: false
1768  /// SplitEmptyFunction: false
1769  /// \endcode
1770  /// \version 3.8
1772 
1773  /// If ``true``, concept will be placed on a new line.
1774  /// \code
1775  /// true:
1776  /// template<typename T>
1777  /// concept ...
1778  ///
1779  /// false:
1780  /// template<typename T> concept ...
1781  /// \endcode
1782  /// \version 13
1784 
1785  /// If ``true``, ternary operators will be placed after line breaks.
1786  /// \code
1787  /// true:
1788  /// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
1789  /// ? firstValue
1790  /// : SecondValueVeryVeryVeryVeryLong;
1791  ///
1792  /// false:
1793  /// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?
1794  /// firstValue :
1795  /// SecondValueVeryVeryVeryVeryLong;
1796  /// \endcode
1797  /// \version 3.7
1799 
1800  /// Different ways to break initializers.
1801  enum BreakConstructorInitializersStyle : unsigned char {
1802  /// Break constructor initializers before the colon and after the commas.
1803  /// \code
1804  /// Constructor()
1805  /// : initializer1(),
1806  /// initializer2()
1807  /// \endcode
1809  /// Break constructor initializers before the colon and commas, and align
1810  /// the commas with the colon.
1811  /// \code
1812  /// Constructor()
1813  /// : initializer1()
1814  /// , initializer2()
1815  /// \endcode
1817  /// Break constructor initializers after the colon and commas.
1818  /// \code
1819  /// Constructor() :
1820  /// initializer1(),
1821  /// initializer2()
1822  /// \endcode
1824  };
1825 
1826  /// The break constructor initializers style to use.
1827  /// \version 5
1829 
1830  /// Break after each annotation on a field in Java files.
1831  /// \code{.java}
1832  /// true: false:
1833  /// @Partial vs. @Partial @Mock DataLoad loader;
1834  /// @Mock
1835  /// DataLoad loader;
1836  /// \endcode
1837  /// \version 3.8
1839 
1840  /// Allow breaking string literals when formatting.
1841  /// \code
1842  /// true:
1843  /// const char* x = "veryVeryVeryVeryVeryVe"
1844  /// "ryVeryVeryVeryVeryVery"
1845  /// "VeryLongString";
1846  ///
1847  /// false:
1848  /// const char* x =
1849  /// "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
1850  /// \endcode
1851  /// \version 3.9
1853 
1854  /// The column limit.
1855  ///
1856  /// A column limit of ``0`` means that there is no column limit. In this case,
1857  /// clang-format will respect the input's line breaking decisions within
1858  /// statements unless they contradict other rules.
1859  /// \version 3.7
1860  unsigned ColumnLimit;
1861 
1862  /// A regular expression that describes comments with special meaning,
1863  /// which should not be split into lines or otherwise changed.
1864  /// \code
1865  /// // CommentPragmas: '^ FOOBAR pragma:'
1866  /// // Will leave the following line unaffected
1867  /// #include <vector> // FOOBAR pragma: keep
1868  /// \endcode
1869  /// \version 3.7
1871 
1872  /// Different specifiers and qualifiers alignment styles.
1874  /// Don't change specifiers/qualifiers to either Left or Right alignment
1875  /// (default).
1876  /// \code
1877  /// int const a;
1878  /// const int *a;
1879  /// \endcode
1881  /// Change specifiers/qualifiers to be left-aligned.
1882  /// \code
1883  /// const int a;
1884  /// const int *a;
1885  /// \endcode
1887  /// Change specifiers/qualifiers to be right-aligned.
1888  /// \code
1889  /// int const a;
1890  /// int const *a;
1891  /// \endcode
1893  /// Change specifiers/qualifiers to be aligned based on ``QualifierOrder``.
1894  /// With:
1895  /// \code{.yaml}
1896  /// QualifierOrder: ['inline', 'static' , 'type', 'const']
1897  /// \endcode
1898  ///
1899  /// \code
1900  ///
1901  /// int const a;
1902  /// int const *a;
1903  /// \endcode
1905  };
1906 
1907  /// Different ways to arrange specifiers and qualifiers (e.g. const/volatile).
1908  /// \warning
1909  /// Setting ``QualifierAlignment`` to something other than `Leave`, COULD
1910  /// lead to incorrect code formatting due to incorrect decisions made due to
1911  /// clang-formats lack of complete semantic information.
1912  /// As such extra care should be taken to review code changes made by the use
1913  /// of this option.
1914  /// \endwarning
1915  /// \version 14
1917 
1918  /// The order in which the qualifiers appear.
1919  /// Order is an array that can contain any of the following:
1920  ///
1921  /// * const
1922  /// * inline
1923  /// * static
1924  /// * constexpr
1925  /// * volatile
1926  /// * restrict
1927  /// * type
1928  ///
1929  /// Note: it MUST contain 'type'.
1930  /// Items to the left of 'type' will be placed to the left of the type and
1931  /// aligned in the order supplied. Items to the right of 'type' will be placed
1932  /// to the right of the type and aligned in the order supplied.
1933  ///
1934  /// \code{.yaml}
1935  /// QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ]
1936  /// \endcode
1937  /// \version 14
1938  std::vector<std::string> QualifierOrder;
1939 
1940  /// Different ways to break inheritance list.
1941  enum BreakInheritanceListStyle : unsigned char {
1942  /// Break inheritance list before the colon and after the commas.
1943  /// \code
1944  /// class Foo
1945  /// : Base1,
1946  /// Base2
1947  /// {};
1948  /// \endcode
1950  /// Break inheritance list before the colon and commas, and align
1951  /// the commas with the colon.
1952  /// \code
1953  /// class Foo
1954  /// : Base1
1955  /// , Base2
1956  /// {};
1957  /// \endcode
1959  /// Break inheritance list after the colon and commas.
1960  /// \code
1961  /// class Foo :
1962  /// Base1,
1963  /// Base2
1964  /// {};
1965  /// \endcode
1967  /// Break inheritance list only after the commas.
1968  /// \code
1969  /// class Foo : Base1,
1970  /// Base2
1971  /// {};
1972  /// \endcode
1974  };
1975 
1976  /// The inheritance list style to use.
1977  /// \version 7
1979 
1980  /// If ``true``, consecutive namespace declarations will be on the same
1981  /// line. If ``false``, each namespace is declared on a new line.
1982  /// \code
1983  /// true:
1984  /// namespace Foo { namespace Bar {
1985  /// }}
1986  ///
1987  /// false:
1988  /// namespace Foo {
1989  /// namespace Bar {
1990  /// }
1991  /// }
1992  /// \endcode
1993  ///
1994  /// If it does not fit on a single line, the overflowing namespaces get
1995  /// wrapped:
1996  /// \code
1997  /// namespace Foo { namespace Bar {
1998  /// namespace Extra {
1999  /// }}}
2000  /// \endcode
2001  /// \version 5
2003 
2004  /// This option is **deprecated**. See ``CurrentLine`` of
2005  /// ``PackConstructorInitializers``.
2006  /// \version 3.7
2008 
2009  /// The number of characters to use for indentation of constructor
2010  /// initializer lists as well as inheritance lists.
2011  /// \version 3.7
2013 
2014  /// Indent width for line continuations.
2015  /// \code
2016  /// ContinuationIndentWidth: 2
2017  ///
2018  /// int i = // VeryVeryVeryVeryVeryLongComment
2019  /// longFunction( // Again a long comment
2020  /// arg);
2021  /// \endcode
2022  /// \version 3.7
2024 
2025  /// If ``true``, format braced lists as best suited for C++11 braced
2026  /// lists.
2027  ///
2028  /// Important differences:
2029  /// - No spaces inside the braced list.
2030  /// - No line break before the closing brace.
2031  /// - Indentation with the continuation indent, not with the block indent.
2032  ///
2033  /// Fundamentally, C++11 braced lists are formatted exactly like function
2034  /// calls would be formatted in their place. If the braced list follows a name
2035  /// (e.g. a type or variable name), clang-format formats as if the ``{}`` were
2036  /// the parentheses of a function call with that name. If there is no name,
2037  /// a zero-length name is assumed.
2038  /// \code
2039  /// true: false:
2040  /// vector<int> x{1, 2, 3, 4}; vs. vector<int> x{ 1, 2, 3, 4 };
2041  /// vector<T> x{{}, {}, {}, {}}; vector<T> x{ {}, {}, {}, {} };
2042  /// f(MyMap[{composite, key}]); f(MyMap[{ composite, key }]);
2043  /// new int[3]{1, 2, 3}; new int[3]{ 1, 2, 3 };
2044  /// \endcode
2045  /// \version 3.4
2047 
2048  /// \brief Analyze the formatted file for the most used line ending (``\r\n``
2049  /// or ``\n``). ``UseCRLF`` is only used as a fallback if none can be derived.
2050  /// \version 11
2052 
2053  /// If ``true``, analyze the formatted file for the most common
2054  /// alignment of ``&`` and ``*``.
2055  /// Pointer and reference alignment styles are going to be updated according
2056  /// to the preferences found in the file.
2057  /// ``PointerAlignment`` is then used only as fallback.
2058  /// \version 3.7
2060 
2061  /// Disables formatting completely.
2062  /// \version 3.7
2064 
2065  /// Different styles for empty line after access modifiers.
2066  /// ``EmptyLineBeforeAccessModifier`` configuration handles the number of
2067  /// empty lines between two access modifiers.
2068  enum EmptyLineAfterAccessModifierStyle : unsigned char {
2069  /// Remove all empty lines after access modifiers.
2070  /// \code
2071  /// struct foo {
2072  /// private:
2073  /// int i;
2074  /// protected:
2075  /// int j;
2076  /// /* comment */
2077  /// public:
2078  /// foo() {}
2079  /// private:
2080  /// protected:
2081  /// };
2082  /// \endcode
2084  /// Keep existing empty lines after access modifiers.
2085  /// MaxEmptyLinesToKeep is applied instead.
2087  /// Always add empty line after access modifiers if there are none.
2088  /// MaxEmptyLinesToKeep is applied also.
2089  /// \code
2090  /// struct foo {
2091  /// private:
2092  ///
2093  /// int i;
2094  /// protected:
2095  ///
2096  /// int j;
2097  /// /* comment */
2098  /// public:
2099  ///
2100  /// foo() {}
2101  /// private:
2102  ///
2103  /// protected:
2104  ///
2105  /// };
2106  /// \endcode
2108  };
2109 
2110  /// Defines when to put an empty line after access modifiers.
2111  /// ``EmptyLineBeforeAccessModifier`` configuration handles the number of
2112  /// empty lines between two access modifiers.
2113  /// \version 14
2115 
2116  /// Different styles for empty line before access modifiers.
2117  enum EmptyLineBeforeAccessModifierStyle : unsigned char {
2118  /// Remove all empty lines before access modifiers.
2119  /// \code
2120  /// struct foo {
2121  /// private:
2122  /// int i;
2123  /// protected:
2124  /// int j;
2125  /// /* comment */
2126  /// public:
2127  /// foo() {}
2128  /// private:
2129  /// protected:
2130  /// };
2131  /// \endcode
2133  /// Keep existing empty lines before access modifiers.
2135  /// Add empty line only when access modifier starts a new logical block.
2136  /// Logical block is a group of one or more member fields or functions.
2137  /// \code
2138  /// struct foo {
2139  /// private:
2140  /// int i;
2141  ///
2142  /// protected:
2143  /// int j;
2144  /// /* comment */
2145  /// public:
2146  /// foo() {}
2147  ///
2148  /// private:
2149  /// protected:
2150  /// };
2151  /// \endcode
2153  /// Always add empty line before access modifiers unless access modifier
2154  /// is at the start of struct or class definition.
2155  /// \code
2156  /// struct foo {
2157  /// private:
2158  /// int i;
2159  ///
2160  /// protected:
2161  /// int j;
2162  /// /* comment */
2163  ///
2164  /// public:
2165  /// foo() {}
2166  ///
2167  /// private:
2168  ///
2169  /// protected:
2170  /// };
2171  /// \endcode
2173  };
2174 
2175  /// Defines in which cases to put empty line before access modifiers.
2176  /// \version 13
2178 
2179  /// If ``true``, clang-format detects whether function calls and
2180  /// definitions are formatted with one parameter per line.
2181  ///
2182  /// Each call can be bin-packed, one-per-line or inconclusive. If it is
2183  /// inconclusive, e.g. completely on one line, but a decision needs to be
2184  /// made, clang-format analyzes whether there are other bin-packed cases in
2185  /// the input file and act accordingly.
2186  ///
2187  /// NOTE: This is an experimental flag, that might go away or be renamed. Do
2188  /// not use this in config files, etc. Use at your own risk.
2189  /// \version 3.7
2191 
2192  /// Different ways to try to fit all constructor initializers on a line.
2193  enum PackConstructorInitializersStyle : unsigned char {
2194  /// Always put each constructor initializer on its own line.
2195  /// \code
2196  /// Constructor()
2197  /// : a(),
2198  /// b()
2199  /// \endcode
2201  /// Bin-pack constructor initializers.
2202  /// \code
2203  /// Constructor()
2204  /// : aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(),
2205  /// cccccccccccccccccccc()
2206  /// \endcode
2208  /// Put all constructor initializers on the current line if they fit.
2209  /// Otherwise, put each one on its own line.
2210  /// \code
2211  /// Constructor() : a(), b()
2212  ///
2213  /// Constructor()
2214  /// : aaaaaaaaaaaaaaaaaaaa(),
2215  /// bbbbbbbbbbbbbbbbbbbb(),
2216  /// ddddddddddddd()
2217  /// \endcode
2219  /// Same as ``PCIS_CurrentLine`` except that if all constructor initializers
2220  /// do not fit on the current line, try to fit them on the next line.
2221  /// \code
2222  /// Constructor() : a(), b()
2223  ///
2224  /// Constructor()
2225  /// : aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(), ddddddddddddd()
2226  ///
2227  /// Constructor()
2228  /// : aaaaaaaaaaaaaaaaaaaa(),
2229  /// bbbbbbbbbbbbbbbbbbbb(),
2230  /// cccccccccccccccccccc()
2231  /// \endcode
2233  };
2234 
2235  /// The pack constructor initializers style to use.
2236  /// \version 14;
2238 
2239  /// If ``true``, clang-format adds missing namespace end comments for
2240  /// short namespaces and fixes invalid existing ones. Short ones are
2241  /// controlled by "ShortNamespaceLines".
2242  /// \code
2243  /// true: false:
2244  /// namespace a { vs. namespace a {
2245  /// foo(); foo();
2246  /// bar(); bar();
2247  /// } // namespace a }
2248  /// \endcode
2249  /// \version 5
2251 
2252  /// A vector of macros that should be interpreted as foreach loops
2253  /// instead of as function calls.
2254  ///
2255  /// These are expected to be macros of the form:
2256  /// \code
2257  /// FOREACH(<variable-declaration>, ...)
2258  /// <loop-body>
2259  /// \endcode
2260  ///
2261  /// In the .clang-format configuration file, this can be configured like:
2262  /// \code{.yaml}
2263  /// ForEachMacros: ['RANGES_FOR', 'FOREACH']
2264  /// \endcode
2265  ///
2266  /// For example: BOOST_FOREACH.
2267  /// \version 3.7
2268  std::vector<std::string> ForEachMacros;
2269 
2270  /// A vector of macros that should be interpreted as conditionals
2271  /// instead of as function calls.
2272  ///
2273  /// These are expected to be macros of the form:
2274  /// \code
2275  /// IF(...)
2276  /// <conditional-body>
2277  /// else IF(...)
2278  /// <conditional-body>
2279  /// \endcode
2280  ///
2281  /// In the .clang-format configuration file, this can be configured like:
2282  /// \code{.yaml}
2283  /// IfMacros: ['IF']
2284  /// \endcode
2285  ///
2286  /// For example: `KJ_IF_MAYBE
2287  /// <https://github.com/capnproto/capnproto/blob/master/kjdoc/tour.md#maybes>`_
2288  /// \version 14
2289  std::vector<std::string> IfMacros;
2290 
2291  /// \brief A vector of macros that should be interpreted as type declarations
2292  /// instead of as function calls.
2293  ///
2294  /// These are expected to be macros of the form:
2295  /// \code
2296  /// STACK_OF(...)
2297  /// \endcode
2298  ///
2299  /// In the .clang-format configuration file, this can be configured like:
2300  /// \code{.yaml}
2301  /// TypenameMacros: ['STACK_OF', 'LIST']
2302  /// \endcode
2303  ///
2304  /// For example: OpenSSL STACK_OF, BSD LIST_ENTRY.
2305  /// \version 9
2306  std::vector<std::string> TypenameMacros;
2307 
2308  /// A vector of macros that should be interpreted as complete
2309  /// statements.
2310  ///
2311  /// Typical macros are expressions, and require a semi-colon to be
2312  /// added; sometimes this is not the case, and this allows to make
2313  /// clang-format aware of such cases.
2314  ///
2315  /// For example: Q_UNUSED
2316  /// \version 8
2317  std::vector<std::string> StatementMacros;
2318 
2319  /// A vector of macros which are used to open namespace blocks.
2320  ///
2321  /// These are expected to be macros of the form:
2322  /// \code
2323  /// NAMESPACE(<namespace-name>, ...) {
2324  /// <namespace-content>
2325  /// }
2326  /// \endcode
2327  ///
2328  /// For example: TESTSUITE
2329  /// \version 9
2330  std::vector<std::string> NamespaceMacros;
2331 
2332  /// A vector of macros which are whitespace-sensitive and should not
2333  /// be touched.
2334  ///
2335  /// These are expected to be macros of the form:
2336  /// \code
2337  /// STRINGIZE(...)
2338  /// \endcode
2339  ///
2340  /// In the .clang-format configuration file, this can be configured like:
2341  /// \code{.yaml}
2342  /// WhitespaceSensitiveMacros: ['STRINGIZE', 'PP_STRINGIZE']
2343  /// \endcode
2344  ///
2345  /// For example: BOOST_PP_STRINGIZE
2346  /// \version 12
2347  std::vector<std::string> WhitespaceSensitiveMacros;
2348 
2350 
2351  /// Specify whether access modifiers should have their own indentation level.
2352  ///
2353  /// When ``false``, access modifiers are indented (or outdented) relative to
2354  /// the record members, respecting the ``AccessModifierOffset``. Record
2355  /// members are indented one level below the record.
2356  /// When ``true``, access modifiers get their own indentation level. As a
2357  /// consequence, record members are always indented 2 levels below the record,
2358  /// regardless of the access modifier presence. Value of the
2359  /// ``AccessModifierOffset`` is ignored.
2360  /// \code
2361  /// false: true:
2362  /// class C { vs. class C {
2363  /// class D { class D {
2364  /// void bar(); void bar();
2365  /// protected: protected:
2366  /// D(); D();
2367  /// }; };
2368  /// public: public:
2369  /// C(); C();
2370  /// }; };
2371  /// void foo() { void foo() {
2372  /// return 1; return 1;
2373  /// } }
2374  /// \endcode
2375  /// \version 13
2377 
2378  /// Indent case labels one level from the switch statement.
2379  ///
2380  /// When ``false``, use the same indentation level as for the switch
2381  /// statement. Switch statement body is always indented one level more than
2382  /// case labels (except the first block following the case label, which
2383  /// itself indents the code - unless IndentCaseBlocks is enabled).
2384  /// \code
2385  /// false: true:
2386  /// switch (fool) { vs. switch (fool) {
2387  /// case 1: case 1:
2388  /// bar(); bar();
2389  /// break; break;
2390  /// default: default:
2391  /// plop(); plop();
2392  /// } }
2393  /// \endcode
2394  /// \version 3.3
2396 
2397  /// Indent case label blocks one level from the case label.
2398  ///
2399  /// When ``false``, the block following the case label uses the same
2400  /// indentation level as for the case label, treating the case label the same
2401  /// as an if-statement.
2402  /// When ``true``, the block gets indented as a scope block.
2403  /// \code
2404  /// false: true:
2405  /// switch (fool) { vs. switch (fool) {
2406  /// case 1: { case 1:
2407  /// bar(); {
2408  /// } break; bar();
2409  /// default: { }
2410  /// plop(); break;
2411  /// } default:
2412  /// } {
2413  /// plop();
2414  /// }
2415  /// }
2416  /// \endcode
2417  /// \version 11
2419 
2420  /// Indent goto labels.
2421  ///
2422  /// When ``false``, goto labels are flushed left.
2423  /// \code
2424  /// true: false:
2425  /// int f() { vs. int f() {
2426  /// if (foo()) { if (foo()) {
2427  /// label1: label1:
2428  /// bar(); bar();
2429  /// } }
2430  /// label2: label2:
2431  /// return 1; return 1;
2432  /// } }
2433  /// \endcode
2434  /// \version 10
2436 
2437  /// Options for indenting preprocessor directives.
2438  enum PPDirectiveIndentStyle : unsigned char {
2439  /// Does not indent any directives.
2440  /// \code
2441  /// #if FOO
2442  /// #if BAR
2443  /// #include <foo>
2444  /// #endif
2445  /// #endif
2446  /// \endcode
2448  /// Indents directives after the hash.
2449  /// \code
2450  /// #if FOO
2451  /// # if BAR
2452  /// # include <foo>
2453  /// # endif
2454  /// #endif
2455  /// \endcode
2457  /// Indents directives before the hash.
2458  /// \code
2459  /// #if FOO
2460  /// #if BAR
2461  /// #include <foo>
2462  /// #endif
2463  /// #endif
2464  /// \endcode
2466  };
2467 
2468  /// The preprocessor directive indenting style to use.
2469  /// \version 6
2471 
2472  /// Indents extern blocks
2473  enum IndentExternBlockStyle : unsigned char {
2474  /// Backwards compatible with AfterExternBlock's indenting.
2475  /// \code
2476  /// IndentExternBlock: AfterExternBlock
2477  /// BraceWrapping.AfterExternBlock: true
2478  /// extern "C"
2479  /// {
2480  /// void foo();
2481  /// }
2482  /// \endcode
2483  ///
2484  /// \code
2485  /// IndentExternBlock: AfterExternBlock
2486  /// BraceWrapping.AfterExternBlock: false
2487  /// extern "C" {
2488  /// void foo();
2489  /// }
2490  /// \endcode
2492  /// Does not indent extern blocks.
2493  /// \code
2494  /// extern "C" {
2495  /// void foo();
2496  /// }
2497  /// \endcode
2499  /// Indents extern blocks.
2500  /// \code
2501  /// extern "C" {
2502  /// void foo();
2503  /// }
2504  /// \endcode
2506  };
2507 
2508  /// IndentExternBlockStyle is the type of indenting of extern blocks.
2509  /// \version 12
2511 
2512  /// Indent the requires clause in a template
2513  /// \code
2514  /// true:
2515  /// template <typename It>
2516  /// requires Iterator<It>
2517  /// void sort(It begin, It end) {
2518  /// //....
2519  /// }
2520  ///
2521  /// false:
2522  /// template <typename It>
2523  /// requires Iterator<It>
2524  /// void sort(It begin, It end) {
2525  /// //....
2526  /// }
2527  /// \endcode
2528  /// \version 13
2530 
2531  /// The number of columns to use for indentation.
2532  /// \code
2533  /// IndentWidth: 3
2534  ///
2535  /// void f() {
2536  /// someFunction();
2537  /// if (true, false) {
2538  /// f();
2539  /// }
2540  /// }
2541  /// \endcode
2542  /// \version 3.7
2543  unsigned IndentWidth;
2544 
2545  /// Indent if a function definition or declaration is wrapped after the
2546  /// type.
2547  /// \code
2548  /// true:
2549  /// LoooooooooooooooooooooooooooooooooooooooongReturnType
2550  /// LoooooooooooooooooooooooooooooooongFunctionDeclaration();
2551  ///
2552  /// false:
2553  /// LoooooooooooooooooooooooooooooooooooooooongReturnType
2554  /// LoooooooooooooooooooooooooooooooongFunctionDeclaration();
2555  /// \endcode
2556  /// \version 3.7
2558 
2559  /// A vector of prefixes ordered by the desired groups for Java imports.
2560  ///
2561  /// One group's prefix can be a subset of another - the longest prefix is
2562  /// always matched. Within a group, the imports are ordered lexicographically.
2563  /// Static imports are grouped separately and follow the same group rules.
2564  /// By default, static imports are placed before non-static imports,
2565  /// but this behavior is changed by another option,
2566  /// ``SortJavaStaticImport``.
2567  ///
2568  /// In the .clang-format configuration file, this can be configured like
2569  /// in the following yaml example. This will result in imports being
2570  /// formatted as in the Java example below.
2571  /// \code{.yaml}
2572  /// JavaImportGroups: ['com.example', 'com', 'org']
2573  /// \endcode
2574  ///
2575  /// \code{.java}
2576  /// import static com.example.function1;
2577  ///
2578  /// import static com.test.function2;
2579  ///
2580  /// import static org.example.function3;
2581  ///
2582  /// import com.example.ClassA;
2583  /// import com.example.Test;
2584  /// import com.example.a.ClassB;
2585  ///
2586  /// import com.test.ClassC;
2587  ///
2588  /// import org.example.ClassD;
2589  /// \endcode
2590  /// \version 8
2591  std::vector<std::string> JavaImportGroups;
2592 
2593  /// Quotation styles for JavaScript strings. Does not affect template
2594  /// strings.
2595  enum JavaScriptQuoteStyle : unsigned char {
2596  /// Leave string quotes as they are.
2597  /// \code{.js}
2598  /// string1 = "foo";
2599  /// string2 = 'bar';
2600  /// \endcode
2602  /// Always use single quotes.
2603  /// \code{.js}
2604  /// string1 = 'foo';
2605  /// string2 = 'bar';
2606  /// \endcode
2608  /// Always use double quotes.
2609  /// \code{.js}
2610  /// string1 = "foo";
2611  /// string2 = "bar";
2612  /// \endcode
2614  };
2615 
2616  /// The JavaScriptQuoteStyle to use for JavaScript strings.
2617  /// \version 3.9
2619 
2620  // clang-format off
2621  /// Whether to wrap JavaScript import/export statements.
2622  /// \code{.js}
2623  /// true:
2624  /// import {
2625  /// VeryLongImportsAreAnnoying,
2626  /// VeryLongImportsAreAnnoying,
2627  /// VeryLongImportsAreAnnoying,
2628  /// } from 'some/module.js'
2629  ///
2630  /// false:
2631  /// import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from "some/module.js"
2632  /// \endcode
2633  /// \version 3.9
2635  // clang-format on
2636 
2637  /// If true, the empty line at the start of blocks is kept.
2638  /// \code
2639  /// true: false:
2640  /// if (foo) { vs. if (foo) {
2641  /// bar();
2642  /// bar(); }
2643  /// }
2644  /// \endcode
2645  /// \version 3.7
2647 
2648  /// Supported languages.
2649  ///
2650  /// When stored in a configuration file, specifies the language, that the
2651  /// configuration targets. When passed to the ``reformat()`` function, enables
2652  /// syntax features specific to the language.
2653  enum LanguageKind : unsigned char {
2654  /// Do not use.
2656  /// Should be used for C, C++.
2658  /// Should be used for C#.
2660  /// Should be used for Java.
2662  /// Should be used for JavaScript.
2664  /// Should be used for JSON.
2666  /// Should be used for Objective-C, Objective-C++.
2668  /// Should be used for Protocol Buffers
2669  /// (https://developers.google.com/protocol-buffers/).
2671  /// Should be used for TableGen code.
2673  /// Should be used for Protocol Buffer messages in text format
2674  /// (https://developers.google.com/protocol-buffers/).
2676  };
2677  bool isCpp() const { return Language == LK_Cpp || Language == LK_ObjC; }
2678  bool isCSharp() const { return Language == LK_CSharp; }
2679  bool isJson() const { return Language == LK_Json; }
2680  bool isJavaScript() const { return Language == LK_JavaScript; }
2681 
2682  /// Language, this format style is targeted at.
2683  /// \version 3.5
2685 
2686  /// Indentation logic for lambda bodies.
2687  enum LambdaBodyIndentationKind : unsigned char {
2688  /// Align lambda body relative to the lambda signature. This is the default.
2689  /// \code
2690  /// someMethod(
2691  /// [](SomeReallyLongLambdaSignatureArgument foo) {
2692  /// return;
2693  /// });
2694  /// \endcode
2696  /// Align lambda body relative to the indentation level of the outer scope
2697  /// the lambda signature resides in.
2698  /// \code
2699  /// someMethod(
2700  /// [](SomeReallyLongLambdaSignatureArgument foo) {
2701  /// return;
2702  /// });
2703  /// \endcode
2705  };
2706 
2707  /// The indentation style of lambda bodies. ``Signature`` (the default)
2708  /// causes the lambda body to be indented one additional level relative to
2709  /// the indentation level of the signature. ``OuterScope`` forces the lambda
2710  /// body to be indented one additional level relative to the parent scope
2711  /// containing the lambda signature. For callback-heavy code, it may improve
2712  /// readability to have the signature indented two levels and to use
2713  /// ``OuterScope``. The KJ style guide requires ``OuterScope``.
2714  /// `KJ style guide
2715  /// <https://github.com/capnproto/capnproto/blob/master/style-guide.md>`_
2716  /// \version 13
2718 
2719  /// A regular expression matching macros that start a block.
2720  /// \code
2721  /// # With:
2722  /// MacroBlockBegin: "^NS_MAP_BEGIN|\
2723  /// NS_TABLE_HEAD$"
2724  /// MacroBlockEnd: "^\
2725  /// NS_MAP_END|\
2726  /// NS_TABLE_.*_END$"
2727  ///
2728  /// NS_MAP_BEGIN
2729  /// foo();
2730  /// NS_MAP_END
2731  ///
2732  /// NS_TABLE_HEAD
2733  /// bar();
2734  /// NS_TABLE_FOO_END
2735  ///
2736  /// # Without:
2737  /// NS_MAP_BEGIN
2738  /// foo();
2739  /// NS_MAP_END
2740  ///
2741  /// NS_TABLE_HEAD
2742  /// bar();
2743  /// NS_TABLE_FOO_END
2744  /// \endcode
2745  /// \version 3.7
2747 
2748  /// A regular expression matching macros that end a block.
2749  /// \version 3.7
2751 
2752  /// The maximum number of consecutive empty lines to keep.
2753  /// \code
2754  /// MaxEmptyLinesToKeep: 1 vs. MaxEmptyLinesToKeep: 0
2755  /// int f() { int f() {
2756  /// int = 1; int i = 1;
2757  /// i = foo();
2758  /// i = foo(); return i;
2759  /// }
2760  /// return i;
2761  /// }
2762  /// \endcode
2763  /// \version 3.7
2765 
2766  /// Different ways to indent namespace contents.
2767  enum NamespaceIndentationKind : unsigned char {
2768  /// Don't indent in namespaces.
2769  /// \code
2770  /// namespace out {
2771  /// int i;
2772  /// namespace in {
2773  /// int i;
2774  /// }
2775  /// }
2776  /// \endcode
2778  /// Indent only in inner namespaces (nested in other namespaces).
2779  /// \code
2780  /// namespace out {
2781  /// int i;
2782  /// namespace in {
2783  /// int i;
2784  /// }
2785  /// }
2786  /// \endcode
2788  /// Indent in all namespaces.
2789  /// \code
2790  /// namespace out {
2791  /// int i;
2792  /// namespace in {
2793  /// int i;
2794  /// }
2795  /// }
2796  /// \endcode
2798  };
2799 
2800  /// The indentation used for namespaces.
2801  /// \version 3.7
2803 
2804  /// Controls bin-packing Objective-C protocol conformance list
2805  /// items into as few lines as possible when they go over ``ColumnLimit``.
2806  ///
2807  /// If ``Auto`` (the default), delegates to the value in
2808  /// ``BinPackParameters``. If that is ``true``, bin-packs Objective-C
2809  /// protocol conformance list items into as few lines as possible
2810  /// whenever they go over ``ColumnLimit``.
2811  ///
2812  /// If ``Always``, always bin-packs Objective-C protocol conformance
2813  /// list items into as few lines as possible whenever they go over
2814  /// ``ColumnLimit``.
2815  ///
2816  /// If ``Never``, lays out Objective-C protocol conformance list items
2817  /// onto individual lines whenever they go over ``ColumnLimit``.
2818  ///
2819  /// \code{.objc}
2820  /// Always (or Auto, if BinPackParameters=true):
2821  /// @interface ccccccccccccc () <
2822  /// ccccccccccccc, ccccccccccccc,
2823  /// ccccccccccccc, ccccccccccccc> {
2824  /// }
2825  ///
2826  /// Never (or Auto, if BinPackParameters=false):
2827  /// @interface ddddddddddddd () <
2828  /// ddddddddddddd,
2829  /// ddddddddddddd,
2830  /// ddddddddddddd,
2831  /// ddddddddddddd> {
2832  /// }
2833  /// \endcode
2834  /// \version 7
2836 
2837  /// The number of characters to use for indentation of ObjC blocks.
2838  /// \code{.objc}
2839  /// ObjCBlockIndentWidth: 4
2840  ///
2841  /// [operation setCompletionBlock:^{
2842  /// [self onOperationDone];
2843  /// }];
2844  /// \endcode
2845  /// \version 3.7
2847 
2848  /// Add a space after ``@property`` in Objective-C, i.e. use
2849  /// ``@property (readonly)`` instead of ``@property(readonly)``.
2850  /// \version 3.7
2852 
2853  /// Break parameters list into lines when there is nested block
2854  /// parameters in a function call.
2855  /// \code
2856  /// false:
2857  /// - (void)_aMethod
2858  /// {
2859  /// [self.test1 t:self w:self callback:^(typeof(self) self, NSNumber
2860  /// *u, NSNumber *v) {
2861  /// u = c;
2862  /// }]
2863  /// }
2864  /// true:
2865  /// - (void)_aMethod
2866  /// {
2867  /// [self.test1 t:self
2868  /// w:self
2869  /// callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
2870  /// u = c;
2871  /// }]
2872  /// }
2873  /// \endcode
2874  /// \version 12
2876 
2877  /// Add a space in front of an Objective-C protocol list, i.e. use
2878  /// ``Foo <Protocol>`` instead of ``Foo<Protocol>``.
2879  /// \version 3.7
2881 
2882  /// The penalty for breaking around an assignment operator.
2883  /// \version 5
2885 
2886  /// The penalty for breaking a function call after ``call(``.
2887  /// \version 3.7
2889 
2890  /// The penalty for each line break introduced inside a comment.
2891  /// \version 3.7
2893 
2894  /// The penalty for breaking before the first ``<<``.
2895  /// \version 3.7
2897 
2898  /// The penalty for breaking after ``(``.
2899  /// \version 14
2901 
2902  /// The penalty for each line break introduced inside a string literal.
2903  /// \version 3.7
2905 
2906  /// The penalty for breaking after template declaration.
2907  /// \version 7
2909 
2910  /// The penalty for each character outside of the column limit.
2911  /// \version 3.7
2913 
2914  /// Penalty for putting the return type of a function onto its own
2915  /// line.
2916  /// \version 3.7
2918 
2919  /// Penalty for each character of whitespace indentation
2920  /// (counted relative to leading non-whitespace column).
2921  /// \version 12
2923 
2924  /// The ``&``, ``&&`` and ``*`` alignment style.
2925  enum PointerAlignmentStyle : unsigned char {
2926  /// Align pointer to the left.
2927  /// \code
2928  /// int* a;
2929  /// \endcode
2931  /// Align pointer to the right.
2932  /// \code
2933  /// int *a;
2934  /// \endcode
2936  /// Align pointer in the middle.
2937  /// \code
2938  /// int * a;
2939  /// \endcode
2941  };
2942 
2943  /// Pointer and reference alignment style.
2944  /// \version 3.7
2946 
2947  /// The number of columns to use for indentation of preprocessor statements.
2948  /// When set to -1 (default) ``IndentWidth`` is used also for preprocessor
2949  /// statements.
2950  /// \code
2951  /// PPIndentWidth: 1
2952  ///
2953  /// #ifdef __linux__
2954  /// # define FOO
2955  /// #else
2956  /// # define BAR
2957  /// #endif
2958  /// \endcode
2959  /// \version 14
2961 
2962  /// See documentation of ``RawStringFormats``.
2964  /// The language of this raw string.
2966  /// A list of raw string delimiters that match this language.
2967  std::vector<std::string> Delimiters;
2968  /// A list of enclosing function names that match this language.
2969  std::vector<std::string> EnclosingFunctions;
2970  /// The canonical delimiter for this language.
2972  /// The style name on which this raw string format is based on.
2973  /// If not specified, the raw string format is based on the style that this
2974  /// format is based on.
2976  bool operator==(const RawStringFormat &Other) const {
2977  return Language == Other.Language && Delimiters == Other.Delimiters &&
2980  BasedOnStyle == Other.BasedOnStyle;
2981  }
2982  };
2983 
2984  /// Defines hints for detecting supported languages code blocks in raw
2985  /// strings.
2986  ///
2987  /// A raw string with a matching delimiter or a matching enclosing function
2988  /// name will be reformatted assuming the specified language based on the
2989  /// style for that language defined in the .clang-format file. If no style has
2990  /// been defined in the .clang-format file for the specific language, a
2991  /// predefined style given by 'BasedOnStyle' is used. If 'BasedOnStyle' is not
2992  /// found, the formatting is based on llvm style. A matching delimiter takes
2993  /// precedence over a matching enclosing function name for determining the
2994  /// language of the raw string contents.
2995  ///
2996  /// If a canonical delimiter is specified, occurrences of other delimiters for
2997  /// the same language will be updated to the canonical if possible.
2998  ///
2999  /// There should be at most one specification per language and each delimiter
3000  /// and enclosing function should not occur in multiple specifications.
3001  ///
3002  /// To configure this in the .clang-format file, use:
3003  /// \code{.yaml}
3004  /// RawStringFormats:
3005  /// - Language: TextProto
3006  /// Delimiters:
3007  /// - 'pb'
3008  /// - 'proto'
3009  /// EnclosingFunctions:
3010  /// - 'PARSE_TEXT_PROTO'
3011  /// BasedOnStyle: google
3012  /// - Language: Cpp
3013  /// Delimiters:
3014  /// - 'cc'
3015  /// - 'cpp'
3016  /// BasedOnStyle: llvm
3017  /// CanonicalDelimiter: 'cc'
3018  /// \endcode
3019  /// \version 6
3020  std::vector<RawStringFormat> RawStringFormats;
3021 
3022  /// \brief The ``&`` and ``&&`` alignment style.
3024  /// Align reference like ``PointerAlignment``.
3026  /// Align reference to the left.
3027  /// \code
3028  /// int& a;
3029  /// \endcode
3031  /// Align reference to the right.
3032  /// \code
3033  /// int &a;
3034  /// \endcode
3036  /// Align reference in the middle.
3037  /// \code
3038  /// int & a;
3039  /// \endcode
3041  };
3042 
3043  /// \brief Reference alignment style (overrides ``PointerAlignment`` for
3044  /// references).
3045  /// \version 14
3047 
3048  // clang-format off
3049  /// If ``true``, clang-format will attempt to re-flow comments.
3050  /// \code
3051  /// false:
3052  /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3053  /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
3054  ///
3055  /// true:
3056  /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3057  /// // information
3058  /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3059  /// * information */
3060  /// \endcode
3061  /// \version 4
3063  // clang-format on
3064 
3065  /// Remove optional braces of control statements (``if``, ``else``, ``for``,
3066  /// and ``while``) in C++ according to the LLVM coding style.
3067  /// \warning
3068  /// This option will be renamed and expanded to support other styles.
3069  /// \endwarning
3070  /// \warning
3071  /// Setting this option to `true` could lead to incorrect code formatting due
3072  /// to clang-format's lack of complete semantic information. As such, extra
3073  /// care should be taken to review code changes made by this option.
3074  /// \endwarning
3075  /// \code
3076  /// false: true:
3077  ///
3078  /// if (isa<FunctionDecl>(D)) { vs. if (isa<FunctionDecl>(D))
3079  /// handleFunctionDecl(D); handleFunctionDecl(D);
3080  /// } else if (isa<VarDecl>(D)) { else if (isa<VarDecl>(D))
3081  /// handleVarDecl(D); handleVarDecl(D);
3082  /// }
3083  ///
3084  /// if (isa<VarDecl>(D)) { vs. if (isa<VarDecl>(D)) {
3085  /// for (auto *A : D.attrs()) { for (auto *A : D.attrs())
3086  /// if (shouldProcessAttr(A)) { if (shouldProcessAttr(A))
3087  /// handleAttr(A); handleAttr(A);
3088  /// } }
3089  /// }
3090  /// }
3091  ///
3092  /// if (isa<FunctionDecl>(D)) { vs. if (isa<FunctionDecl>(D))
3093  /// for (auto *A : D.attrs()) { for (auto *A : D.attrs())
3094  /// handleAttr(A); handleAttr(A);
3095  /// }
3096  /// }
3097  ///
3098  /// if (auto *D = (T)(D)) { vs. if (auto *D = (T)(D)) {
3099  /// if (shouldProcess(D)) { if (shouldProcess(D))
3100  /// handleVarDecl(D); handleVarDecl(D);
3101  /// } else { else
3102  /// markAsIgnored(D); markAsIgnored(D);
3103  /// } }
3104  /// }
3105  ///
3106  /// if (a) { vs. if (a)
3107  /// b(); b();
3108  /// } else { else if (c)
3109  /// if (c) { d();
3110  /// d(); else
3111  /// } else { e();
3112  /// e();
3113  /// }
3114  /// }
3115  /// \endcode
3116  /// \version 14
3118 
3119  /// \brief The style if definition blocks should be separated.
3121  /// Leave definition blocks as they are.
3123  /// Insert an empty line between definition blocks.
3125  /// Remove any empty line between definition blocks.
3127  };
3128 
3129  /// Specifies the use of empty lines to separate definition blocks, including
3130  /// classes, structs, enums, and functions.
3131  /// \code
3132  /// Never v.s. Always
3133  /// #include <cstring> #include <cstring>
3134  /// struct Foo {
3135  /// int a, b, c; struct Foo {
3136  /// }; int a, b, c;
3137  /// namespace Ns { };
3138  /// class Bar {
3139  /// public: namespace Ns {
3140  /// struct Foobar { class Bar {
3141  /// int a; public:
3142  /// int b; struct Foobar {
3143  /// }; int a;
3144  /// private: int b;
3145  /// int t; };
3146  /// int method1() {
3147  /// // ... private:
3148  /// } int t;
3149  /// enum List {
3150  /// ITEM1, int method1() {
3151  /// ITEM2 // ...
3152  /// }; }
3153  /// template<typename T>
3154  /// int method2(T x) { enum List {
3155  /// // ... ITEM1,
3156  /// } ITEM2
3157  /// int i, j, k; };
3158  /// int method3(int par) {
3159  /// // ... template<typename T>
3160  /// } int method2(T x) {
3161  /// }; // ...
3162  /// class C {}; }
3163  /// }
3164  /// int i, j, k;
3165  ///
3166  /// int method3(int par) {
3167  /// // ...
3168  /// }
3169  /// };
3170  ///
3171  /// class C {};
3172  /// }
3173  /// \endcode
3174  /// \version 14
3176 
3177  /// The maximal number of unwrapped lines that a short namespace spans.
3178  /// Defaults to 1.
3179  ///
3180  /// This determines the maximum length of short namespaces by counting
3181  /// unwrapped lines (i.e. containing neither opening nor closing
3182  /// namespace brace) and makes "FixNamespaceComments" omit adding
3183  /// end comments for those.
3184  /// \code
3185  /// ShortNamespaceLines: 1 vs. ShortNamespaceLines: 0
3186  /// namespace a { namespace a {
3187  /// int foo; int foo;
3188  /// } } // namespace a
3189  ///
3190  /// ShortNamespaceLines: 1 vs. ShortNamespaceLines: 0
3191  /// namespace b { namespace b {
3192  /// int foo; int foo;
3193  /// int bar; int bar;
3194  /// } // namespace b } // namespace b
3195  /// \endcode
3196  /// \version 14
3198 
3199  /// Include sorting options.
3200  enum SortIncludesOptions : unsigned char {
3201  /// Includes are never sorted.
3202  /// \code
3203  /// #include "B/A.h"
3204  /// #include "A/B.h"
3205  /// #include "a/b.h"
3206  /// #include "A/b.h"
3207  /// #include "B/a.h"
3208  /// \endcode
3210  /// Includes are sorted in an ASCIIbetical or case sensitive fashion.
3211  /// \code
3212  /// #include "A/B.h"
3213  /// #include "A/b.h"
3214  /// #include "B/A.h"
3215  /// #include "B/a.h"
3216  /// #include "a/b.h"
3217  /// \endcode
3219  /// Includes are sorted in an alphabetical or case insensitive fashion.
3220  /// \code
3221  /// #include "A/B.h"
3222  /// #include "A/b.h"
3223  /// #include "a/b.h"
3224  /// #include "B/A.h"
3225  /// #include "B/a.h"
3226  /// \endcode
3228  };
3229 
3230  /// Controls if and how clang-format will sort ``#includes``.
3231  /// If ``Never``, includes are never sorted.
3232  /// If ``CaseInsensitive``, includes are sorted in an ASCIIbetical or case
3233  /// insensitive fashion.
3234  /// If ``CaseSensitive``, includes are sorted in an alphabetical or case
3235  /// sensitive fashion.
3236  /// \version 4
3238 
3239  /// Position for Java Static imports.
3240  enum SortJavaStaticImportOptions : unsigned char {
3241  /// Static imports are placed before non-static imports.
3242  /// \code{.java}
3243  /// import static org.example.function1;
3244  ///
3245  /// import org.example.ClassA;
3246  /// \endcode
3248  /// Static imports are placed after non-static imports.
3249  /// \code{.java}
3250  /// import org.example.ClassA;
3251  ///
3252  /// import static org.example.function1;
3253  /// \endcode
3255  };
3256 
3257  /// When sorting Java imports, by default static imports are placed before
3258  /// non-static imports. If ``JavaStaticImportAfterImport`` is ``After``,
3259  /// static imports are placed after non-static imports.
3260  /// \version 12
3262 
3263  /// If ``true``, clang-format will sort using declarations.
3264  ///
3265  /// The order of using declarations is defined as follows:
3266  /// Split the strings by "::" and discard any initial empty strings. The last
3267  /// element of each list is a non-namespace name; all others are namespace
3268  /// names. Sort the lists of names lexicographically, where the sort order of
3269  /// individual names is that all non-namespace names come before all namespace
3270  /// names, and within those groups, names are in case-insensitive
3271  /// lexicographic order.
3272  /// \code
3273  /// false: true:
3274  /// using std::cout; vs. using std::cin;
3275  /// using std::cin; using std::cout;
3276  /// \endcode
3277  /// \version 5
3279 
3280  /// If ``true``, a space is inserted after C style casts.
3281  /// \code
3282  /// true: false:
3283  /// (int) i; vs. (int)i;
3284  /// \endcode
3285  /// \version 3.5
3287 
3288  /// If ``true``, a space is inserted after the logical not operator (``!``).
3289  /// \code
3290  /// true: false:
3291  /// ! someExpression(); vs. !someExpression();
3292  /// \endcode
3293  /// \version 9
3295 
3296  /// If \c true, a space will be inserted after the 'template' keyword.
3297  /// \code
3298  /// true: false:
3299  /// template <int> void foo(); vs. template<int> void foo();
3300  /// \endcode
3301  /// \version 4
3303 
3304  /// Different ways to put a space before opening parentheses.
3305  enum SpaceAroundPointerQualifiersStyle : unsigned char {
3306  /// Don't ensure spaces around pointer qualifiers and use PointerAlignment
3307  /// instead.
3308  /// \code
3309  /// PointerAlignment: Left PointerAlignment: Right
3310  /// void* const* x = NULL; vs. void *const *x = NULL;
3311  /// \endcode
3313  /// Ensure that there is a space before pointer qualifiers.
3314  /// \code
3315  /// PointerAlignment: Left PointerAlignment: Right
3316  /// void* const* x = NULL; vs. void * const *x = NULL;
3317  /// \endcode
3319  /// Ensure that there is a space after pointer qualifiers.
3320  /// \code
3321  /// PointerAlignment: Left PointerAlignment: Right
3322  /// void* const * x = NULL; vs. void *const *x = NULL;
3323  /// \endcode
3325  /// Ensure that there is a space both before and after pointer qualifiers.
3326  /// \code
3327  /// PointerAlignment: Left PointerAlignment: Right
3328  /// void* const * x = NULL; vs. void * const *x = NULL;
3329  /// \endcode
3331  };
3332 
3333  /// Defines in which cases to put a space before or after pointer qualifiers
3334  /// \version 12
3336 
3337  /// If ``false``, spaces will be removed before assignment operators.
3338  /// \code
3339  /// true: false:
3340  /// int a = 5; vs. int a= 5;
3341  /// a += 42; a+= 42;
3342  /// \endcode
3343  /// \version 3.7
3345 
3346  /// If ``false``, spaces will be removed before case colon.
3347  /// \code
3348  /// true: false
3349  /// switch (x) { vs. switch (x) {
3350  /// case 1 : break; case 1: break;
3351  /// } }
3352  /// \endcode
3353  /// \version 12
3355 
3356  /// If ``true``, a space will be inserted before a C++11 braced list
3357  /// used to initialize an object (after the preceding identifier or type).
3358  /// \code
3359  /// true: false:
3360  /// Foo foo { bar }; vs. Foo foo{ bar };
3361  /// Foo {}; Foo{};
3362  /// vector<int> { 1, 2, 3 }; vector<int>{ 1, 2, 3 };
3363  /// new int[3] { 1, 2, 3 }; new int[3]{ 1, 2, 3 };
3364  /// \endcode
3365  /// \version 7
3367 
3368  /// If ``false``, spaces will be removed before constructor initializer
3369  /// colon.
3370  /// \code
3371  /// true: false:
3372  /// Foo::Foo() : a(a) {} Foo::Foo(): a(a) {}
3373  /// \endcode
3374  /// \version 7
3376 
3377  /// If ``false``, spaces will be removed before inheritance colon.
3378  /// \code
3379  /// true: false:
3380  /// class Foo : Bar {} vs. class Foo: Bar {}
3381  /// \endcode
3382  /// \version 7
3384 
3385  /// Different ways to put a space before opening parentheses.
3386  enum SpaceBeforeParensStyle : unsigned char {
3387  /// Never put a space before opening parentheses.
3388  /// \code
3389  /// void f() {
3390  /// if(true) {
3391  /// f();
3392  /// }
3393  /// }
3394  /// \endcode
3396  /// Put a space before opening parentheses only after control statement
3397  /// keywords (``for/if/while...``).
3398  /// \code
3399  /// void f() {
3400  /// if (true) {
3401  /// f();
3402  /// }
3403  /// }
3404  /// \endcode
3406  /// Same as ``SBPO_ControlStatements`` except this option doesn't apply to
3407  /// ForEach and If macros. This is useful in projects where ForEach/If
3408  /// macros are treated as function calls instead of control statements.
3409  /// ``SBPO_ControlStatementsExceptForEachMacros`` remains an alias for
3410  /// backward compatibility.
3411  /// \code
3412  /// void f() {
3413  /// Q_FOREACH(...) {
3414  /// f();
3415  /// }
3416  /// }
3417  /// \endcode
3419  /// Put a space before opening parentheses only if the parentheses are not
3420  /// empty i.e. '()'
3421  /// \code
3422  /// void() {
3423  /// if (true) {
3424  /// f();
3425  /// g (x, y, z);
3426  /// }
3427  /// }
3428  /// \endcode
3430  /// Always put a space before opening parentheses, except when it's
3431  /// prohibited by the syntax rules (in function-like macro definitions) or
3432  /// when determined by other style rules (after unary operators, opening
3433  /// parentheses, etc.)
3434  /// \code
3435  /// void f () {
3436  /// if (true) {
3437  /// f ();
3438  /// }
3439  /// }
3440  /// \endcode
3442  /// Configure each individual space before parentheses in
3443  /// `SpaceBeforeParensOptions`.
3445  };
3446 
3447  /// Defines in which cases to put a space before opening parentheses.
3448  /// \version 3.5
3450 
3451  /// Precise control over the spacing before parentheses.
3452  /// \code
3453  /// # Should be declared this way:
3454  /// SpaceBeforeParens: Custom
3455  /// SpaceBeforeParensOptions:
3456  /// AfterControlStatements: true
3457  /// AfterFunctionDefinitionName: true
3458  /// \endcode
3460  /// If ``true``, put space betwee control statement keywords
3461  /// (for/if/while...) and opening parentheses.
3462  /// \code
3463  /// true: false:
3464  /// if (...) {} vs. if(...) {}
3465  /// \endcode
3467  /// If ``true``, put space between foreach macros and opening parentheses.
3468  /// \code
3469  /// true: false:
3470  /// FOREACH (...) vs. FOREACH(...)
3471  /// <loop-body> <loop-body>
3472  /// \endcode
3474  /// If ``true``, put a space between function declaration name and opening
3475  /// parentheses.
3476  /// \code
3477  /// true: false:
3478  /// void f (); vs. void f();
3479  /// \endcode
3481  /// If ``true``, put a space between function definition name and opening
3482  /// parentheses.
3483  /// \code
3484  /// true: false:
3485  /// void f () {} vs. void f() {}
3486  /// \endcode
3488  /// If ``true``, put space between if macros and opening parentheses.
3489  /// \code
3490  /// true: false:
3491  /// IF (...) vs. IF(...)
3492  /// <conditional-body> <conditional-body>
3493  /// \endcode
3495  /// If ``true``, put a space between operator overloading and opening
3496  /// parentheses.
3497  /// \code
3498  /// true: false:
3499  /// void operator++ (int a); vs. void operator++(int a);
3500  /// object.operator++ (10); object.operator++(10);
3501  /// \endcode
3503  /// If ``true``, put a space before opening parentheses only if the
3504  /// parentheses are not empty.
3505  /// \code
3506  /// true: false:
3507  /// void f (int a); vs. void f();
3508  /// f (a); f();
3509  /// \endcode
3511 
3517 
3518  bool operator==(const SpaceBeforeParensCustom &Other) const {
3524  AfterIfMacros == Other.AfterIfMacros &&
3527  }
3528  };
3529 
3530  /// Control of individual space before parentheses.
3531  ///
3532  /// If ``SpaceBeforeParens`` is set to ``Custom``, use this to specify
3533  /// how each individual space before parentheses case should be handled.
3534  /// Otherwise, this is ignored.
3535  /// \code{.yaml}
3536  /// # Example of usage:
3537  /// SpaceBeforeParens: Custom
3538  /// SpaceBeforeParensOptions:
3539  /// AfterControlStatements: true
3540  /// AfterFunctionDefinitionName: true
3541  /// \endcode
3542  /// \version 14
3544 
3545  /// If ``false``, spaces will be removed before range-based for loop
3546  /// colon.
3547  /// \code
3548  /// true: false:
3549  /// for (auto v : values) {} vs. for(auto v: values) {}
3550  /// \endcode
3551  /// \version 7
3553 
3554  /// If ``true``, spaces will be inserted into ``{}``.
3555  /// \code
3556  /// true: false:
3557  /// void f() { } vs. void f() {}
3558  /// while (true) { } while (true) {}
3559  /// \endcode
3560  /// \version 11
3562 
3563  /// If ``true``, spaces may be inserted into ``()``.
3564  /// \code
3565  /// true: false:
3566  /// void f( ) { vs. void f() {
3567  /// int x[] = {foo( ), bar( )}; int x[] = {foo(), bar()};
3568  /// if (true) { if (true) {
3569  /// f( ); f();
3570  /// } }
3571  /// } }
3572  /// \endcode
3573  /// \version 3.7
3575 
3576  /// The number of spaces before trailing line comments
3577  /// (``//`` - comments).
3578  ///
3579  /// This does not affect trailing block comments (``/*`` - comments) as
3580  /// those commonly have different usage patterns and a number of special
3581  /// cases.
3582  /// \code
3583  /// SpacesBeforeTrailingComments: 3
3584  /// void f() {
3585  /// if (true) { // foo1
3586  /// f(); // bar
3587  /// } // foo
3588  /// }
3589  /// \endcode
3590  /// \version 3.7
3592 
3593  /// Styles for adding spacing after ``<`` and before ``>`
3594  /// in template argument lists.
3595  enum SpacesInAnglesStyle : unsigned char {
3596  /// Remove spaces after ``<`` and before ``>``.
3597  /// \code
3598  /// static_cast<int>(arg);
3599  /// std::function<void(int)> fct;
3600  /// \endcode
3602  /// Add spaces after ``<`` and before ``>``.
3603  /// \code
3604  /// static_cast< int >(arg);
3605  /// std::function< void(int) > fct;
3606  /// \endcode
3608  /// Keep a single space after ``<`` and before ``>`` if any spaces were
3609  /// present. Option ``Standard: Cpp03`` takes precedence.
3611  };
3612  /// The SpacesInAnglesStyle to use for template argument lists.
3613  /// \version 14
3615 
3616  /// If ``true``, spaces will be inserted around if/for/switch/while
3617  /// conditions.
3618  /// \code
3619  /// true: false:
3620  /// if ( a ) { ... } vs. if (a) { ... }
3621  /// while ( i < 5 ) { ... } while (i < 5) { ... }
3622  /// \endcode
3623  /// \version 11
3625 
3626  /// If ``true``, spaces are inserted inside container literals (e.g.
3627  /// ObjC and Javascript array and dict literals).
3628  /// \code{.js}
3629  /// true: false:
3630  /// var arr = [ 1, 2, 3 ]; vs. var arr = [1, 2, 3];
3631  /// f({a : 1, b : 2, c : 3}); f({a: 1, b: 2, c: 3});
3632  /// \endcode
3633  /// \version 3.7
3635 
3636  /// If ``true``, spaces may be inserted into C style casts.
3637  /// \code
3638  /// true: false:
3639  /// x = ( int32 )y vs. x = (int32)y
3640  /// \endcode
3641  /// \version 3.7
3643 
3644  /// Control of spaces within a single line comment
3646  /// The minimum number of spaces at the start of the comment.
3647  unsigned Minimum;
3648  /// The maximum number of spaces at the start of the comment.
3649  unsigned Maximum;
3650  };
3651 
3652  /// How many spaces are allowed at the start of a line comment. To disable the
3653  /// maximum set it to ``-1``, apart from that the maximum takes precedence
3654  /// over the minimum.
3655  /// \code
3656  /// Minimum = 1
3657  /// Maximum = -1
3658  /// // One space is forced
3659  ///
3660  /// // but more spaces are possible
3661  ///
3662  /// Minimum = 0
3663  /// Maximum = 0
3664  /// //Forces to start every comment directly after the slashes
3665  /// \endcode
3666  ///
3667  /// Note that in line comment sections the relative indent of the subsequent
3668  /// lines is kept, that means the following:
3669  /// \code
3670  /// before: after:
3671  /// Minimum: 1
3672  /// //if (b) { // if (b) {
3673  /// // return true; // return true;
3674  /// //} // }
3675  ///
3676  /// Maximum: 0
3677  /// /// List: ///List:
3678  /// /// - Foo /// - Foo
3679  /// /// - Bar /// - Bar
3680  /// \endcode
3681  /// \version 14
3683 
3684  /// If ``true``, spaces will be inserted after ``(`` and before ``)``.
3685  /// \code
3686  /// true: false:
3687  /// t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete;
3688  /// \endcode
3689  /// \version 3.7
3691 
3692  /// If ``true``, spaces will be inserted after ``[`` and before ``]``.
3693  /// Lambdas without arguments or unspecified size array declarations will not
3694  /// be affected.
3695  /// \code
3696  /// true: false:
3697  /// int a[ 5 ]; vs. int a[5];
3698  /// std::unique_ptr<int[]> foo() {} // Won't be affected
3699  /// \endcode
3700  /// \version 3.7
3702 
3703  /// If ``true``, spaces will be before ``[``.
3704  /// Lambdas will not be affected. Only the first ``[`` will get a space added.
3705  /// \code
3706  /// true: false:
3707  /// int a [5]; vs. int a[5];
3708  /// int a [5][5]; vs. int a[5][5];
3709  /// \endcode
3710  /// \version 11
3712 
3713  /// Styles for adding spacing around ``:`` in bitfield definitions.
3714  enum BitFieldColonSpacingStyle : unsigned char {
3715  /// Add one space on each side of the ``:``
3716  /// \code
3717  /// unsigned bf : 2;
3718  /// \endcode
3720  /// Add no space around the ``:`` (except when needed for
3721  /// ``AlignConsecutiveBitFields``).
3722  /// \code
3723  /// unsigned bf:2;
3724  /// \endcode
3726  /// Add space before the ``:`` only
3727  /// \code
3728  /// unsigned bf :2;
3729  /// \endcode
3731  /// Add space after the ``:`` only (space may be added before if
3732  /// needed for ``AlignConsecutiveBitFields``).
3733  /// \code
3734  /// unsigned bf: 2;
3735  /// \endcode
3737  };
3738  /// The BitFieldColonSpacingStyle to use for bitfields.
3739  /// \version 12
3741 
3742  /// Supported language standards for parsing and formatting C++ constructs.
3743  /// \code
3744  /// Latest: vector<set<int>>
3745  /// c++03 vs. vector<set<int> >
3746  /// \endcode
3747  ///
3748  /// The correct way to spell a specific language version is e.g. ``c++11``.
3749  /// The historical aliases ``Cpp03`` and ``Cpp11`` are deprecated.
3750  enum LanguageStandard : unsigned char {
3751  /// Parse and format as C++03.
3752  /// ``Cpp03`` is a deprecated alias for ``c++03``
3753  LS_Cpp03, // c++03
3754  /// Parse and format as C++11.
3755  LS_Cpp11, // c++11
3756  /// Parse and format as C++14.
3757  LS_Cpp14, // c++14
3758  /// Parse and format as C++17.
3759  LS_Cpp17, // c++17
3760  /// Parse and format as C++20.
3761  LS_Cpp20, // c++20
3762  /// Parse and format using the latest supported language version.
3763  /// ``Cpp11`` is a deprecated alias for ``Latest``
3765  /// Automatic detection based on the input.
3767  };
3768 
3769  /// Parse and format C++ constructs compatible with this standard.
3770  /// \code
3771  /// c++03: latest:
3772  /// vector<set<int> > x; vs. vector<set<int>> x;
3773  /// \endcode
3774  /// \version 3.7
3776 
3777  /// Macros which are ignored in front of a statement, as if they were an
3778  /// attribute. So that they are not parsed as identifier, for example for Qts
3779  /// emit.
3780  /// \code
3781  /// AlignConsecutiveDeclarations: true
3782  /// StatementAttributeLikeMacros: []
3783  /// unsigned char data = 'x';
3784  /// emit signal(data); // This is parsed as variable declaration.
3785  ///
3786  /// AlignConsecutiveDeclarations: true
3787  /// StatementAttributeLikeMacros: [emit]
3788  /// unsigned char data = 'x';
3789  /// emit signal(data); // Now it's fine again.
3790  /// \endcode
3791  /// \version 12
3792  std::vector<std::string> StatementAttributeLikeMacros;
3793 
3794  /// The number of columns used for tab stops.
3795  /// \version 3.7
3796  unsigned TabWidth;
3797 
3798  /// Different ways to use tab in formatting.
3799  enum UseTabStyle : unsigned char {
3800  /// Never use tab.
3802  /// Use tabs only for indentation.
3804  /// Fill all leading whitespace with tabs, and use spaces for alignment that
3805  /// appears within a line (e.g. consecutive assignments and declarations).
3807  /// Use tabs for line continuation and indentation, and spaces for
3808  /// alignment.
3810  /// Use tabs whenever we need to fill whitespace that spans at least from
3811  /// one tab stop to the next one.
3813  };
3814 
3815  /// \brief Use ``\r\n`` instead of ``\n`` for line breaks.
3816  /// Also used as fallback if ``DeriveLineEnding`` is true.
3817  /// \version 11
3818  bool UseCRLF;
3819 
3820  /// The way to use tab characters in the resulting file.
3821  /// \version 3.7
3823 
3824  bool operator==(const FormatStyle &R) const {
3893  Language == R.Language &&
3931  SortIncludes == R.SortIncludes &&
3962  Standard == R.Standard &&
3965  UseTab == R.UseTab && UseCRLF == R.UseCRLF &&
3967  }
3968 
3970 
3971  // Stores per-language styles. A FormatStyle instance inside has an empty
3972  // StyleSet. A FormatStyle instance returned by the Get method has its
3973  // StyleSet set to a copy of the originating StyleSet, effectively keeping the
3974  // internal representation of that StyleSet alive.
3975  //
3976  // The memory management and ownership reminds of a birds nest: chicks
3977  // leaving the nest take photos of the nest with them.
3979  typedef std::map<FormatStyle::LanguageKind, FormatStyle> MapType;
3980 
3982 
3983  // Adds \p Style to this FormatStyleSet. Style must not have an associated
3984  // FormatStyleSet.
3985  // Style.Language should be different than LK_None. If this FormatStyleSet
3986  // already contains an entry for Style.Language, that gets replaced with the
3987  // passed Style.
3988  void Add(FormatStyle Style);
3989 
3990  // Clears this FormatStyleSet.
3991  void Clear();
3992 
3993  private:
3994  std::shared_ptr<MapType> Styles;
3995  };
3996 
3998  const FormatStyle &MainStyle,
3999  const std::vector<FormatStyle> &ConfigurationStyles);
4000 
4001 private:
4002  FormatStyleSet StyleSet;
4003 
4004  friend std::error_code
4005  parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style,
4006  bool AllowUnknownOptions,
4007  llvm::SourceMgr::DiagHandlerTy DiagHandler,
4008  void *DiagHandlerCtxt);
4009 };
4010 
4011 /// Returns a format style complying with the LLVM coding standards:
4012 /// http://llvm.org/docs/CodingStandards.html.
4014  FormatStyle::LanguageKind Language = FormatStyle::LanguageKind::LK_Cpp);
4015 
4016 /// Returns a format style complying with one of Google's style guides:
4017 /// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml.
4018 /// http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml.
4019 /// https://developers.google.com/protocol-buffers/docs/style.
4021 
4022 /// Returns a format style complying with Chromium's style guide:
4023 /// http://www.chromium.org/developers/coding-style.
4025 
4026 /// Returns a format style complying with Mozilla's style guide:
4027 /// https://firefox-source-docs.mozilla.org/code-quality/coding-style/index.html.
4029 
4030 /// Returns a format style complying with Webkit's style guide:
4031 /// http://www.webkit.org/coding/coding-style.html
4033 
4034 /// Returns a format style complying with GNU Coding Standards:
4035 /// http://www.gnu.org/prep/standards/standards.html
4037 
4038 /// Returns a format style complying with Microsoft style guide:
4039 /// https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017
4041 
4042 /// Returns style indicating formatting should be not applied at all.
4044 
4045 /// Gets a predefined style for the specified language by name.
4046 ///
4047 /// Currently supported names: LLVM, Google, Chromium, Mozilla. Names are
4048 /// compared case-insensitively.
4049 ///
4050 /// Returns ``true`` if the Style has been set.
4052  FormatStyle *Style);
4053 
4054 /// Parse configuration from YAML-formatted text.
4055 ///
4056 /// Style->Language is used to get the base style, if the ``BasedOnStyle``
4057 /// option is present.
4058 ///
4059 /// The FormatStyleSet of Style is reset.
4060 ///
4061 /// When ``BasedOnStyle`` is not present, options not present in the YAML
4062 /// document, are retained in \p Style.
4063 ///
4064 /// If AllowUnknownOptions is true, no errors are emitted if unknown
4065 /// format options are occured.
4066 ///
4067 /// If set all diagnostics are emitted through the DiagHandler.
4068 std::error_code
4069 parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style,
4070  bool AllowUnknownOptions = false,
4071  llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr,
4072  void *DiagHandlerCtx = nullptr);
4073 
4074 /// Like above but accepts an unnamed buffer.
4075 inline std::error_code parseConfiguration(StringRef Config, FormatStyle *Style,
4076  bool AllowUnknownOptions = false) {
4077  return parseConfiguration(llvm::MemoryBufferRef(Config, "YAML"), Style,
4078  AllowUnknownOptions);
4079 }
4080 
4081 /// Gets configuration in a YAML string.
4082 std::string configurationAsText(const FormatStyle &Style);
4083 
4084 /// Returns the replacements necessary to sort all ``#include`` blocks
4085 /// that are affected by ``Ranges``.
4086 tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
4087  ArrayRef<tooling::Range> Ranges,
4088  StringRef FileName,
4089  unsigned *Cursor = nullptr);
4090 
4091 /// Returns the replacements corresponding to applying and formatting
4092 /// \p Replaces on success; otheriwse, return an llvm::Error carrying
4093 /// llvm::StringError.
4095 formatReplacements(StringRef Code, const tooling::Replacements &Replaces,
4096  const FormatStyle &Style);
4097 
4098 /// Returns the replacements corresponding to applying \p Replaces and
4099 /// cleaning up the code after that on success; otherwise, return an llvm::Error
4100 /// carrying llvm::StringError.
4101 /// This also supports inserting/deleting C++ #include directives:
4102 /// - If a replacement has offset UINT_MAX, length 0, and a replacement text
4103 /// that is an #include directive, this will insert the #include into the
4104 /// correct block in the \p Code.
4105 /// - If a replacement has offset UINT_MAX, length 1, and a replacement text
4106 /// that is the name of the header to be removed, the header will be removed
4107 /// from \p Code if it exists.
4108 /// The include manipulation is done via `tooling::HeaderInclude`, see its
4109 /// documentation for more details on how include insertion points are found and
4110 /// what edits are produced.
4112 cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces,
4113  const FormatStyle &Style);
4114 
4115 /// Represents the status of a formatting attempt.
4117  /// A value of ``false`` means that any of the affected ranges were not
4118  /// formatted due to a non-recoverable syntax error.
4119  bool FormatComplete = true;
4120 
4121  /// If ``FormatComplete`` is false, ``Line`` records a one-based
4122  /// original line number at which a syntax error might have occurred. This is
4123  /// based on a best-effort analysis and could be imprecise.
4124  unsigned Line = 0;
4125 };
4126 
4127 /// Reformats the given \p Ranges in \p Code.
4128 ///
4129 /// Each range is extended on either end to its next bigger logic unit, i.e.
4130 /// everything that might influence its formatting or might be influenced by its
4131 /// formatting.
4132 ///
4133 /// Returns the ``Replacements`` necessary to make all \p Ranges comply with
4134 /// \p Style.
4135 ///
4136 /// If ``Status`` is non-null, its value will be populated with the status of
4137 /// this formatting attempt. See \c FormattingAttemptStatus.
4138 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
4139  ArrayRef<tooling::Range> Ranges,
4140  StringRef FileName = "<stdin>",
4141  FormattingAttemptStatus *Status = nullptr);
4142 
4143 /// Same as above, except if ``IncompleteFormat`` is non-null, its value
4144 /// will be set to true if any of the affected ranges were not formatted due to
4145 /// a non-recoverable syntax error.
4146 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
4147  ArrayRef<tooling::Range> Ranges,
4148  StringRef FileName, bool *IncompleteFormat);
4149 
4150 /// Clean up any erroneous/redundant code in the given \p Ranges in \p
4151 /// Code.
4152 ///
4153 /// Returns the ``Replacements`` that clean up all \p Ranges in \p Code.
4154 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code,
4155  ArrayRef<tooling::Range> Ranges,
4156  StringRef FileName = "<stdin>");
4157 
4158 /// Fix namespace end comments in the given \p Ranges in \p Code.
4159 ///
4160 /// Returns the ``Replacements`` that fix the namespace comments in all
4161 /// \p Ranges in \p Code.
4163  StringRef Code,
4164  ArrayRef<tooling::Range> Ranges,
4165  StringRef FileName = "<stdin>");
4166 
4167 /// Inserts or removes empty lines separating definition blocks including
4168 /// classes, structs, functions, namespaces, and enums in the given \p Ranges in
4169 /// \p Code.
4170 ///
4171 /// Returns the ``Replacements`` that inserts or removes empty lines separating
4172 /// definition blocks in all \p Ranges in \p Code.
4174  StringRef Code,
4175  ArrayRef<tooling::Range> Ranges,
4176  StringRef FileName = "<stdin>");
4177 
4178 /// Sort consecutive using declarations in the given \p Ranges in
4179 /// \p Code.
4180 ///
4181 /// Returns the ``Replacements`` that sort the using declarations in all
4182 /// \p Ranges in \p Code.
4184  StringRef Code,
4185  ArrayRef<tooling::Range> Ranges,
4186  StringRef FileName = "<stdin>");
4187 
4188 /// Returns the ``LangOpts`` that the formatter expects you to set.
4189 ///
4190 /// \param Style determines specific settings for lexing mode.
4192 
4193 /// Description to be used for help text for a ``llvm::cl`` option for
4194 /// specifying format style. The description is closely related to the operation
4195 /// of ``getStyle()``.
4196 extern const char *StyleOptionHelpDescription;
4197 
4198 /// The suggested format style to use by default. This allows tools using
4199 /// `getStyle` to have a consistent default style.
4200 /// Different builds can modify the value to the preferred styles.
4201 extern const char *DefaultFormatStyle;
4202 
4203 /// The suggested predefined style to use as the fallback style in `getStyle`.
4204 /// Different builds can modify the value to the preferred styles.
4205 extern const char *DefaultFallbackStyle;
4206 
4207 /// Construct a FormatStyle based on ``StyleName``.
4208 ///
4209 /// ``StyleName`` can take several forms:
4210 /// * "{<key>: <value>, ...}" - Set specic style parameters.
4211 /// * "<style name>" - One of the style names supported by
4212 /// getPredefinedStyle().
4213 /// * "file" - Load style configuration from a file called ``.clang-format``
4214 /// located in one of the parent directories of ``FileName`` or the current
4215 /// directory if ``FileName`` is empty.
4216 /// * "file:<format_file_path>" to explicitly specify the configuration file to
4217 /// use.
4218 ///
4219 /// \param[in] StyleName Style name to interpret according to the description
4220 /// above.
4221 /// \param[in] FileName Path to start search for .clang-format if ``StyleName``
4222 /// == "file".
4223 /// \param[in] FallbackStyle The name of a predefined style used to fallback to
4224 /// in case \p StyleName is "file" and no file can be found.
4225 /// \param[in] Code The actual code to be formatted. Used to determine the
4226 /// language if the filename isn't sufficient.
4227 /// \param[in] FS The underlying file system, in which the file resides. By
4228 /// default, the file system is the real file system.
4229 /// \param[in] AllowUnknownOptions If true, unknown format options only
4230 /// emit a warning. If false, errors are emitted on unknown format
4231 /// options.
4232 ///
4233 /// \returns FormatStyle as specified by ``StyleName``. If ``StyleName`` is
4234 /// "file" and no file is found, returns ``FallbackStyle``. If no style could be
4235 /// determined, returns an Error.
4236 llvm::Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
4237  StringRef FallbackStyle,
4238  StringRef Code = "",
4239  llvm::vfs::FileSystem *FS = nullptr,
4240  bool AllowUnknownOptions = false);
4241 
4242 // Guesses the language from the ``FileName`` and ``Code`` to be formatted.
4243 // Defaults to FormatStyle::LK_Cpp.
4244 FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code);
4245 
4246 // Returns a string representation of ``Language``.
4248  switch (Language) {
4249  case FormatStyle::LK_Cpp:
4250  return "C++";
4252  return "CSharp";
4253  case FormatStyle::LK_ObjC:
4254  return "Objective-C";
4255  case FormatStyle::LK_Java:
4256  return "Java";
4258  return "JavaScript";
4259  case FormatStyle::LK_Json:
4260  return "Json";
4261  case FormatStyle::LK_Proto:
4262  return "Proto";
4264  return "TableGen";
4266  return "TextProto";
4267  default:
4268  return "Unknown";
4269  }
4270 }
4271 
4272 } // end namespace format
4273 } // end namespace clang
4274 
4275 namespace std {
4276 template <>
4277 struct is_error_code_enum<clang::format::ParseError> : std::true_type {};
4278 } // namespace std
4279 
4280 #endif // LLVM_CLANG_FORMAT_FORMAT_H
clang::format::FormatStyle::SpaceBeforeRangeBasedForLoopColon
bool SpaceBeforeRangeBasedForLoopColon
If false, spaces will be removed before range-based for loop colon.
Definition: Format.h:3552
clang::format::FormatStyle::AllowAllConstructorInitializersOnNextLine
bool AllowAllConstructorInitializersOnNextLine
This option is deprecated.
Definition: Format.h:534
clang::format::FormatStyle::ENAS_Right
@ ENAS_Right
Align escaped newlines in the right-most column.
Definition: Format.h:459
clang::format::FormatStyle::ENAS_Left
@ ENAS_Left
Align escaped newlines as far left as possible.
Definition: Format.h:451
clang::tooling::IncludeStyle::IncludeCategories
std::vector< IncludeCategory > IncludeCategories
Regular expressions denoting the different #include categories used for ordering #includes.
Definition: IncludeStyle.h:118
clang::format::FormatStyle::PAS_Left
@ PAS_Left
Align pointer to the left.
Definition: Format.h:2930
clang::format::FormatStyle::BS_WebKit
@ BS_WebKit
Like Attach, but break before functions.
Definition: Format.h:1489
clang::format::FormatStyle::SpaceBeforeParens
SpaceBeforeParensStyle SpaceBeforeParens
Defines in which cases to put a space before opening parentheses.
Definition: Format.h:3449
clang::format::FormatStyle::NamespaceIndentationKind
NamespaceIndentationKind
Different ways to indent namespace contents.
Definition: Format.h:2767
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterFunctionDeclarationName
bool AfterFunctionDeclarationName
If true, put a space between function declaration name and opening parentheses.
Definition: Format.h:3480
clang::format::FormatStyle::BS_Linux
@ BS_Linux
Like Attach, but break before braces on function, namespace and class definitions.
Definition: Format.h:1159
clang::format::configurationAsText
std::string configurationAsText(const FormatStyle &Style)
Gets configuration in a YAML string.
Definition: Format.cpp:1708
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::format::FormatStyle::ENAS_DontAlign
@ ENAS_DontAlign
Don't align escaped newlines.
Definition: Format.h:440
clang::format::FormatStyle::ELBAMS_LogicalBlock
@ ELBAMS_LogicalBlock
Add empty line only when access modifier starts a new logical block.
Definition: Format.h:2152
clang::format::FormatStyle::BreakConstructorInitializersStyle
BreakConstructorInitializersStyle
Different ways to break initializers.
Definition: Format.h:1801
clang::format::FormatStyle::BuildStyleSetFromConfiguration
static FormatStyleSet BuildStyleSetFromConfiguration(const FormatStyle &MainStyle, const std::vector< FormatStyle > &ConfigurationStyles)
clang::format::FormatStyle::BS_Custom
@ BS_Custom
Configure each individual brace in BraceWrapping.
Definition: Format.h:1491
clang::format::FormatStyle::BraceWrappingFlags::AfterStruct
bool AfterStruct
Wrap struct definitions.
Definition: Format.h:1630
clang::format::FormatStyle::SpaceBeforeCpp11BracedList
bool SpaceBeforeCpp11BracedList
If true, a space will be inserted before a C++11 braced list used to initialize an object (after the ...
Definition: Format.h:3366
clang::format::FormatStyle::SpaceBeforeAssignmentOperators
bool SpaceBeforeAssignmentOperators
If false, spaces will be removed before assignment operators.
Definition: Format.h:3344
clang::format::FormatStyle::BreakStringLiterals
bool BreakStringLiterals
Allow breaking string literals when formatting.
Definition: Format.h:1852
clang::format::FormatStyle::BILS_AfterColon
@ BILS_AfterColon
Break inheritance list after the colon and commas.
Definition: Format.h:1966
clang::format::FormatStyle::MaxEmptyLinesToKeep
unsigned MaxEmptyLinesToKeep
The maximum number of consecutive empty lines to keep.
Definition: Format.h:2764
clang::format::FormatStyle::ShortLambdaStyle
ShortLambdaStyle
Different styles for merging short lambdas containing at most one statement.
Definition: Format.h:741
clang::format::FormatStyle::FormatStyleSet::MapType
std::map< FormatStyle::LanguageKind, FormatStyle > MapType
Definition: Format.h:3979
clang::format::FormatStyle::DefinitionReturnTypeBreakingStyle
DefinitionReturnTypeBreakingStyle
Different ways to break after the function definition return type.
Definition: Format.h:780
clang::format::FormatStyle::OAS_DontAlign
@ OAS_DontAlign
Do not align operands of binary and ternary expressions.
Definition: Format.h:471
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterControlStatements
bool AfterControlStatements
If true, put space betwee control statement keywords (for/if/while...) and opening parentheses.
Definition: Format.h:3466
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::format::formatReplacements
llvm::Expected< tooling::Replacements > formatReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style)
Returns the replacements corresponding to applying and formatting Replaces on success; otheriwse,...
Definition: Format.cpp:2917
clang::format::FormatStyle::BPS_Never
@ BPS_Never
Never bin-pack parameters.
Definition: Format.h:1016
clang::format::FormatStyle::JSQS_Double
@ JSQS_Double
Always use double quotes.
Definition: Format.h:2613
clang::format::FormatStyle::DRTBS_None
@ DRTBS_None
Break after return type automatically.
Definition: Format.h:783
clang::format::ParseError::MissingQualifierOrder
@ MissingQualifierOrder
clang::format::FormatStyle::FormatStyleSet::Get
llvm::Optional< FormatStyle > Get(FormatStyle::LanguageKind Language) const
Definition: Format.cpp:1723
clang::format::FormatStyle::PCIS_BinPack
@ PCIS_BinPack
Bin-pack constructor initializers.
Definition: Format.h:2207
clang::format::FormatStyle::parseConfiguration
friend std::error_code parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style, bool AllowUnknownOptions, llvm::SourceMgr::DiagHandlerTy DiagHandler, void *DiagHandlerCtxt)
Parse configuration from YAML-formatted text.
Definition: Format.cpp:1642
clang::format::parseConfiguration
std::error_code parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style, bool AllowUnknownOptions=false, llvm::SourceMgr::DiagHandlerTy DiagHandler=nullptr, void *DiagHandlerCtx=nullptr)
Parse configuration from YAML-formatted text.
Definition: Format.cpp:1642
clang::format::FormatStyle::OperandAlignmentStyle
OperandAlignmentStyle
Different styles for aligning operands.
Definition: Format.h:467
clang::format::FormatStyle::PenaltyBreakString
unsigned PenaltyBreakString
The penalty for each line break introduced inside a string literal.
Definition: Format.h:2904
clang::format::getMicrosoftStyle
FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language)
Returns a format style complying with Microsoft style guide: https://docs.microsoft....
Definition: Format.cpp:1545
clang::format::FormatStyle::BraceWrappingFlags::AfterControlStatement
BraceWrappingAfterControlStatementStyle AfterControlStatement
Wrap control statements (if/for/while/switch/..).
Definition: Format.h:1568
clang::format::FormatStyle::ObjCBinPackProtocolList
BinPackStyle ObjCBinPackProtocolList
Controls bin-packing Objective-C protocol conformance list items into as few lines as possible when t...
Definition: Format.h:2835
clang::format::separateDefinitionBlocks
tooling::Replacements separateDefinitionBlocks(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>")
Inserts or removes empty lines separating definition blocks including classes, structs,...
Definition: Format.cpp:3202
clang::format::getParseCategory
const std::error_category & getParseCategory()
Definition: Format.cpp:934
clang::format::FormatStyle::SBPO_Always
@ SBPO_Always
Always put a space before opening parentheses, except when it's prohibited by the syntax rules (in fu...
Definition: Format.h:3441
clang::format::FormatStyle::SpacesInAnglesStyle
SpacesInAnglesStyle
Styles for adding spacing after < and before `> in template argument lists.
Definition: Format.h:3595
clang::format::FormatStyle::BFCS_Before
@ BFCS_Before
Add space before the : only.
Definition: Format.h:3730
clang::format::FormatStyle::DerivePointerAlignment
bool DerivePointerAlignment
If true, analyze the formatted file for the most common alignment of & and *.
Definition: Format.h:2059
clang::format::getGoogleStyle
FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language)
Returns a format style complying with one of Google's style guides: http://google-styleguide....
Definition: Format.cpp:1281
clang::format::FormatStyle::AlwaysBreakBeforeMultilineStrings
bool AlwaysBreakBeforeMultilineStrings
If true, always break before multiline string literals.
Definition: Format.h:883
clang::format::FormatStyle::AllowShortEnumsOnASingleLine
bool AllowShortEnumsOnASingleLine
Allow short enums on a single line.
Definition: Format.h:566
clang::format::FormatStyle::SpaceBeforeParensCustom::operator==
bool operator==(const SpaceBeforeParensCustom &Other) const
Definition: Format.h:3518
clang::format::FormatStyle::Standard
LanguageStandard Standard
Parse and format C++ constructs compatible with this standard.
Definition: Format.h:3775
clang::format::FormatStyle::IndentAccessModifiers
bool IndentAccessModifiers
Specify whether access modifiers should have their own indentation level.
Definition: Format.h:2376
clang::format::FormatStyle::LK_Cpp
@ LK_Cpp
Should be used for C, C++.
Definition: Format.h:2657
clang::format::FormatStyle::BS_Mozilla
@ BS_Mozilla
Like Attach, but break before braces on enum, function, and record definitions.
Definition: Format.h:1209
clang::format::FormatStyle::AllowShortLoopsOnASingleLine
bool AllowShortLoopsOnASingleLine
If true, while (true) continue; can be put on a single line.
Definition: Format.h:776
clang::format::FormatStyle::SpacesInCStyleCastParentheses
bool SpacesInCStyleCastParentheses
If true, spaces may be inserted into C style casts.
Definition: Format.h:3642
clang::format::FormatStyle::SAPQ_After
@ SAPQ_After
Ensure that there is a space after pointer qualifiers.
Definition: Format.h:3324
clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyRecord
bool SplitEmptyRecord
If false, empty record (e.g.
Definition: Format.h:1744
clang::format::DefaultFallbackStyle
const char * DefaultFallbackStyle
The suggested predefined style to use as the fallback style in getStyle.
Definition: Format.cpp:3307
clang::format::FormatStyle::ShortIfStyle
ShortIfStyle
Different styles for handling short if statements.
Definition: Format.h:669
clang::format::FormatStyle::ShortNamespaceLines
unsigned ShortNamespaceLines
The maximal number of unwrapped lines that a short namespace spans.
Definition: Format.h:3197
clang::format::FormatStyle::IEBS_AfterExternBlock
@ IEBS_AfterExternBlock
Backwards compatible with AfterExternBlock's indenting.
Definition: Format.h:2491
clang::format::FormatStyle::SBPO_NonEmptyParentheses
@ SBPO_NonEmptyParentheses
Put a space before opening parentheses only if the parentheses are not empty i.e.
Definition: Format.h:3429
clang::format::FormatStyle::IEBS_NoIndent
@ IEBS_NoIndent
Does not indent extern blocks.
Definition: Format.h:2498
clang::format::FormatStyle::RemoveBracesLLVM
bool RemoveBracesLLVM
Remove optional braces of control statements (if, else, for, and while) in C++ according to the LLVM ...
Definition: Format.h:3117
clang::format::FormatStyle::InsertTrailingCommas
TrailingCommaStyle InsertTrailingCommas
If set to TCS_Wrapped will insert trailing commas in container literals (arrays and objects) that wra...
Definition: Format.h:991
clang::format::FormatStyle::CommentPragmas
std::string CommentPragmas
A regular expression that describes comments with special meaning, which should not be split into lin...
Definition: Format.h:1870
clang::format::FormatStyle::PPDirectiveIndentStyle
PPDirectiveIndentStyle
Options for indenting preprocessor directives.
Definition: Format.h:2438
clang::format::FormatStyle::SpacesInConditionalStatement
bool SpacesInConditionalStatement
If true, spaces will be inserted around if/for/switch/while conditions.
Definition: Format.h:3624
clang::format::FormatStyle::AlignEscapedNewlines
EscapedNewlineAlignmentStyle AlignEscapedNewlines
Options for aligning backslashes in escaped newlines.
Definition: Format.h:464
clang::format::FormatStyle::SpacesInLineComment
Control of spaces within a single line comment.
Definition: Format.h:3645
Cursor
Cursor
Definition: SerializedDiagnosticReader.cpp:109
clang::format::FormatStyle::SortIncludes
SortIncludesOptions SortIncludes
Controls if and how clang-format will sort #includes.
Definition: Format.h:3237
clang::format::FormatStyle::SI_Never
@ SI_Never
Includes are never sorted.
Definition: Format.h:3209
clang::format::FormatStyle::BraceWrappingFlags::BeforeLambdaBody
bool BeforeLambdaBody
Wrap lambda block.
Definition: Format.h:1705
clang::format::FormatStyle::BWACS_MultiLine
@ BWACS_MultiLine
Only wrap braces after a multi-line control statement.
Definition: Format.h:1519
clang::format::FormatStyle::AlwaysBreakTemplateDeclarations
BreakTemplateDeclarationsStyle AlwaysBreakTemplateDeclarations
The template declaration breaking style to use.
Definition: Format.h:923
clang::format::FormatStyle::SAPQ_Both
@ SAPQ_Both
Ensure that there is a space both before and after pointer qualifiers.
Definition: Format.h:3330
clang::format::FormatStyle::SLS_Empty
@ SLS_Empty
Only merge empty lambdas.
Definition: Format.h:751
clang::tooling::Replacements
Maintains a set of replacements that are conflict-free.
Definition: Replacement.h:209
clang::format::FormatStyle::BTDS_MultiLine
@ BTDS_MultiLine
Force break after template declaration only when the following declaration spans multiple lines.
Definition: Format.h:907
clang::format::FormatStyle::StatementMacros
std::vector< std::string > StatementMacros
A vector of macros that should be interpreted as complete statements.
Definition: Format.h:2317
clang::format::FormatStyle::EmptyLineBeforeAccessModifierStyle
EmptyLineBeforeAccessModifierStyle
Different styles for empty line before access modifiers.
Definition: Format.h:2117
clang::format::FormatStyle::BreakBeforeBinaryOperators
BinaryOperatorStyle BreakBeforeBinaryOperators
The way to wrap binary operators.
Definition: Format.h:1061
clang::tooling::IncludeStyle::IncludeIsMainRegex
std::string IncludeIsMainRegex
Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping.
Definition: IncludeStyle.h:132
clang::format::guessLanguage
FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code)
Definition: Format.cpp:3287
clang::format::FormatStyle
The FormatStyle is used to configure the formatting to follow specific guidelines.
Definition: Format.h:54
clang::format::FormatStyle::SpaceAroundPointerQualifiers
SpaceAroundPointerQualifiersStyle SpaceAroundPointerQualifiers
Defines in which cases to put a space before or after pointer qualifiers.
Definition: Format.h:3335
clang::format::FormatStyle::IndentCaseLabels
bool IndentCaseLabels
Indent case labels one level from the switch statement.
Definition: Format.h:2395
clang::format::FormatStyle::RTBS_All
@ RTBS_All
Always break after the return type.
Definition: Format.h:818
clang::format::FormatStyle::SLS_None
@ SLS_None
Never merge lambdas into a single line.
Definition: Format.h:743
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterForeachMacros
bool AfterForeachMacros
If true, put space between foreach macros and opening parentheses.
Definition: Format.h:3473
clang::format::FormatStyle::LK_CSharp
@ LK_CSharp
Should be used for C#.
Definition: Format.h:2659
clang::format::FormatStyle::UT_Never
@ UT_Never
Never use tab.
Definition: Format.h:3801
llvm::Optional
Definition: LLVM.h:40
clang::format::FormatStyle::ACS_Consecutive
@ ACS_Consecutive
Definition: Format.h:145
clang::format::FormatStyle::AlwaysBreakAfterReturnType
ReturnTypeBreakingStyle AlwaysBreakAfterReturnType
The function declaration return type breaking style to use.
Definition: Format.h:868
clang::format::FormattingAttemptStatus::Line
unsigned Line
If FormatComplete is false, Line records a one-based original line number at which a syntax error mig...
Definition: Format.h:4124
clang::format::ParseError::Unsuitable
@ Unsuitable
clang::format::getPredefinedStyle
bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language, FormatStyle *Style)
Gets a predefined style for the specified language by name.
Definition: Format.cpp:1583
clang::format::FormatStyle::BAS_Align
@ BAS_Align
Align parameters on the open bracket, e.g.
Definition: Format.h:71
clang::format::FormatStyle::BFCS_Both
@ BFCS_Both
Add one space on each side of the :
Definition: Format.h:3719
clang::format::FormatStyle::BPS_Auto
@ BPS_Auto
Automatically determine parameter bin-packing behavior.
Definition: Format.h:1012
clang::format::FormatStyle::ConstructorInitializerAllOnOneLineOrOnePerLine
bool ConstructorInitializerAllOnOneLineOrOnePerLine
This option is deprecated.
Definition: Format.h:2007
clang::format::FormatStyle::PenaltyReturnTypeOnItsOwnLine
unsigned PenaltyReturnTypeOnItsOwnLine
Penalty for putting the return type of a function onto its own line.
Definition: Format.h:2917
clang::format::FormatStyle::RawStringFormat::CanonicalDelimiter
std::string CanonicalDelimiter
The canonical delimiter for this language.
Definition: Format.h:2971
clang::format::FormatStyle::SBS_Always
@ SBS_Always
Always merge short blocks into a single line.
Definition: Format.h:593
clang::format::FormatStyle::IndentCaseBlocks
bool IndentCaseBlocks
Indent case label blocks one level from the case label.
Definition: Format.h:2418
llvm::Expected
Definition: LLVM.h:41
clang::format::FormatStyle::BOS_NonAssignment
@ BOS_NonAssignment
Break before operators that aren't assignments.
Definition: Format.h:1044
clang::format::FormatStyle::IndentWrappedFunctionNames
bool IndentWrappedFunctionNames
Indent if a function definition or declaration is wrapped after the type.
Definition: Format.h:2557
clang::format::FormatStyle::RAS_Left
@ RAS_Left
Align reference to the left.
Definition: Format.h:3030
clang::format::StyleOptionHelpDescription
const char * StyleOptionHelpDescription
Description to be used for help text for a llvm::cl option for specifying format style.
Definition: Format.cpp:3248
clang::format::FormatStyle::SBS_Never
@ SBS_Never
Never merge blocks into a single line.
Definition: Format.h:579
clang::format::FormatStyle::SeparateDefinitionStyle
SeparateDefinitionStyle
The style if definition blocks should be separated.
Definition: Format.h:3120
clang::format::FormatStyle::LK_TableGen
@ LK_TableGen
Should be used for TableGen code.
Definition: Format.h:2672
clang::format::FormatStyle::BraceWrappingFlags::AfterFunction
bool AfterFunction
Wrap function definitions.
Definition: Format.h:1596
clang::format::FormatStyle::RawStringFormat::EnclosingFunctions
std::vector< std::string > EnclosingFunctions
A list of enclosing function names that match this language.
Definition: Format.h:2969
clang::format::FormatStyle::SpaceBeforeCaseColon
bool SpaceBeforeCaseColon
If false, spaces will be removed before case colon.
Definition: Format.h:3354
clang::format::FormatStyle::SIS_WithoutElse
@ SIS_WithoutElse
Put short ifs on the same line only if there is no else statement.
Definition: Format.h:702
clang::format::FormatStyle::QAS_Custom
@ QAS_Custom
Change specifiers/qualifiers to be aligned based on QualifierOrder.
Definition: Format.h:1904
clang::format::ParseError::Success
@ Success
clang::format::FormatStyle::SIS_OnlyFirstIf
@ SIS_OnlyFirstIf
Put short ifs, but not else ifs nor else statements, on the same line.
Definition: Format.h:718
clang::format::FormatStyle::TCS_None
@ TCS_None
Do not insert trailing commas.
Definition: Format.h:966
clang::format::FormatStyle::PPIndentWidth
int PPIndentWidth
The number of columns to use for indentation of preprocessor statements.
Definition: Format.h:2960
clang::format::FormatStyle::BTDS_Yes
@ BTDS_Yes
Always break after template declaration.
Definition: Format.h:918
clang::format::FormatStyle::BCIS_AfterColon
@ BCIS_AfterColon
Break constructor initializers after the colon and commas.
Definition: Format.h:1823
clang::format::FormatStyle::SIAS_Never
@ SIAS_Never
Remove spaces after < and before >.
Definition: Format.h:3601
clang::format::FormatStyle::BS_Allman
@ BS_Allman
Always break before braces.
Definition: Format.h:1319
clang::format::FormatStyle::BWACS_Never
@ BWACS_Never
Never wrap braces after a control statement.
Definition: Format.h:1508
clang::format::FormatStyle::Cpp11BracedListStyle
bool Cpp11BracedListStyle
If true, format braced lists as best suited for C++11 braced lists.
Definition: Format.h:2046
clang::format::FormatStyle::SpaceBeforeCtorInitializerColon
bool SpaceBeforeCtorInitializerColon
If false, spaces will be removed before constructor initializer colon.
Definition: Format.h:3375
clang::format::FormatStyle::UT_Always
@ UT_Always
Use tabs whenever we need to fill whitespace that spans at least from one tab stop to the next one.
Definition: Format.h:3812
clang::format::FormatStyle::UseCRLF
bool UseCRLF
Use \r\n instead of \n for line breaks.
Definition: Format.h:3818
clang::format::FormatStyle::BraceWrappingFlags::AfterExternBlock
bool AfterExternBlock
Wrap extern blocks.
Definition: Format.h:1658
clang::format::FormatStyle::SBS_Empty
@ SBS_Empty
Only merge empty blocks.
Definition: Format.h:587
clang::format::FormatStyle::BTDS_No
@ BTDS_No
Do not force break before declaration.
Definition: Format.h:896
clang::format::FormatStyle::LK_Proto
@ LK_Proto
Should be used for Protocol Buffers (https://developers.google.com/protocol-buffers/).
Definition: Format.h:2670
clang::format::FormatStyle::BraceWrappingFlags::AfterUnion
bool AfterUnion
Wrap union definitions.
Definition: Format.h:1644
clang::format::ParseError::MissingQualifierType
@ MissingQualifierType
clang::format::FormatStyle::SIAS_Always
@ SIAS_Always
Add spaces after < and before >.
Definition: Format.h:3607
clang::format::FormatStyle::BraceWrappingFlags::BeforeElse
bool BeforeElse
Wrap before else.
Definition: Format.h:1688
clang::format::FormatStyle::operator==
bool operator==(const FormatStyle &R) const
Definition: Format.h:3824
clang::format::FormatStyle::AllowAllParametersOfDeclarationOnNextLine
bool AllowAllParametersOfDeclarationOnNextLine
If the function declaration doesn't fit on a line, allow putting all parameters of a function declara...
Definition: Format.h:552
clang::format::FormatStyle::ReflowComments
bool ReflowComments
If true, clang-format will attempt to re-flow comments.
Definition: Format.h:3062
clang::format::FormatStyle::SBPO_ControlStatements
@ SBPO_ControlStatements
Put a space before opening parentheses only after control statement keywords (for/if/while....
Definition: Format.h:3405
clang::format::FormatStyle::SpaceAfterCStyleCast
bool SpaceAfterCStyleCast
If true, a space is inserted after C style casts.
Definition: Format.h:3286
clang::format::FormatStyle::ExperimentalAutoDetectBinPacking
bool ExperimentalAutoDetectBinPacking
If true, clang-format detects whether function calls and definitions are formatted with one parameter...
Definition: Format.h:2190
clang::format::FormatStyle::NI_All
@ NI_All
Indent in all namespaces.
Definition: Format.h:2797
clang::format::FormatStyle::PenaltyBreakOpenParenthesis
unsigned PenaltyBreakOpenParenthesis
The penalty for breaking after (.
Definition: Format.h:2900
clang::format::FormatStyle::BAS_DontAlign
@ BAS_DontAlign
Don't align, instead use ContinuationIndentWidth, e.g.
Definition: Format.h:77
clang::format::FormatStyle::AIAS_None
@ AIAS_None
Don't align array initializer columns.
Definition: Format.h:130
clang::format::FormatStyle::ReturnTypeBreakingStyle
ReturnTypeBreakingStyle
Different ways to break after the function definition or declaration return type.
Definition: Format.h:792
clang::format::FormatStyle::SIS_Never
@ SIS_Never
Never put short ifs on the same line.
Definition: Format.h:686
clang::format::FormatStyle::BraceWrappingFlags
Precise control over the wrapping of braces.
Definition: Format.h:1539
clang::format::FormatStyle::IndentWidth
unsigned IndentWidth
The number of columns to use for indentation.
Definition: Format.h:2543
clang::format::FormatStyle::IndentExternBlockStyle
IndentExternBlockStyle
Indents extern blocks.
Definition: Format.h:2473
clang::format::FormatStyle::RawStringFormat::operator==
bool operator==(const RawStringFormat &Other) const
Definition: Format.h:2976
clang::format::FormatStyle::IfMacros
std::vector< std::string > IfMacros
A vector of macros that should be interpreted as conditionals instead of as function calls.
Definition: Format.h:2289
clang::format::FormatStyle::BCIS_BeforeColon
@ BCIS_BeforeColon
Break constructor initializers before the colon and after the commas.
Definition: Format.h:1808
clang::format::FormatStyle::SFS_All
@ SFS_All
Merge all functions fitting on a single line.
Definition: Format.h:660
clang::format::FormatStyle::SJSIO_After
@ SJSIO_After
Static imports are placed after non-static imports.
Definition: Format.h:3254
clang::format::FormatStyle::PCIS_NextLine
@ PCIS_NextLine
Same as PCIS_CurrentLine except that if all constructor initializers do not fit on the current line,...
Definition: Format.h:2232
clang::format::FormatStyle::SIAS_Leave
@ SIAS_Leave
Keep a single space after < and before > if any spaces were present.
Definition: Format.h:3610
clang::format::FormatStyle::LK_None
@ LK_None
Do not use.
Definition: Format.h:2655
clang::format::sortUsingDeclarations
tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>")
Sort consecutive using declarations in the given Ranges in Code.
Definition: Format.cpp:3212
clang::format::FormatStyle::SBPO_ControlStatementsExceptControlMacros
@ SBPO_ControlStatementsExceptControlMacros
Same as SBPO_ControlStatements except this option doesn't apply to ForEach and If macros.
Definition: Format.h:3418
clang::format::FormatStyle::SFS_Empty
@ SFS_Empty
Only merge empty functions.
Definition: Format.h:641
clang::format::FormatStyle::AlwaysBreakAfterDefinitionReturnType
DefinitionReturnTypeBreakingStyle AlwaysBreakAfterDefinitionReturnType
The function definition return type breaking style to use.
Definition: Format.h:864
clang::format::FormatStyle::LK_TextProto
@ LK_TextProto
Should be used for Protocol Buffer messages in text format (https://developers.google....
Definition: Format.h:2675
clang::format::FormatStyle::BreakAfterJavaFieldAnnotations
bool BreakAfterJavaFieldAnnotations
Break after each annotation on a field in Java files.
Definition: Format.h:1838
LangOptions.h
clang::format::FormatStyle::IndentExternBlock
IndentExternBlockStyle IndentExternBlock
IndentExternBlockStyle is the type of indenting of extern blocks.
Definition: Format.h:2510
clang::format::fixNamespaceEndComments
tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>")
Fix namespace end comments in the given Ranges in Code.
Definition: Format.cpp:3192
clang::format::FormatStyle::SpacesInLineComment::Minimum
unsigned Minimum
The minimum number of spaces at the start of the comment.
Definition: Format.h:3647
clang::format::FormatStyle::JSQS_Leave
@ JSQS_Leave
Leave string quotes as they are.
Definition: Format.h:2601
clang::format::FormatStyle::ShortBlockStyle
ShortBlockStyle
Different styles for merging short blocks containing at most one statement.
Definition: Format.h:570
clang::format::FormatStyle::AlignOperands
OperandAlignmentStyle AlignOperands
If true, horizontally align operands of binary and ternary expressions.
Definition: Format.h:503
clang::format::FormatStyle::DRTBS_TopLevel
@ DRTBS_TopLevel
Always break after the return types of top-level functions.
Definition: Format.h:787
clang::format::getChromiumStyle
FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language)
Returns a format style complying with Chromium's style guide: http://www.chromium....
Definition: Format.cpp:1421
clang::format::FormatStyle::LanguageKind
LanguageKind
Supported languages.
Definition: Format.h:2653
clang::format::FormatStyle::RTBS_TopLevel
@ RTBS_TopLevel
Always break after the return types of top-level functions.
Definition: Format.h:831
clang::format::FormatStyle::AIAS_Left
@ AIAS_Left
Align array column and left justify the columns e.g.
Definition: Format.h:118
clang::format::FormatStyle::BinPackArguments
bool BinPackArguments
If false, a function call's arguments will either be all on the same line or will have one line each.
Definition: Format.h:961
clang::format::FormatStyle::AllowShortBlocksOnASingleLine
ShortBlockStyle AllowShortBlocksOnASingleLine
Dependent on the value, while (true) { continue; } can be put on a single line.
Definition: Format.h:599
clang::format::FormatStyle::SpaceBeforeParensStyle
SpaceBeforeParensStyle
Different ways to put a space before opening parentheses.
Definition: Format.h:3386
clang::format::FormatStyle::JSQS_Single
@ JSQS_Single
Always use single quotes.
Definition: Format.h:2607
clang::format::FormatStyle::SFS_Inline
@ SFS_Inline
Only merge functions defined inside a class.
Definition: Format.h:652
clang::format::FormatStyle::ObjCBlockIndentWidth
unsigned ObjCBlockIndentWidth
The number of characters to use for indentation of ObjC blocks.
Definition: Format.h:2846
clang::format::FormatStyle::QAS_Leave
@ QAS_Leave
Don't change specifiers/qualifiers to either Left or Right alignment (default).
Definition: Format.h:1880
clang::format::FormatStyle::NamespaceIndentation
NamespaceIndentationKind NamespaceIndentation
The indentation used for namespaces.
Definition: Format.h:2802
clang::format::FormatStyle::SpaceInEmptyBlock
bool SpaceInEmptyBlock
If true, spaces will be inserted into {}.
Definition: Format.h:3561
clang::format::FormatStyle::LS_Latest
@ LS_Latest
Parse and format using the latest supported language version.
Definition: Format.h:3764
clang::format::FormatStyle::SpaceAroundPointerQualifiersStyle
SpaceAroundPointerQualifiersStyle
Different ways to put a space before opening parentheses.
Definition: Format.h:3305
clang::format::FormatStyle::BraceWrappingFlags::AfterEnum
bool AfterEnum
Wrap enum definitions.
Definition: Format.h:1580
clang::format::FormatStyle::SpaceAfterTemplateKeyword
bool SpaceAfterTemplateKeyword
If true, a space will be inserted after the 'template' keyword.
Definition: Format.h:3302
clang::format::FormatStyle::NamespaceMacros
std::vector< std::string > NamespaceMacros
A vector of macros which are used to open namespace blocks.
Definition: Format.h:2330
clang::format::FormatStyle::PenaltyBreakFirstLessLess
unsigned PenaltyBreakFirstLessLess
The penalty for breaking before the first <<.
Definition: Format.h:2896
clang::format::FormatStyle::SAPQ_Default
@ SAPQ_Default
Don't ensure spaces around pointer qualifiers and use PointerAlignment instead.
Definition: Format.h:3312
clang::format::getFormattingLangOpts
LangOptions getFormattingLangOpts(const FormatStyle &Style=getLLVMStyle())
Returns the LangOpts that the formatter expects you to set.
Definition: Format.cpp:3222
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterIfMacros
bool AfterIfMacros
If true, put space between if macros and opening parentheses.
Definition: Format.h:3494
clang::format::FormatStyle::LBI_OuterScope
@ LBI_OuterScope
Align lambda body relative to the indentation level of the outer scope the lambda signature resides i...
Definition: Format.h:2704
clang::format::FormatStyle::SI_CaseInsensitive
@ SI_CaseInsensitive
Includes are sorted in an alphabetical or case insensitive fashion.
Definition: Format.h:3227
clang::format::FormatStyle::AlignConsecutiveAssignments
AlignConsecutiveStyle AlignConsecutiveAssignments
Style of aligning consecutive assignments.
Definition: Format.h:289
clang::format::FormatStyle::UseTabStyle
UseTabStyle
Different ways to use tab in formatting.
Definition: Format.h:3799
clang::format::FormatStyle::BreakBeforeBraces
BraceBreakingStyle BreakBeforeBraces
The brace breaking style to use.
Definition: Format.h:1496
clang::format::getLLVMStyle
FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language=FormatStyle::LanguageKind::LK_Cpp)
Returns a format style complying with the LLVM coding standards: http://llvm.org/docs/CodingStandards...
Definition: Format.cpp:1104
clang::format::FormattingAttemptStatus
Represents the status of a formatting attempt.
Definition: Format.h:4116
clang::format::FormatStyle::ColumnLimit
unsigned ColumnLimit
The column limit.
Definition: Format.h:1860
clang::format::FormatStyle::ELBAMS_Leave
@ ELBAMS_Leave
Keep existing empty lines before access modifiers.
Definition: Format.h:2134
clang::format::FormatStyle::isJson
bool isJson() const
Definition: Format.h:2679
clang::format::FormatStyle::KeepEmptyLinesAtTheStartOfBlocks
bool KeepEmptyLinesAtTheStartOfBlocks
If true, the empty line at the start of blocks is kept.
Definition: Format.h:2646
clang::format::FormatStyle::JavaScriptWrapImports
bool JavaScriptWrapImports
Whether to wrap JavaScript import/export statements.
Definition: Format.h:2634
clang::format::FormatStyle::SDS_Always
@ SDS_Always
Insert an empty line between definition blocks.
Definition: Format.h:3124
clang::format::FormatStyle::BraceWrappingFlags::AfterObjCDeclaration
bool AfterObjCDeclaration
Wrap ObjC definitions (interfaces, implementations...).
Definition: Format.h:1616
clang::format::FormatStyle::PenaltyBreakAssignment
unsigned PenaltyBreakAssignment
The penalty for breaking around an assignment operator.
Definition: Format.h:2884
clang::format::FormatStyle::FixNamespaceComments
bool FixNamespaceComments
If true, clang-format adds missing namespace end comments for short namespaces and fixes invalid exis...
Definition: Format.h:2250
clang::format::FormatStyle::BWACS_Always
@ BWACS_Always
Always wrap braces after a control statement.
Definition: Format.h:1529
clang::format::FormatStyle::PenaltyExcessCharacter
unsigned PenaltyExcessCharacter
The penalty for each character outside of the column limit.
Definition: Format.h:2912
clang::format::FormatStyle::QualifierAlignmentStyle
QualifierAlignmentStyle
Different specifiers and qualifiers alignment styles.
Definition: Format.h:1873
clang::format::FormatStyle::LS_Cpp17
@ LS_Cpp17
Parse and format as C++17.
Definition: Format.h:3759
clang::format::FormatStyle::LambdaBodyIndentationKind
LambdaBodyIndentationKind
Indentation logic for lambda bodies.
Definition: Format.h:2687
clang::format::FormatStyle::AlignConsecutiveDeclarations
AlignConsecutiveStyle AlignConsecutiveDeclarations
Style of aligning consecutive declarations.
Definition: Format.h:429
clang::format::FormatStyle::BOS_All
@ BOS_All
Break before operators.
Definition: Format.h:1056
clang::format::FormatStyle::PackConstructorInitializersStyle
PackConstructorInitializersStyle
Different ways to try to fit all constructor initializers on a line.
Definition: Format.h:2193
clang::format::FormatStyle::LambdaBodyIndentation
LambdaBodyIndentationKind LambdaBodyIndentation
The indentation style of lambda bodies.
Definition: Format.h:2717
clang::format::FormatStyle::ELAAMS_Never
@ ELAAMS_Never
Remove all empty lines after access modifiers.
Definition: Format.h:2083
clang::format::FormatStyle::BraceWrappingFlags::IndentBraces
bool IndentBraces
Indent the wrapped braces themselves.
Definition: Format.h:1721
clang::format::FormatStyle::QualifierOrder
std::vector< std::string > QualifierOrder
The order in which the qualifiers appear.
Definition: Format.h:1938
clang::format::FormatStyle::BitFieldColonSpacing
BitFieldColonSpacingStyle BitFieldColonSpacing
The BitFieldColonSpacingStyle to use for bitfields.
Definition: Format.h:3740
clang::format::reformat
tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>", FormattingAttemptStatus *Status=nullptr)
Reformats the given Ranges in Code.
Definition: Format.cpp:3159
clang::format::FormatStyle::IndentGotoLabels
bool IndentGotoLabels
Indent goto labels.
Definition: Format.h:2435
clang::format::FormatStyle::PointerAlignmentStyle
PointerAlignmentStyle
The &, && and * alignment style.
Definition: Format.h:2925
clang::format::FormatStyle::MacroBlockEnd
std::string MacroBlockEnd
A regular expression matching macros that end a block.
Definition: Format.h:2750
clang::format::FormatStyle::LS_Cpp14
@ LS_Cpp14
Parse and format as C++14.
Definition: Format.h:3757
clang::format::FormatStyle::ArrayInitializerAlignmentStyle
ArrayInitializerAlignmentStyle
Different style for aligning array initializers.
Definition: Format.h:108
clang::format::FormatStyle::WhitespaceSensitiveMacros
std::vector< std::string > WhitespaceSensitiveMacros
A vector of macros which are whitespace-sensitive and should not be touched.
Definition: Format.h:2347
clang::format::FormatStyle::EscapedNewlineAlignmentStyle
EscapedNewlineAlignmentStyle
Different styles for aligning escaped newlines.
Definition: Format.h:432
clang::format::FormatStyle::QualifierAlignment
QualifierAlignmentStyle QualifierAlignment
Different ways to arrange specifiers and qualifiers (e.g.
Definition: Format.h:1916
clang::format::FormatStyle::DRTBS_All
@ DRTBS_All
Always break after the return type.
Definition: Format.h:785
clang::format::FormatStyle::ACS_AcrossComments
@ ACS_AcrossComments
Definition: Format.h:147
clang::format::FormatStyle::BracketAlignmentStyle
BracketAlignmentStyle
Different styles for aligning after open brackets.
Definition: Format.h:65
clang::format::FormatStyle::TabWidth
unsigned TabWidth
The number of columns used for tab stops.
Definition: Format.h:3796
clang::format::FormatStyle::LK_JavaScript
@ LK_JavaScript
Should be used for JavaScript.
Definition: Format.h:2663
clang::format::FormatStyle::SJSIO_Before
@ SJSIO_Before
Static imports are placed before non-static imports.
Definition: Format.h:3247
clang::format::FormatStyle::StatementAttributeLikeMacros
std::vector< std::string > StatementAttributeLikeMacros
Macros which are ignored in front of a statement, as if they were an attribute.
Definition: Format.h:3792
clang::format::FormatStyle::LK_Java
@ LK_Java
Should be used for Java.
Definition: Format.h:2661
clang::format::FormatStyle::RawStringFormat::BasedOnStyle
std::string BasedOnStyle
The style name on which this raw string format is based on.
Definition: Format.h:2975
clang::format::FormatStyle::BraceWrappingFlags::BeforeCatch
bool BeforeCatch
Wrap before catch.
Definition: Format.h:1674
clang::format::FormatStyle::AllowShortLambdasOnASingleLine
ShortLambdaStyle AllowShortLambdasOnASingleLine
Dependent on the value, auto lambda []() { return 0; } can be put on a single line.
Definition: Format.h:771
clang::format::FormatStyle::BraceBreakingStyle
BraceBreakingStyle
Different ways to attach braces to their surrounding context.
Definition: Format.h:1064
clang::format::FormatStyle::SpacesInSquareBrackets
bool SpacesInSquareBrackets
If true, spaces will be inserted after [ and before ].
Definition: Format.h:3701
clang::format::FormatStyle::isJavaScript
bool isJavaScript() const
Definition: Format.h:2680
clang::format::FormatStyle::BraceWrapping
BraceWrappingFlags BraceWrapping
Control of individual brace wrapping cases.
Definition: Format.h:1771
clang::format::FormatStyle::BraceWrappingAfterControlStatementStyle
BraceWrappingAfterControlStatementStyle
Different ways to wrap braces after control statements.
Definition: Format.h:1499
clang::format::FormatStyle::BreakConstructorInitializers
BreakConstructorInitializersStyle BreakConstructorInitializers
The break constructor initializers style to use.
Definition: Format.h:1828
clang::format::FormatStyle::SBPO_Never
@ SBPO_Never
Never put a space before opening parentheses.
Definition: Format.h:3395
clang::format::FormatStyle::SpacesInContainerLiterals
bool SpacesInContainerLiterals
If true, spaces are inserted inside container literals (e.g.
Definition: Format.h:3634
clang::format::FormatStyle::ObjCSpaceAfterProperty
bool ObjCSpaceAfterProperty
Add a space after @property in Objective-C, i.e.
Definition: Format.h:2851
clang::format::FormatStyle::RTBS_AllDefinitions
@ RTBS_AllDefinitions
Always break after the return type of function definitions.
Definition: Format.h:846
clang::format::FormatStyle::BILS_BeforeComma
@ BILS_BeforeComma
Break inheritance list before the colon and commas, and align the commas with the colon.
Definition: Format.h:1958
clang::format::FormatStyle::SortJavaStaticImport
SortJavaStaticImportOptions SortJavaStaticImport
When sorting Java imports, by default static imports are placed before non-static imports.
Definition: Format.h:3261
clang::format::FormatStyle::SpacesInLineComment::Maximum
unsigned Maximum
The maximum number of spaces at the start of the comment.
Definition: Format.h:3649
clang::format::FormatStyle::BS_Whitesmiths
@ BS_Whitesmiths
Like Allman but always indent braces and line up code with braces.
Definition: Format.h:1379
clang::format::FormatStyle::PAS_Middle
@ PAS_Middle
Align pointer in the middle.
Definition: Format.h:2940
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterOverloadedOperator
bool AfterOverloadedOperator
If true, put a space between operator overloading and opening parentheses.
Definition: Format.h:3502
clang::format::FormatStyle::DisableFormat
bool DisableFormat
Disables formatting completely.
Definition: Format.h:2063
clang::format::FormatStyle::BILS_AfterComma
@ BILS_AfterComma
Break inheritance list only after the commas.
Definition: Format.h:1973
clang::format::FormatStyle::SpacesInParentheses
bool SpacesInParentheses
If true, spaces will be inserted after ( and before ).
Definition: Format.h:3690
clang::format::FormatStyle::ContinuationIndentWidth
unsigned ContinuationIndentWidth
Indent width for line continuations.
Definition: Format.h:2023
clang::format::FormatStyle::TrailingCommaStyle
TrailingCommaStyle
The style of inserting trailing commas into container literals.
Definition: Format.h:964
clang::format::FormatStyle::AlignArrayOfStructures
ArrayInitializerAlignmentStyle AlignArrayOfStructures
if not None, when using initialization for an array of structs aligns the fields into columns.
Definition: Format.h:135
clang::format::FormatStyle::isCSharp
bool isCSharp() const
Definition: Format.h:2678
clang::format::FormatStyle::InheritsParentConfig
bool InheritsParentConfig
Definition: Format.h:58
clang::format::ParseError::Error
@ Error
clang::format::FormatStyle::SFS_InlineOnly
@ SFS_InlineOnly
Only merge functions defined inside a class.
Definition: Format.h:633
clang::format::FormatStyle::AlignConsecutiveMacros
AlignConsecutiveStyle AlignConsecutiveMacros
Style of aligning consecutive macro definitions.
Definition: Format.h:220
clang::format::FormatStyle::SpaceBeforeInheritanceColon
bool SpaceBeforeInheritanceColon
If false, spaces will be removed before inheritance colon.
Definition: Format.h:3383
clang::format::FormatStyle::LS_Cpp03
@ LS_Cpp03
Parse and format as C++03.
Definition: Format.h:3753
clang::format::DefaultFormatStyle
const char * DefaultFormatStyle
The suggested format style to use by default.
Definition: Format.cpp:3305
clang::format::FormatStyle::SortIncludesOptions
SortIncludesOptions
Include sorting options.
Definition: Format.h:3200
clang::format::FormatStyle::BinPackStyle
BinPackStyle
The style of wrapping parameters on the same line (bin-packed) or on one line each.
Definition: Format.h:1010
clang::format::cleanupAroundReplacements
llvm::Expected< tooling::Replacements > cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style)
Returns the replacements corresponding to applying Replaces and cleaning up the code after that on su...
Definition: Format.cpp:3027
clang::format::FormatStyle::SDS_Never
@ SDS_Never
Remove any empty line between definition blocks.
Definition: Format.h:3126
clang::format::FormatStyle::PenaltyBreakTemplateDeclaration
unsigned PenaltyBreakTemplateDeclaration
The penalty for breaking after template declaration.
Definition: Format.h:2908
false
#define false
Definition: stdbool.h:17
clang::Language
Language
The language for the input, used to select and validate the language standard and possible actions.
Definition: LangStandard.h:19
clang::format::FormatStyle::FormatStyleSet::Add
void Add(FormatStyle Style)
Definition: Format.cpp:1734
Replacement.h
clang::format::FormatStyle::Language
LanguageKind Language
Language, this format style is targeted at.
Definition: Format.h:2684
clang::format::FormatStyle::TCS_Wrapped
@ TCS_Wrapped
Insert trailing commas in container literals that were wrapped over multiple lines.
Definition: Format.h:972
clang::format::FormatStyle::SpaceBeforeParensCustom::SpaceBeforeParensCustom
SpaceBeforeParensCustom()
Definition: Format.h:3512
clang::format::FormatStyle::SpaceBeforeSquareBrackets
bool SpaceBeforeSquareBrackets
If true, spaces will be before [.
Definition: Format.h:3711
clang::format::FormatStyle::SortJavaStaticImportOptions
SortJavaStaticImportOptions
Position for Java Static imports.
Definition: Format.h:3240
clang::format::FormatStyle::RAS_Right
@ RAS_Right
Align reference to the right.
Definition: Format.h:3035
clang::format::FormatStyle::AccessModifierOffset
int AccessModifierOffset
The extra indent or outdent of access modifiers, e.g.
Definition: Format.h:62
clang::format::FormatStyle::OAS_AlignAfterOperator
@ OAS_AlignAfterOperator
Horizontally align operands of binary and ternary expressions.
Definition: Format.h:497
clang::format::FormatStyle::RTBS_TopLevelDefinitions
@ RTBS_TopLevelDefinitions
Always break after the return type of top-level definitions.
Definition: Format.h:858
clang::format::FormatStyle::AlignTrailingComments
bool AlignTrailingComments
If true, aligns trailing comments.
Definition: Format.h:512
clang::format::sortIncludes
tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, unsigned *Cursor=nullptr)
Returns the replacements necessary to sort all #include blocks that are affected by Ranges.
Definition: Format.cpp:2877
llvm::ArrayRef
Definition: LLVM.h:34
clang::format::FormatStyle::RAS_Pointer
@ RAS_Pointer
Align reference like PointerAlignment.
Definition: Format.h:3025
clang::format::FormatStyle::LS_Auto
@ LS_Auto
Automatic detection based on the input.
Definition: Format.h:3766
clang::format::FormatStyle::ELAAMS_Leave
@ ELAAMS_Leave
Keep existing empty lines after access modifiers.
Definition: Format.h:2086
clang::format::FormatStyle::SBPO_Custom
@ SBPO_Custom
Configure each individual space before parentheses in SpaceBeforeParensOptions.
Definition: Format.h:3444
clang::format::FormatStyle::SLS_Inline
@ SLS_Inline
Merge lambda into a single line if argument of a function.
Definition: Format.h:759
clang::format::FormatStyle::AIAS_Right
@ AIAS_Right
Align array column and right justify the columns e.g.
Definition: Format.h:128
clang::format::FormatStyle::SpacesInAngles
SpacesInAnglesStyle SpacesInAngles
The SpacesInAnglesStyle to use for template argument lists.
Definition: Format.h:3614
clang::format::FormatStyle::CompactNamespaces
bool CompactNamespaces
If true, consecutive namespace declarations will be on the same line.
Definition: Format.h:2002
clang::format::FormatStyle::AllowShortCaseLabelsOnASingleLine
bool AllowShortCaseLabelsOnASingleLine
If true, short case labels will be contracted to a single line.
Definition: Format.h:613
clang::format::FormatStyle::AlignAfterOpenBracket
BracketAlignmentStyle AlignAfterOpenBracket
If true, horizontally aligns arguments after an open bracket.
Definition: Format.h:105
clang::format::FormatStyle::FormatStyleSet
Definition: Format.h:3978
clang::format::FormatStyle::SAPQ_Before
@ SAPQ_Before
Ensure that there is a space before pointer qualifiers.
Definition: Format.h:3318
clang::format::FormatStyle::OAS_Align
@ OAS_Align
Horizontally align operands of binary and ternary expressions.
Definition: Format.h:487
clang::format::getStyle
llvm::Expected< FormatStyle > getStyle(StringRef StyleName, StringRef FileName, StringRef FallbackStyle, StringRef Code="", llvm::vfs::FileSystem *FS=nullptr, bool AllowUnknownOptions=false)
Construct a FormatStyle based on StyleName.
Definition: Format.cpp:3321
clang::format::FormatStyle::ObjCBreakBeforeNestedBlockParam
bool ObjCBreakBeforeNestedBlockParam
Break parameters list into lines when there is nested block parameters in a function call.
Definition: Format.h:2875
clang::format::FormatStyle::PAS_Right
@ PAS_Right
Align pointer to the right.
Definition: Format.h:2935
clang::format::FormatStyle::BinPackParameters
bool BinPackParameters
If false, a function declaration's or function definition's parameters will either all be on the same...
Definition: Format.h:1006
clang::format::getWebKitStyle
FormatStyle getWebKitStyle()
Returns a format style complying with Webkit's style guide: http://www.webkit.org/coding/coding-style...
Definition: Format.cpp:1507
clang::format::FormatStyle::SortUsingDeclarations
bool SortUsingDeclarations
If true, clang-format will sort using declarations.
Definition: Format.h:3278
clang::format::FormatStyle::BreakInheritanceListStyle
BreakInheritanceListStyle
Different ways to break inheritance list.
Definition: Format.h:1941
clang::format::FormatStyle::NI_Inner
@ NI_Inner
Indent only in inner namespaces (nested in other namespaces).
Definition: Format.h:2787
clang::format::FormatStyle::BCIS_BeforeComma
@ BCIS_BeforeComma
Break constructor initializers before the colon and commas, and align the commas with the colon.
Definition: Format.h:1816
clang::format::FormatStyle::RawStringFormat::Language
LanguageKind Language
The language of this raw string.
Definition: Format.h:2965
clang::format::FormatStyle::IndentRequires
bool IndentRequires
Indent the requires clause in a template.
Definition: Format.h:2529
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterFunctionDefinitionName
bool AfterFunctionDefinitionName
If true, put a space between function definition name and opening parentheses.
Definition: Format.h:3487
clang::format::FormatStyle::MacroBlockBegin
std::string MacroBlockBegin
A regular expression matching macros that start a block.
Definition: Format.h:2746
clang::format::FormatStyle::AllowAllArgumentsOnNextLine
bool AllowAllArgumentsOnNextLine
If a function call or braced initializer list doesn't fit on a line, allow putting all arguments onto...
Definition: Format.h:529
clang::format::FormatStyle::SpaceAfterLogicalNot
bool SpaceAfterLogicalNot
If true, a space is inserted after the logical not operator (!).
Definition: Format.h:3294
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang::format::FormatStyle::EmptyLineAfterAccessModifier
EmptyLineAfterAccessModifierStyle EmptyLineAfterAccessModifier
Defines when to put an empty line after access modifiers.
Definition: Format.h:2114
clang::format::FormatStyle::QAS_Left
@ QAS_Left
Change specifiers/qualifiers to be left-aligned.
Definition: Format.h:1886
std
Definition: Format.h:4275
clang::format::FormatStyle::BAS_BlockIndent
@ BAS_BlockIndent
Always break after an open bracket, if the parameters don't fit on a single line.
Definition: Format.h:97
clang::format::FormatStyle::SDS_Leave
@ SDS_Leave
Leave definition blocks as they are.
Definition: Format.h:3122
clang::format::FormatStyle::JavaScriptQuoteStyle
JavaScriptQuoteStyle
Quotation styles for JavaScript strings.
Definition: Format.h:2595
clang::format::FormatStyle::ACS_None
@ ACS_None
Definition: Format.h:144
clang::format::FormatStyle::BFCS_None
@ BFCS_None
Add no space around the : (except when needed for AlignConsecutiveBitFields).
Definition: Format.h:3725
clang::format::FormatStyle::ReferenceAlignmentStyle
ReferenceAlignmentStyle
The & and && alignment style.
Definition: Format.h:3023
clang::format::FormatStyle::SpacesInLineCommentPrefix
SpacesInLineComment SpacesInLineCommentPrefix
How many spaces are allowed at the start of a line comment.
Definition: Format.h:3682
clang::format::FormatStyle::PCIS_Never
@ PCIS_Never
Always put each constructor initializer on its own line.
Definition: Format.h:2200
clang::format::FormatStyle::SpaceBeforeParensCustom
Precise control over the spacing before parentheses.
Definition: Format.h:3459
clang::format::FormatStyle::BraceWrappingFlags::AfterClass
bool AfterClass
Wrap class definitions.
Definition: Format.h:1565
clang::format::FormatStyle::ConstructorInitializerIndentWidth
unsigned ConstructorInitializerIndentWidth
The number of characters to use for indentation of constructor initializer lists as well as inheritan...
Definition: Format.h:2012
clang::format::FormatStyle::AlignConsecutiveBitFields
AlignConsecutiveStyle AlignConsecutiveBitFields
Style of aligning consecutive bit field.
Definition: Format.h:359
clang::format::FormatStyle::AttributeMacros
std::vector< std::string > AttributeMacros
A vector of strings that should be interpreted as attributes/qualifiers instead of identifiers.
Definition: Format.h:942
clang::format::FormatStyle::GetLanguageStyle
llvm::Optional< FormatStyle > GetLanguageStyle(LanguageKind Language) const
Definition: Format.cpp:1748
clang
Definition: CalledOnceCheck.h:17
clang::format::FormatStyle::IncludeStyle
tooling::IncludeStyle IncludeStyle
Definition: Format.h:2349
clang::format::getLanguageName
StringRef getLanguageName(FormatStyle::LanguageKind Language)
Definition: Format.h:4247
clang::format::FormatStyle::SeparateDefinitionBlocks
SeparateDefinitionStyle SeparateDefinitionBlocks
Specifies the use of empty lines to separate definition blocks, including classes,...
Definition: Format.h:3175
clang::format::FormatStyle::RawStringFormats
std::vector< RawStringFormat > RawStringFormats
Defines hints for detecting supported languages code blocks in raw strings.
Definition: Format.h:3020
clang::format::getNoStyle
FormatStyle getNoStyle()
Returns style indicating formatting should be not applied at all.
Definition: Format.cpp:1575
clang::format::FormatStyle::LS_Cpp20
@ LS_Cpp20
Parse and format as C++20.
Definition: Format.h:3761
clang::format::FormatStyle::BS_Stroustrup
@ BS_Stroustrup
Like Attach, but break before function definitions, catch, and else.
Definition: Format.h:1259
clang::format::getMozillaStyle
FormatStyle getMozillaStyle()
Returns a format style complying with Mozilla's style guide: https://firefox-source-docs....
Definition: Format.cpp:1481
clang::format::FormatStyle::AllowShortFunctionsOnASingleLine
ShortFunctionStyle AllowShortFunctionsOnASingleLine
Dependent on the value, int f() { return 0; } can be put on a single line.
Definition: Format.h:666
clang::format::FormatStyle::PPDIS_None
@ PPDIS_None
Does not indent any directives.
Definition: Format.h:2447
clang::format::FormatStyle::AllowShortIfStatementsOnASingleLine
ShortIfStyle AllowShortIfStatementsOnASingleLine
Dependent on the value, if (a) return; can be put on a single line.
Definition: Format.h:737
clang::format::FormatStyle::LK_ObjC
@ LK_ObjC
Should be used for Objective-C, Objective-C++.
Definition: Format.h:2667
clang::tooling::IncludeStyle::IncludeBlocks
IncludeBlocksStyle IncludeBlocks
Dependent on the value, multiple #include blocks can be sorted as one and divided based on category.
Definition: IncludeStyle.h:54
clang::format::FormatStyle::BS_GNU
@ BS_GNU
Always break before braces and add an extra level of indentation to braces of control statements,...
Definition: Format.h:1442
clang::format::FormatStyle::SpacesBeforeTrailingComments
unsigned SpacesBeforeTrailingComments
The number of spaces before trailing line comments (// - comments).
Definition: Format.h:3591
clang::format::FormatStyle::LBI_Signature
@ LBI_Signature
Align lambda body relative to the lambda signature.
Definition: Format.h:2695
clang::format::FormatStyle::ReferenceAlignment
ReferenceAlignmentStyle ReferenceAlignment
Reference alignment style (overrides PointerAlignment for references).
Definition: Format.h:3046
clang::format::ParseError::DuplicateQualifierSpecified
@ DuplicateQualifierSpecified
clang::format::FormatStyle::BreakInheritanceList
BreakInheritanceListStyle BreakInheritanceList
The inheritance list style to use.
Definition: Format.h:1978
clang::format::FormatStyle::BraceWrappingFlags::AfterNamespace
bool AfterNamespace
Wrap namespace definitions.
Definition: Format.h:1612
clang::format::FormatStyle::ObjCSpaceBeforeProtocolList
bool ObjCSpaceBeforeProtocolList
Add a space in front of an Objective-C protocol list, i.e.
Definition: Format.h:2880
clang::format::FormatStyle::isCpp
bool isCpp() const
Definition: Format.h:2677
clang::format::FormatStyle::LS_Cpp11
@ LS_Cpp11
Parse and format as C++11.
Definition: Format.h:3755
clang::format::FormatStyle::BAS_AlwaysBreak
@ BAS_AlwaysBreak
Always break after an open bracket, if the parameters don't fit on a single line, e....
Definition: Format.h:84
clang::format::FormatStyle::ACS_AcrossEmptyLinesAndComments
@ ACS_AcrossEmptyLinesAndComments
Definition: Format.h:148
clang::format::FormatStyle::ELAAMS_Always
@ ELAAMS_Always
Always add empty line after access modifiers if there are none.
Definition: Format.h:2107
clang::format::ParseError
ParseError
Definition: Format.h:34
clang::format::FormatStyle::RAS_Middle
@ RAS_Middle
Align reference in the middle.
Definition: Format.h:3040
clang::format::FormatStyle::UT_AlignWithSpaces
@ UT_AlignWithSpaces
Use tabs for line continuation and indentation, and spaces for alignment.
Definition: Format.h:3809
clang::format::FormatStyle::ELBAMS_Always
@ ELBAMS_Always
Always add empty line before access modifiers unless access modifier is at the start of struct or cla...
Definition: Format.h:2172
clang::format::ParseErrorCategory::name
const char * name() const noexcept override
Definition: Format.cpp:947
clang::format::FormatStyle::SI_CaseSensitive
@ SI_CaseSensitive
Includes are sorted in an ASCIIbetical or case sensitive fashion.
Definition: Format.h:3218
clang::format::FormatStyle::ShortFunctionStyle
ShortFunctionStyle
Different styles for merging short functions containing at most one statement.
Definition: Format.h:617
clang::format::FormatStyle::PointerAlignment
PointerAlignmentStyle PointerAlignment
Pointer and reference alignment style.
Definition: Format.h:2945
clang::format::FormatStyle::BFCS_After
@ BFCS_After
Add space after the : only (space may be added before if needed for AlignConsecutiveBitFields).
Definition: Format.h:3736
clang::tooling::IncludeStyle
Style for sorting and grouping C++ include directives.
Definition: IncludeStyle.h:20
clang::format::FormatStyle::BraceWrappingFlags::BeforeWhile
bool BeforeWhile
Wrap before while.
Definition: Format.h:1719
clang::format::FormatStyle::JavaImportGroups
std::vector< std::string > JavaImportGroups
A vector of prefixes ordered by the desired groups for Java imports.
Definition: Format.h:2591
clang::format::FormatStyle::BinaryOperatorStyle
BinaryOperatorStyle
The style of breaking before or after binary operators.
Definition: Format.h:1020
clang::format::FormatStyle::FormatStyleSet::Clear
void Clear()
Definition: Format.cpp:1745
clang::format::FormatStyle::IEBS_Indent
@ IEBS_Indent
Indents extern blocks.
Definition: Format.h:2505
clang::format::FormatStyle::TypenameMacros
std::vector< std::string > TypenameMacros
A vector of macros that should be interpreted as type declarations instead of as function calls.
Definition: Format.h:2306
clang::format::FormatStyle::AlignConsecutiveStyle
AlignConsecutiveStyle
Styles for alignment of consecutive tokens.
Definition: Format.h:143
clang::format::FormatStyle::ForEachMacros
std::vector< std::string > ForEachMacros
A vector of macros that should be interpreted as foreach loops instead of as function calls.
Definition: Format.h:2268
clang::format::FormatStyle::SpaceBeforeParensOptions
SpaceBeforeParensCustom SpaceBeforeParensOptions
Control of individual space before parentheses.
Definition: Format.h:3543
clang::format::FormatStyle::BOS_None
@ BOS_None
Break after operators.
Definition: Format.h:1032
clang::format::ParseErrorCategory
Definition: Format.h:44
clang::format::FormatStyle::PackConstructorInitializers
PackConstructorInitializersStyle PackConstructorInitializers
The pack constructor initializers style to use.
Definition: Format.h:2237
clang::format::FormatStyle::EmptyLineBeforeAccessModifier
EmptyLineBeforeAccessModifierStyle EmptyLineBeforeAccessModifier
Defines in which cases to put empty line before access modifiers.
Definition: Format.h:2177
clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyFunction
bool SplitEmptyFunction
If false, empty function body can be put on a single line.
Definition: Format.h:1733
clang::format::FormatStyle::UseTab
UseTabStyle UseTab
The way to use tab characters in the resulting file.
Definition: Format.h:3822
clang::format::FormatStyle::IndentPPDirectives
PPDirectiveIndentStyle IndentPPDirectives
The preprocessor directive indenting style to use.
Definition: Format.h:2470
clang::format::FormatStyle::BILS_BeforeColon
@ BILS_BeforeColon
Break inheritance list before the colon and after the commas.
Definition: Format.h:1949
clang::format::FormatStyle::JavaScriptQuotes
JavaScriptQuoteStyle JavaScriptQuotes
The JavaScriptQuoteStyle to use for JavaScript strings.
Definition: Format.h:2618
clang::format::FormatStyle::LK_Json
@ LK_Json
Should be used for JSON.
Definition: Format.h:2665
clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyNamespace
bool SplitEmptyNamespace
If false, empty namespace body can be put on a single line.
Definition: Format.h:1755
clang::format::FormatStyle::BreakBeforeTernaryOperators
bool BreakBeforeTernaryOperators
If true, ternary operators will be placed after line breaks.
Definition: Format.h:1798
clang::format::FormatStyle::LanguageStandard
LanguageStandard
Supported language standards for parsing and formatting C++ constructs.
Definition: Format.h:3750
clang::format::FormatStyle::SIS_AllIfsAndElse
@ SIS_AllIfsAndElse
Always put short ifs, else ifs and else statements on the same line.
Definition: Format.h:732
clang::format::ParseErrorCategory::message
std::string message(int EV) const override
Definition: Format.cpp:951
clang::format::make_error_code
std::error_code make_error_code(ParseError e)
Definition: Format.cpp:938
clang::format::FormatStyle::BPS_Always
@ BPS_Always
Always bin-pack parameters.
Definition: Format.h:1014
clang::format::FormatStyle::SpaceBeforeParensCustom::BeforeNonEmptyParentheses
bool BeforeNonEmptyParentheses
If true, put a space before opening parentheses only if the parentheses are not empty.
Definition: Format.h:3510
clang::format::FormatStyle::BreakBeforeConceptDeclarations
bool BreakBeforeConceptDeclarations
If true, concept will be placed on a new line.
Definition: Format.h:1783
clang::format::FormatStyle::ACS_AcrossEmptyLines
@ ACS_AcrossEmptyLines
Definition: Format.h:146
clang::format::FormatStyle::SpaceInEmptyParentheses
bool SpaceInEmptyParentheses
If true, spaces may be inserted into ().
Definition: Format.h:3574
clang::format::FormatStyle::PenaltyIndentedWhitespace
unsigned PenaltyIndentedWhitespace
Penalty for each character of whitespace indentation (counted relative to leading non-whitespace colu...
Definition: Format.h:2922
clang::format::FormatStyle::UT_ForIndentation
@ UT_ForIndentation
Use tabs only for indentation.
Definition: Format.h:3803
clang::format::FormatStyle::SFS_None
@ SFS_None
Never merge functions into a single line.
Definition: Format.h:619
clang::format::FormatStyle::UT_ForContinuationAndIndentation
@ UT_ForContinuationAndIndentation
Fill all leading whitespace with tabs, and use spaces for alignment that appears within a line (e....
Definition: Format.h:3806
clang::format::FormatStyle::PPDIS_AfterHash
@ PPDIS_AfterHash
Indents directives after the hash.
Definition: Format.h:2456
clang::format::ParseError::InvalidQualifierSpecified
@ InvalidQualifierSpecified
clang::tooling::IncludeStyle::IncludeIsMainSourceRegex
std::string IncludeIsMainSourceRegex
Specify a regular expression for files being formatted that are allowed to be considered "main" in th...
Definition: IncludeStyle.h:153
clang::format::cleanup
tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>")
Clean up any erroneous/redundant code in the given Ranges in Code.
Definition: Format.cpp:3170
clang::format::FormatStyle::SLS_All
@ SLS_All
Merge all lambdas fitting on a single line.
Definition: Format.h:765
clang::format::FormatStyle::EmptyLineAfterAccessModifierStyle
EmptyLineAfterAccessModifierStyle
Different styles for empty line after access modifiers.
Definition: Format.h:2068
clang::format::FormatStyle::NI_None
@ NI_None
Don't indent in namespaces.
Definition: Format.h:2777
clang::format::FormatStyle::RTBS_None
@ RTBS_None
Break after return type automatically.
Definition: Format.h:802
clang::format::FormatStyle::RawStringFormat::Delimiters
std::vector< std::string > Delimiters
A list of raw string delimiters that match this language.
Definition: Format.h:2967
clang::format::FormatStyle::PCIS_CurrentLine
@ PCIS_CurrentLine
Put all constructor initializers on the current line if they fit.
Definition: Format.h:2218
clang::format::ParseError::BinPackTrailingCommaConflict
@ BinPackTrailingCommaConflict
clang::format::FormatStyle::BraceWrappingFlags::AfterCaseLabel
bool AfterCaseLabel
Wrap case labels.
Definition: Format.h:1555
clang::format::FormatStyle::BS_Attach
@ BS_Attach
Always attach braces to surrounding context.
Definition: Format.h:1109
clang::format::getGNUStyle
FormatStyle getGNUStyle()
Returns a format style complying with GNU Coding Standards: http://www.gnu.org/prep/standards/standar...
Definition: Format.cpp:1530
clang::format::FormatStyle::BreakTemplateDeclarationsStyle
BreakTemplateDeclarationsStyle
Different ways to break after the template declaration.
Definition: Format.h:886
clang::format::FormatStyle::PenaltyBreakBeforeFirstCallParameter
unsigned PenaltyBreakBeforeFirstCallParameter
The penalty for breaking a function call after call(.
Definition: Format.h:2888
IncludeStyle.h
clang::format::FormattingAttemptStatus::FormatComplete
bool FormatComplete
A value of false means that any of the affected ranges were not formatted due to a non-recoverable sy...
Definition: Format.h:4119
clang::format::FormatStyle::PPDIS_BeforeHash
@ PPDIS_BeforeHash
Indents directives before the hash.
Definition: Format.h:2465
clang::format::FormatStyle::DeriveLineEnding
bool DeriveLineEnding
Analyze the formatted file for the most used line ending (\r\n or \n).
Definition: Format.h:2051
clang::format::FormatStyle::RawStringFormat
See documentation of RawStringFormats.
Definition: Format.h:2963
clang::format::FormatStyle::QAS_Right
@ QAS_Right
Change specifiers/qualifiers to be right-aligned.
Definition: Format.h:1892
clang::format::FormatStyle::BitFieldColonSpacingStyle
BitFieldColonSpacingStyle
Styles for adding spacing around : in bitfield definitions.
Definition: Format.h:3714
clang::format::FormatStyle::PenaltyBreakComment
unsigned PenaltyBreakComment
The penalty for each line break introduced inside a comment.
Definition: Format.h:2892
clang::format::FormatStyle::ELBAMS_Never
@ ELBAMS_Never
Remove all empty lines before access modifiers.
Definition: Format.h:2132