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