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