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