clang  15.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 7
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  /// The style of wrapping parameters on the same line (bin-packed) or
876  /// on one line each.
877  enum BinPackStyle : int8_t {
878  /// Automatically determine parameter bin-packing behavior.
880  /// Always bin-pack parameters.
882  /// Never bin-pack parameters.
884  };
885 
886  /// The style of breaking before or after binary operators.
887  enum BinaryOperatorStyle : int8_t {
888  /// Break after operators.
889  /// \code
890  /// LooooooooooongType loooooooooooooooooooooongVariable =
891  /// someLooooooooooooooooongFunction();
892  ///
893  /// bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
894  /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ==
895  /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
896  /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >
897  /// ccccccccccccccccccccccccccccccccccccccccc;
898  /// \endcode
900  /// Break before operators that aren't assignments.
901  /// \code
902  /// LooooooooooongType loooooooooooooooooooooongVariable =
903  /// someLooooooooooooooooongFunction();
904  ///
905  /// bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
906  /// + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
907  /// == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
908  /// && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
909  /// > ccccccccccccccccccccccccccccccccccccccccc;
910  /// \endcode
912  /// Break before operators.
913  /// \code
914  /// LooooooooooongType loooooooooooooooooooooongVariable
915  /// = someLooooooooooooooooongFunction();
916  ///
917  /// bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
918  /// + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
919  /// == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
920  /// && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
921  /// > ccccccccccccccccccccccccccccccccccccccccc;
922  /// \endcode
924  };
925 
926  /// The way to wrap binary operators.
927  /// \version 3.6
929 
930  /// Different ways to attach braces to their surrounding context.
931  enum BraceBreakingStyle : int8_t {
932  /// Always attach braces to surrounding context.
933  /// \code
934  /// namespace N {
935  /// enum E {
936  /// E1,
937  /// E2,
938  /// };
939  ///
940  /// class C {
941  /// public:
942  /// C();
943  /// };
944  ///
945  /// bool baz(int i) {
946  /// try {
947  /// do {
948  /// switch (i) {
949  /// case 1: {
950  /// foobar();
951  /// break;
952  /// }
953  /// default: {
954  /// break;
955  /// }
956  /// }
957  /// } while (--i);
958  /// return true;
959  /// } catch (...) {
960  /// handleError();
961  /// return false;
962  /// }
963  /// }
964  ///
965  /// void foo(bool b) {
966  /// if (b) {
967  /// baz(2);
968  /// } else {
969  /// baz(5);
970  /// }
971  /// }
972  ///
973  /// void bar() { foo(true); }
974  /// } // namespace N
975  /// \endcode
977  /// Like ``Attach``, but break before braces on function, namespace and
978  /// class definitions.
979  /// \code
980  /// namespace N
981  /// {
982  /// enum E {
983  /// E1,
984  /// E2,
985  /// };
986  ///
987  /// class C
988  /// {
989  /// public:
990  /// C();
991  /// };
992  ///
993  /// bool baz(int i)
994  /// {
995  /// try {
996  /// do {
997  /// switch (i) {
998  /// case 1: {
999  /// foobar();
1000  /// break;
1001  /// }
1002  /// default: {
1003  /// break;
1004  /// }
1005  /// }
1006  /// } while (--i);
1007  /// return true;
1008  /// } catch (...) {
1009  /// handleError();
1010  /// return false;
1011  /// }
1012  /// }
1013  ///
1014  /// void foo(bool b)
1015  /// {
1016  /// if (b) {
1017  /// baz(2);
1018  /// } else {
1019  /// baz(5);
1020  /// }
1021  /// }
1022  ///
1023  /// void bar() { foo(true); }
1024  /// } // namespace N
1025  /// \endcode
1027  /// Like ``Attach``, but break before braces on enum, function, and record
1028  /// definitions.
1029  /// \code
1030  /// namespace N {
1031  /// enum E
1032  /// {
1033  /// E1,
1034  /// E2,
1035  /// };
1036  ///
1037  /// class C
1038  /// {
1039  /// public:
1040  /// C();
1041  /// };
1042  ///
1043  /// bool baz(int i)
1044  /// {
1045  /// try {
1046  /// do {
1047  /// switch (i) {
1048  /// case 1: {
1049  /// foobar();
1050  /// break;
1051  /// }
1052  /// default: {
1053  /// break;
1054  /// }
1055  /// }
1056  /// } while (--i);
1057  /// return true;
1058  /// } catch (...) {
1059  /// handleError();
1060  /// return false;
1061  /// }
1062  /// }
1063  ///
1064  /// void foo(bool b)
1065  /// {
1066  /// if (b) {
1067  /// baz(2);
1068  /// } else {
1069  /// baz(5);
1070  /// }
1071  /// }
1072  ///
1073  /// void bar() { foo(true); }
1074  /// } // namespace N
1075  /// \endcode
1077  /// Like ``Attach``, but break before function definitions, ``catch``, and
1078  /// ``else``.
1079  /// \code
1080  /// namespace N {
1081  /// enum E {
1082  /// E1,
1083  /// E2,
1084  /// };
1085  ///
1086  /// class C {
1087  /// public:
1088  /// C();
1089  /// };
1090  ///
1091  /// bool baz(int i)
1092  /// {
1093  /// try {
1094  /// do {
1095  /// switch (i) {
1096  /// case 1: {
1097  /// foobar();
1098  /// break;
1099  /// }
1100  /// default: {
1101  /// break;
1102  /// }
1103  /// }
1104  /// } while (--i);
1105  /// return true;
1106  /// }
1107  /// catch (...) {
1108  /// handleError();
1109  /// return false;
1110  /// }
1111  /// }
1112  ///
1113  /// void foo(bool b)
1114  /// {
1115  /// if (b) {
1116  /// baz(2);
1117  /// }
1118  /// else {
1119  /// baz(5);
1120  /// }
1121  /// }
1122  ///
1123  /// void bar() { foo(true); }
1124  /// } // namespace N
1125  /// \endcode
1127  /// Always break before braces.
1128  /// \code
1129  /// namespace N
1130  /// {
1131  /// enum E
1132  /// {
1133  /// E1,
1134  /// E2,
1135  /// };
1136  ///
1137  /// class C
1138  /// {
1139  /// public:
1140  /// C();
1141  /// };
1142  ///
1143  /// bool baz(int i)
1144  /// {
1145  /// try
1146  /// {
1147  /// do
1148  /// {
1149  /// switch (i)
1150  /// {
1151  /// case 1:
1152  /// {
1153  /// foobar();
1154  /// break;
1155  /// }
1156  /// default:
1157  /// {
1158  /// break;
1159  /// }
1160  /// }
1161  /// } while (--i);
1162  /// return true;
1163  /// }
1164  /// catch (...)
1165  /// {
1166  /// handleError();
1167  /// return false;
1168  /// }
1169  /// }
1170  ///
1171  /// void foo(bool b)
1172  /// {
1173  /// if (b)
1174  /// {
1175  /// baz(2);
1176  /// }
1177  /// else
1178  /// {
1179  /// baz(5);
1180  /// }
1181  /// }
1182  ///
1183  /// void bar() { foo(true); }
1184  /// } // namespace N
1185  /// \endcode
1187  /// Like ``Allman`` but always indent braces and line up code with braces.
1188  /// \code
1189  /// namespace N
1190  /// {
1191  /// enum E
1192  /// {
1193  /// E1,
1194  /// E2,
1195  /// };
1196  ///
1197  /// class C
1198  /// {
1199  /// public:
1200  /// C();
1201  /// };
1202  ///
1203  /// bool baz(int i)
1204  /// {
1205  /// try
1206  /// {
1207  /// do
1208  /// {
1209  /// switch (i)
1210  /// {
1211  /// case 1:
1212  /// {
1213  /// foobar();
1214  /// break;
1215  /// }
1216  /// default:
1217  /// {
1218  /// break;
1219  /// }
1220  /// }
1221  /// } while (--i);
1222  /// return true;
1223  /// }
1224  /// catch (...)
1225  /// {
1226  /// handleError();
1227  /// return false;
1228  /// }
1229  /// }
1230  ///
1231  /// void foo(bool b)
1232  /// {
1233  /// if (b)
1234  /// {
1235  /// baz(2);
1236  /// }
1237  /// else
1238  /// {
1239  /// baz(5);
1240  /// }
1241  /// }
1242  ///
1243  /// void bar() { foo(true); }
1244  /// } // namespace N
1245  /// \endcode
1247  /// Always break before braces and add an extra level of indentation to
1248  /// braces of control statements, not to those of class, function
1249  /// or other definitions.
1250  /// \code
1251  /// namespace N
1252  /// {
1253  /// enum E
1254  /// {
1255  /// E1,
1256  /// E2,
1257  /// };
1258  ///
1259  /// class C
1260  /// {
1261  /// public:
1262  /// C();
1263  /// };
1264  ///
1265  /// bool baz(int i)
1266  /// {
1267  /// try
1268  /// {
1269  /// do
1270  /// {
1271  /// switch (i)
1272  /// {
1273  /// case 1:
1274  /// {
1275  /// foobar();
1276  /// break;
1277  /// }
1278  /// default:
1279  /// {
1280  /// break;
1281  /// }
1282  /// }
1283  /// }
1284  /// while (--i);
1285  /// return true;
1286  /// }
1287  /// catch (...)
1288  /// {
1289  /// handleError();
1290  /// return false;
1291  /// }
1292  /// }
1293  ///
1294  /// void foo(bool b)
1295  /// {
1296  /// if (b)
1297  /// {
1298  /// baz(2);
1299  /// }
1300  /// else
1301  /// {
1302  /// baz(5);
1303  /// }
1304  /// }
1305  ///
1306  /// void bar() { foo(true); }
1307  /// } // namespace N
1308  /// \endcode
1310  /// Like ``Attach``, but break before functions.
1311  /// \code
1312  /// namespace N {
1313  /// enum E {
1314  /// E1,
1315  /// E2,
1316  /// };
1317  ///
1318  /// class C {
1319  /// public:
1320  /// C();
1321  /// };
1322  ///
1323  /// bool baz(int i)
1324  /// {
1325  /// try {
1326  /// do {
1327  /// switch (i) {
1328  /// case 1: {
1329  /// foobar();
1330  /// break;
1331  /// }
1332  /// default: {
1333  /// break;
1334  /// }
1335  /// }
1336  /// } while (--i);
1337  /// return true;
1338  /// } catch (...) {
1339  /// handleError();
1340  /// return false;
1341  /// }
1342  /// }
1343  ///
1344  /// void foo(bool b)
1345  /// {
1346  /// if (b) {
1347  /// baz(2);
1348  /// } else {
1349  /// baz(5);
1350  /// }
1351  /// }
1352  ///
1353  /// void bar() { foo(true); }
1354  /// } // namespace N
1355  /// \endcode
1357  /// Configure each individual brace in `BraceWrapping`.
1359  };
1360 
1361  /// The brace breaking style to use.
1362  /// \version 3.7
1364 
1365  /// Different ways to wrap braces after control statements.
1367  /// Never wrap braces after a control statement.
1368  /// \code
1369  /// if (foo()) {
1370  /// } else {
1371  /// }
1372  /// for (int i = 0; i < 10; ++i) {
1373  /// }
1374  /// \endcode
1376  /// Only wrap braces after a multi-line control statement.
1377  /// \code
1378  /// if (foo && bar &&
1379  /// baz)
1380  /// {
1381  /// quux();
1382  /// }
1383  /// while (foo || bar) {
1384  /// }
1385  /// \endcode
1387  /// Always wrap braces after a control statement.
1388  /// \code
1389  /// if (foo())
1390  /// {
1391  /// } else
1392  /// {}
1393  /// for (int i = 0; i < 10; ++i)
1394  /// {}
1395  /// \endcode
1397  };
1398 
1399  /// Precise control over the wrapping of braces.
1400  /// \code
1401  /// # Should be declared this way:
1402  /// BreakBeforeBraces: Custom
1403  /// BraceWrapping:
1404  /// AfterClass: true
1405  /// \endcode
1407  /// Wrap case labels.
1408  /// \code
1409  /// false: true:
1410  /// switch (foo) { vs. switch (foo) {
1411  /// case 1: { case 1:
1412  /// bar(); {
1413  /// break; bar();
1414  /// } break;
1415  /// default: { }
1416  /// plop(); default:
1417  /// } {
1418  /// } plop();
1419  /// }
1420  /// }
1421  /// \endcode
1423  /// Wrap class definitions.
1424  /// \code
1425  /// true:
1426  /// class foo {};
1427  ///
1428  /// false:
1429  /// class foo
1430  /// {};
1431  /// \endcode
1433 
1434  /// Wrap control statements (``if``/``for``/``while``/``switch``/..).
1436  /// Wrap enum definitions.
1437  /// \code
1438  /// true:
1439  /// enum X : int
1440  /// {
1441  /// B
1442  /// };
1443  ///
1444  /// false:
1445  /// enum X : int { B };
1446  /// \endcode
1448  /// Wrap function definitions.
1449  /// \code
1450  /// true:
1451  /// void foo()
1452  /// {
1453  /// bar();
1454  /// bar2();
1455  /// }
1456  ///
1457  /// false:
1458  /// void foo() {
1459  /// bar();
1460  /// bar2();
1461  /// }
1462  /// \endcode
1464  /// Wrap namespace definitions.
1465  /// \code
1466  /// true:
1467  /// namespace
1468  /// {
1469  /// int foo();
1470  /// int bar();
1471  /// }
1472  ///
1473  /// false:
1474  /// namespace {
1475  /// int foo();
1476  /// int bar();
1477  /// }
1478  /// \endcode
1480  /// Wrap ObjC definitions (interfaces, implementations...).
1481  /// \note @autoreleasepool and @synchronized blocks are wrapped
1482  /// according to `AfterControlStatement` flag.
1484  /// Wrap struct definitions.
1485  /// \code
1486  /// true:
1487  /// struct foo
1488  /// {
1489  /// int x;
1490  /// };
1491  ///
1492  /// false:
1493  /// struct foo {
1494  /// int x;
1495  /// };
1496  /// \endcode
1498  /// Wrap union definitions.
1499  /// \code
1500  /// true:
1501  /// union foo
1502  /// {
1503  /// int x;
1504  /// }
1505  ///
1506  /// false:
1507  /// union foo {
1508  /// int x;
1509  /// }
1510  /// \endcode
1512  /// Wrap extern blocks.
1513  /// \code
1514  /// true:
1515  /// extern "C"
1516  /// {
1517  /// int foo();
1518  /// }
1519  ///
1520  /// false:
1521  /// extern "C" {
1522  /// int foo();
1523  /// }
1524  /// \endcode
1525  bool AfterExternBlock; // Partially superseded by IndentExternBlock
1526  /// Wrap before ``catch``.
1527  /// \code
1528  /// true:
1529  /// try {
1530  /// foo();
1531  /// }
1532  /// catch () {
1533  /// }
1534  ///
1535  /// false:
1536  /// try {
1537  /// foo();
1538  /// } catch () {
1539  /// }
1540  /// \endcode
1542  /// Wrap before ``else``.
1543  /// \code
1544  /// true:
1545  /// if (foo()) {
1546  /// }
1547  /// else {
1548  /// }
1549  ///
1550  /// false:
1551  /// if (foo()) {
1552  /// } else {
1553  /// }
1554  /// \endcode
1556  /// Wrap lambda block.
1557  /// \code
1558  /// true:
1559  /// connect(
1560  /// []()
1561  /// {
1562  /// foo();
1563  /// bar();
1564  /// });
1565  ///
1566  /// false:
1567  /// connect([]() {
1568  /// foo();
1569  /// bar();
1570  /// });
1571  /// \endcode
1573  /// Wrap before ``while``.
1574  /// \code
1575  /// true:
1576  /// do {
1577  /// foo();
1578  /// }
1579  /// while (1);
1580  ///
1581  /// false:
1582  /// do {
1583  /// foo();
1584  /// } while (1);
1585  /// \endcode
1587  /// Indent the wrapped braces themselves.
1589  /// If ``false``, empty function body can be put on a single line.
1590  /// This option is used only if the opening brace of the function has
1591  /// already been wrapped, i.e. the `AfterFunction` brace wrapping mode is
1592  /// set, and the function could/should not be put on a single line (as per
1593  /// `AllowShortFunctionsOnASingleLine` and constructor formatting options).
1594  /// \code
1595  /// false: true:
1596  /// int f() vs. int f()
1597  /// {} {
1598  /// }
1599  /// \endcode
1600  ///
1602  /// If ``false``, empty record (e.g. class, struct or union) body
1603  /// can be put on a single line. This option is used only if the opening
1604  /// brace of the record has already been wrapped, i.e. the `AfterClass`
1605  /// (for classes) brace wrapping mode is set.
1606  /// \code
1607  /// false: true:
1608  /// class Foo vs. class Foo
1609  /// {} {
1610  /// }
1611  /// \endcode
1612  ///
1614  /// If ``false``, empty namespace body can be put on a single line.
1615  /// This option is used only if the opening brace of the namespace has
1616  /// already been wrapped, i.e. the `AfterNamespace` brace wrapping mode is
1617  /// set.
1618  /// \code
1619  /// false: true:
1620  /// namespace Foo vs. namespace Foo
1621  /// {} {
1622  /// }
1623  /// \endcode
1624  ///
1626  };
1627 
1628  /// Control of individual brace wrapping cases.
1629  ///
1630  /// If ``BreakBeforeBraces`` is set to ``BS_Custom``, use this to specify how
1631  /// each individual brace case should be handled. Otherwise, this is ignored.
1632  /// \code{.yaml}
1633  /// # Example of usage:
1634  /// BreakBeforeBraces: Custom
1635  /// BraceWrapping:
1636  /// AfterEnum: true
1637  /// AfterStruct: false
1638  /// SplitEmptyFunction: false
1639  /// \endcode
1640  /// \version 3.8
1642 
1643  /// Different ways to break before concept declarations.
1645  /// Keep the template declaration line together with ``concept``.
1646  /// \code
1647  /// template <typename T> concept C = ...;
1648  /// \endcode
1650  /// Breaking between template declaration and ``concept`` is allowed. The
1651  /// actual behavior depends on the content and line breaking rules and
1652  /// penalities.
1654  /// Always break before ``concept``, putting it in the line after the
1655  /// template declaration.
1656  /// \code
1657  /// template <typename T>
1658  /// concept C = ...;
1659  /// \endcode
1661  };
1662 
1663  /// The concept declaration style to use.
1664  /// \version 12
1666 
1667  /// If ``true``, ternary operators will be placed after line breaks.
1668  /// \code
1669  /// true:
1670  /// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
1671  /// ? firstValue
1672  /// : SecondValueVeryVeryVeryVeryLong;
1673  ///
1674  /// false:
1675  /// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?
1676  /// firstValue :
1677  /// SecondValueVeryVeryVeryVeryLong;
1678  /// \endcode
1679  /// \version 3.7
1681 
1682  /// Different ways to break initializers.
1684  /// Break constructor initializers before the colon and after the commas.
1685  /// \code
1686  /// Constructor()
1687  /// : initializer1(),
1688  /// initializer2()
1689  /// \endcode
1691  /// Break constructor initializers before the colon and commas, and align
1692  /// the commas with the colon.
1693  /// \code
1694  /// Constructor()
1695  /// : initializer1()
1696  /// , initializer2()
1697  /// \endcode
1699  /// Break constructor initializers after the colon and commas.
1700  /// \code
1701  /// Constructor() :
1702  /// initializer1(),
1703  /// initializer2()
1704  /// \endcode
1706  };
1707 
1708  /// The break constructor initializers style to use.
1709  /// \version 5
1711 
1712  /// Break after each annotation on a field in Java files.
1713  /// \code{.java}
1714  /// true: false:
1715  /// @Partial vs. @Partial @Mock DataLoad loader;
1716  /// @Mock
1717  /// DataLoad loader;
1718  /// \endcode
1719  /// \version 3.8
1721 
1722  /// Allow breaking string literals when formatting.
1723  /// \code
1724  /// true:
1725  /// const char* x = "veryVeryVeryVeryVeryVe"
1726  /// "ryVeryVeryVeryVeryVery"
1727  /// "VeryLongString";
1728  ///
1729  /// false:
1730  /// const char* x =
1731  /// "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
1732  /// \endcode
1733  /// \version 3.9
1735 
1736  /// The column limit.
1737  ///
1738  /// A column limit of ``0`` means that there is no column limit. In this case,
1739  /// clang-format will respect the input's line breaking decisions within
1740  /// statements unless they contradict other rules.
1741  /// \version 3.7
1742  unsigned ColumnLimit;
1743 
1744  /// A regular expression that describes comments with special meaning,
1745  /// which should not be split into lines or otherwise changed.
1746  /// \code
1747  /// // CommentPragmas: '^ FOOBAR pragma:'
1748  /// // Will leave the following line unaffected
1749  /// #include <vector> // FOOBAR pragma: keep
1750  /// \endcode
1751  /// \version 3.7
1753 
1754  /// Different specifiers and qualifiers alignment styles.
1755  enum QualifierAlignmentStyle : int8_t {
1756  /// Don't change specifiers/qualifiers to either Left or Right alignment
1757  /// (default).
1758  /// \code
1759  /// int const a;
1760  /// const int *a;
1761  /// \endcode
1763  /// Change specifiers/qualifiers to be left-aligned.
1764  /// \code
1765  /// const int a;
1766  /// const int *a;
1767  /// \endcode
1769  /// Change specifiers/qualifiers to be right-aligned.
1770  /// \code
1771  /// int const a;
1772  /// int const *a;
1773  /// \endcode
1775  /// Change specifiers/qualifiers to be aligned based on ``QualifierOrder``.
1776  /// With:
1777  /// \code{.yaml}
1778  /// QualifierOrder: ['inline', 'static' , 'type', 'const']
1779  /// \endcode
1780  ///
1781  /// \code
1782  ///
1783  /// int const a;
1784  /// int const *a;
1785  /// \endcode
1787  };
1788 
1789  /// Different ways to arrange specifiers and qualifiers (e.g. const/volatile).
1790  /// \warning
1791  /// Setting ``QualifierAlignment`` to something other than `Leave`, COULD
1792  /// lead to incorrect code formatting due to incorrect decisions made due to
1793  /// clang-formats lack of complete semantic information.
1794  /// As such extra care should be taken to review code changes made by the use
1795  /// of this option.
1796  /// \endwarning
1797  /// \version 14
1799 
1800  /// The order in which the qualifiers appear.
1801  /// Order is an array that can contain any of the following:
1802  ///
1803  /// * const
1804  /// * inline
1805  /// * static
1806  /// * constexpr
1807  /// * volatile
1808  /// * restrict
1809  /// * type
1810  ///
1811  /// Note: it MUST contain 'type'.
1812  /// Items to the left of 'type' will be placed to the left of the type and
1813  /// aligned in the order supplied. Items to the right of 'type' will be placed
1814  /// to the right of the type and aligned in the order supplied.
1815  ///
1816  /// \code{.yaml}
1817  /// QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ]
1818  /// \endcode
1819  /// \version 14
1820  std::vector<std::string> QualifierOrder;
1821 
1822  /// Different ways to break inheritance list.
1824  /// Break inheritance list before the colon and after the commas.
1825  /// \code
1826  /// class Foo
1827  /// : Base1,
1828  /// Base2
1829  /// {};
1830  /// \endcode
1832  /// Break inheritance list before the colon and commas, and align
1833  /// the commas with the colon.
1834  /// \code
1835  /// class Foo
1836  /// : Base1
1837  /// , Base2
1838  /// {};
1839  /// \endcode
1841  /// Break inheritance list after the colon and commas.
1842  /// \code
1843  /// class Foo :
1844  /// Base1,
1845  /// Base2
1846  /// {};
1847  /// \endcode
1849  /// Break inheritance list only after the commas.
1850  /// \code
1851  /// class Foo : Base1,
1852  /// Base2
1853  /// {};
1854  /// \endcode
1856  };
1857 
1858  /// The inheritance list style to use.
1859  /// \version 7
1861 
1862  /// If ``true``, consecutive namespace declarations will be on the same
1863  /// line. If ``false``, each namespace is declared on a new line.
1864  /// \code
1865  /// true:
1866  /// namespace Foo { namespace Bar {
1867  /// }}
1868  ///
1869  /// false:
1870  /// namespace Foo {
1871  /// namespace Bar {
1872  /// }
1873  /// }
1874  /// \endcode
1875  ///
1876  /// If it does not fit on a single line, the overflowing namespaces get
1877  /// wrapped:
1878  /// \code
1879  /// namespace Foo { namespace Bar {
1880  /// namespace Extra {
1881  /// }}}
1882  /// \endcode
1883  /// \version 5
1885 
1886  /// This option is **deprecated**. See ``CurrentLine`` of
1887  /// ``PackConstructorInitializers``.
1888  /// \version 3.7
1889  // bool ConstructorInitializerAllOnOneLineOrOnePerLine;
1890 
1891  /// The number of characters to use for indentation of constructor
1892  /// initializer lists as well as inheritance lists.
1893  /// \version 3.7
1895 
1896  /// Indent width for line continuations.
1897  /// \code
1898  /// ContinuationIndentWidth: 2
1899  ///
1900  /// int i = // VeryVeryVeryVeryVeryLongComment
1901  /// longFunction( // Again a long comment
1902  /// arg);
1903  /// \endcode
1904  /// \version 3.7
1906 
1907  /// If ``true``, format braced lists as best suited for C++11 braced
1908  /// lists.
1909  ///
1910  /// Important differences:
1911  /// - No spaces inside the braced list.
1912  /// - No line break before the closing brace.
1913  /// - Indentation with the continuation indent, not with the block indent.
1914  ///
1915  /// Fundamentally, C++11 braced lists are formatted exactly like function
1916  /// calls would be formatted in their place. If the braced list follows a name
1917  /// (e.g. a type or variable name), clang-format formats as if the ``{}`` were
1918  /// the parentheses of a function call with that name. If there is no name,
1919  /// a zero-length name is assumed.
1920  /// \code
1921  /// true: false:
1922  /// vector<int> x{1, 2, 3, 4}; vs. vector<int> x{ 1, 2, 3, 4 };
1923  /// vector<T> x{{}, {}, {}, {}}; vector<T> x{ {}, {}, {}, {} };
1924  /// f(MyMap[{composite, key}]); f(MyMap[{ composite, key }]);
1925  /// new int[3]{1, 2, 3}; new int[3]{ 1, 2, 3 };
1926  /// \endcode
1927  /// \version 3.4
1929 
1930  /// \brief Analyze the formatted file for the most used line ending (``\r\n``
1931  /// or ``\n``). ``UseCRLF`` is only used as a fallback if none can be derived.
1932  /// \version 10
1934 
1935  /// If ``true``, analyze the formatted file for the most common
1936  /// alignment of ``&`` and ``*``.
1937  /// Pointer and reference alignment styles are going to be updated according
1938  /// to the preferences found in the file.
1939  /// ``PointerAlignment`` is then used only as fallback.
1940  /// \version 3.7
1942 
1943  /// Disables formatting completely.
1944  /// \version 3.7
1946 
1947  /// Different styles for empty line after access modifiers.
1948  /// ``EmptyLineBeforeAccessModifier`` configuration handles the number of
1949  /// empty lines between two access modifiers.
1951  /// Remove all empty lines after access modifiers.
1952  /// \code
1953  /// struct foo {
1954  /// private:
1955  /// int i;
1956  /// protected:
1957  /// int j;
1958  /// /* comment */
1959  /// public:
1960  /// foo() {}
1961  /// private:
1962  /// protected:
1963  /// };
1964  /// \endcode
1966  /// Keep existing empty lines after access modifiers.
1967  /// MaxEmptyLinesToKeep is applied instead.
1969  /// Always add empty line after access modifiers if there are none.
1970  /// MaxEmptyLinesToKeep is applied also.
1971  /// \code
1972  /// struct foo {
1973  /// private:
1974  ///
1975  /// int i;
1976  /// protected:
1977  ///
1978  /// int j;
1979  /// /* comment */
1980  /// public:
1981  ///
1982  /// foo() {}
1983  /// private:
1984  ///
1985  /// protected:
1986  ///
1987  /// };
1988  /// \endcode
1990  };
1991 
1992  /// Defines when to put an empty line after access modifiers.
1993  /// ``EmptyLineBeforeAccessModifier`` configuration handles the number of
1994  /// empty lines between two access modifiers.
1995  /// \version 13
1997 
1998  /// Different styles for empty line before access modifiers.
2000  /// Remove all empty lines before access modifiers.
2001  /// \code
2002  /// struct foo {
2003  /// private:
2004  /// int i;
2005  /// protected:
2006  /// int j;
2007  /// /* comment */
2008  /// public:
2009  /// foo() {}
2010  /// private:
2011  /// protected:
2012  /// };
2013  /// \endcode
2015  /// Keep existing empty lines before access modifiers.
2017  /// Add empty line only when access modifier starts a new logical block.
2018  /// Logical block is a group of one or more member fields or functions.
2019  /// \code
2020  /// struct foo {
2021  /// private:
2022  /// int i;
2023  ///
2024  /// protected:
2025  /// int j;
2026  /// /* comment */
2027  /// public:
2028  /// foo() {}
2029  ///
2030  /// private:
2031  /// protected:
2032  /// };
2033  /// \endcode
2035  /// Always add empty line before access modifiers unless access modifier
2036  /// is at the start of struct or class definition.
2037  /// \code
2038  /// struct foo {
2039  /// private:
2040  /// int i;
2041  ///
2042  /// protected:
2043  /// int j;
2044  /// /* comment */
2045  ///
2046  /// public:
2047  /// foo() {}
2048  ///
2049  /// private:
2050  ///
2051  /// protected:
2052  /// };
2053  /// \endcode
2055  };
2056 
2057  /// Defines in which cases to put empty line before access modifiers.
2058  /// \version 12
2060 
2061  /// If ``true``, clang-format detects whether function calls and
2062  /// definitions are formatted with one parameter per line.
2063  ///
2064  /// Each call can be bin-packed, one-per-line or inconclusive. If it is
2065  /// inconclusive, e.g. completely on one line, but a decision needs to be
2066  /// made, clang-format analyzes whether there are other bin-packed cases in
2067  /// the input file and act accordingly.
2068  ///
2069  /// NOTE: This is an experimental flag, that might go away or be renamed. Do
2070  /// not use this in config files, etc. Use at your own risk.
2071  /// \version 3.7
2073 
2074  /// Different ways to try to fit all constructor initializers on a line.
2076  /// Always put each constructor initializer on its own line.
2077  /// \code
2078  /// Constructor()
2079  /// : a(),
2080  /// b()
2081  /// \endcode
2083  /// Bin-pack constructor initializers.
2084  /// \code
2085  /// Constructor()
2086  /// : aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(),
2087  /// cccccccccccccccccccc()
2088  /// \endcode
2090  /// Put all constructor initializers on the current line if they fit.
2091  /// Otherwise, put each one on its own line.
2092  /// \code
2093  /// Constructor() : a(), b()
2094  ///
2095  /// Constructor()
2096  /// : aaaaaaaaaaaaaaaaaaaa(),
2097  /// bbbbbbbbbbbbbbbbbbbb(),
2098  /// ddddddddddddd()
2099  /// \endcode
2101  /// Same as ``PCIS_CurrentLine`` except that if all constructor initializers
2102  /// do not fit on the current line, try to fit them on the next line.
2103  /// \code
2104  /// Constructor() : a(), b()
2105  ///
2106  /// Constructor()
2107  /// : aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(), ddddddddddddd()
2108  ///
2109  /// Constructor()
2110  /// : aaaaaaaaaaaaaaaaaaaa(),
2111  /// bbbbbbbbbbbbbbbbbbbb(),
2112  /// cccccccccccccccccccc()
2113  /// \endcode
2115  };
2116 
2117  /// The pack constructor initializers style to use.
2118  /// \version 14;
2120 
2121  /// If ``true``, clang-format adds missing namespace end comments for
2122  /// short namespaces and fixes invalid existing ones. Short ones are
2123  /// controlled by "ShortNamespaceLines".
2124  /// \code
2125  /// true: false:
2126  /// namespace a { vs. namespace a {
2127  /// foo(); foo();
2128  /// bar(); bar();
2129  /// } // namespace a }
2130  /// \endcode
2131  /// \version 5
2133 
2134  /// A vector of macros that should be interpreted as foreach loops
2135  /// instead of as function calls.
2136  ///
2137  /// These are expected to be macros of the form:
2138  /// \code
2139  /// FOREACH(<variable-declaration>, ...)
2140  /// <loop-body>
2141  /// \endcode
2142  ///
2143  /// In the .clang-format configuration file, this can be configured like:
2144  /// \code{.yaml}
2145  /// ForEachMacros: ['RANGES_FOR', 'FOREACH']
2146  /// \endcode
2147  ///
2148  /// For example: BOOST_FOREACH.
2149  /// \version 3.7
2150  std::vector<std::string> ForEachMacros;
2151 
2152  /// A vector of macros that should be interpreted as conditionals
2153  /// instead of as function calls.
2154  ///
2155  /// These are expected to be macros of the form:
2156  /// \code
2157  /// IF(...)
2158  /// <conditional-body>
2159  /// else IF(...)
2160  /// <conditional-body>
2161  /// \endcode
2162  ///
2163  /// In the .clang-format configuration file, this can be configured like:
2164  /// \code{.yaml}
2165  /// IfMacros: ['IF']
2166  /// \endcode
2167  ///
2168  /// For example: `KJ_IF_MAYBE
2169  /// <https://github.com/capnproto/capnproto/blob/master/kjdoc/tour.md#maybes>`_
2170  /// \version 13
2171  std::vector<std::string> IfMacros;
2172 
2173  /// \brief A vector of macros that should be interpreted as type declarations
2174  /// instead of as function calls.
2175  ///
2176  /// These are expected to be macros of the form:
2177  /// \code
2178  /// STACK_OF(...)
2179  /// \endcode
2180  ///
2181  /// In the .clang-format configuration file, this can be configured like:
2182  /// \code{.yaml}
2183  /// TypenameMacros: ['STACK_OF', 'LIST']
2184  /// \endcode
2185  ///
2186  /// For example: OpenSSL STACK_OF, BSD LIST_ENTRY.
2187  /// \version 9
2188  std::vector<std::string> TypenameMacros;
2189 
2190  /// A vector of macros that should be interpreted as complete
2191  /// statements.
2192  ///
2193  /// Typical macros are expressions, and require a semi-colon to be
2194  /// added; sometimes this is not the case, and this allows to make
2195  /// clang-format aware of such cases.
2196  ///
2197  /// For example: Q_UNUSED
2198  /// \version 8
2199  std::vector<std::string> StatementMacros;
2200 
2201  /// A vector of macros which are used to open namespace blocks.
2202  ///
2203  /// These are expected to be macros of the form:
2204  /// \code
2205  /// NAMESPACE(<namespace-name>, ...) {
2206  /// <namespace-content>
2207  /// }
2208  /// \endcode
2209  ///
2210  /// For example: TESTSUITE
2211  /// \version 9
2212  std::vector<std::string> NamespaceMacros;
2213 
2214  /// A vector of macros which are whitespace-sensitive and should not
2215  /// be touched.
2216  ///
2217  /// These are expected to be macros of the form:
2218  /// \code
2219  /// STRINGIZE(...)
2220  /// \endcode
2221  ///
2222  /// In the .clang-format configuration file, this can be configured like:
2223  /// \code{.yaml}
2224  /// WhitespaceSensitiveMacros: ['STRINGIZE', 'PP_STRINGIZE']
2225  /// \endcode
2226  ///
2227  /// For example: BOOST_PP_STRINGIZE
2228  /// \version 11
2229  std::vector<std::string> WhitespaceSensitiveMacros;
2230 
2232 
2233  /// Specify whether access modifiers should have their own indentation level.
2234  ///
2235  /// When ``false``, access modifiers are indented (or outdented) relative to
2236  /// the record members, respecting the ``AccessModifierOffset``. Record
2237  /// members are indented one level below the record.
2238  /// When ``true``, access modifiers get their own indentation level. As a
2239  /// consequence, record members are always indented 2 levels below the record,
2240  /// regardless of the access modifier presence. Value of the
2241  /// ``AccessModifierOffset`` is ignored.
2242  /// \code
2243  /// false: true:
2244  /// class C { vs. class C {
2245  /// class D { class D {
2246  /// void bar(); void bar();
2247  /// protected: protected:
2248  /// D(); D();
2249  /// }; };
2250  /// public: public:
2251  /// C(); C();
2252  /// }; };
2253  /// void foo() { void foo() {
2254  /// return 1; return 1;
2255  /// } }
2256  /// \endcode
2257  /// \version 13
2259 
2260  /// Indent case labels one level from the switch statement.
2261  ///
2262  /// When ``false``, use the same indentation level as for the switch
2263  /// statement. Switch statement body is always indented one level more than
2264  /// case labels (except the first block following the case label, which
2265  /// itself indents the code - unless IndentCaseBlocks is enabled).
2266  /// \code
2267  /// false: true:
2268  /// switch (fool) { vs. switch (fool) {
2269  /// case 1: case 1:
2270  /// bar(); bar();
2271  /// break; break;
2272  /// default: default:
2273  /// plop(); plop();
2274  /// } }
2275  /// \endcode
2276  /// \version 3.3
2278 
2279  /// Indent case label blocks one level from the case label.
2280  ///
2281  /// When ``false``, the block following the case label uses the same
2282  /// indentation level as for the case label, treating the case label the same
2283  /// as an if-statement.
2284  /// When ``true``, the block gets indented as a scope block.
2285  /// \code
2286  /// false: true:
2287  /// switch (fool) { vs. switch (fool) {
2288  /// case 1: { case 1:
2289  /// bar(); {
2290  /// } break; bar();
2291  /// default: { }
2292  /// plop(); break;
2293  /// } default:
2294  /// } {
2295  /// plop();
2296  /// }
2297  /// }
2298  /// \endcode
2299  /// \version 11
2301 
2302  /// Indent goto labels.
2303  ///
2304  /// When ``false``, goto labels are flushed left.
2305  /// \code
2306  /// true: false:
2307  /// int f() { vs. int f() {
2308  /// if (foo()) { if (foo()) {
2309  /// label1: label1:
2310  /// bar(); bar();
2311  /// } }
2312  /// label2: label2:
2313  /// return 1; return 1;
2314  /// } }
2315  /// \endcode
2316  /// \version 10
2318 
2319  /// Options for indenting preprocessor directives.
2320  enum PPDirectiveIndentStyle : int8_t {
2321  /// Does not indent any directives.
2322  /// \code
2323  /// #if FOO
2324  /// #if BAR
2325  /// #include <foo>
2326  /// #endif
2327  /// #endif
2328  /// \endcode
2330  /// Indents directives after the hash.
2331  /// \code
2332  /// #if FOO
2333  /// # if BAR
2334  /// # include <foo>
2335  /// # endif
2336  /// #endif
2337  /// \endcode
2339  /// Indents directives before the hash.
2340  /// \code
2341  /// #if FOO
2342  /// #if BAR
2343  /// #include <foo>
2344  /// #endif
2345  /// #endif
2346  /// \endcode
2348  };
2349 
2350  /// The preprocessor directive indenting style to use.
2351  /// \version 6
2353 
2354  /// Indents extern blocks
2355  enum IndentExternBlockStyle : int8_t {
2356  /// Backwards compatible with AfterExternBlock's indenting.
2357  /// \code
2358  /// IndentExternBlock: AfterExternBlock
2359  /// BraceWrapping.AfterExternBlock: true
2360  /// extern "C"
2361  /// {
2362  /// void foo();
2363  /// }
2364  /// \endcode
2365  ///
2366  /// \code
2367  /// IndentExternBlock: AfterExternBlock
2368  /// BraceWrapping.AfterExternBlock: false
2369  /// extern "C" {
2370  /// void foo();
2371  /// }
2372  /// \endcode
2374  /// Does not indent extern blocks.
2375  /// \code
2376  /// extern "C" {
2377  /// void foo();
2378  /// }
2379  /// \endcode
2381  /// Indents extern blocks.
2382  /// \code
2383  /// extern "C" {
2384  /// void foo();
2385  /// }
2386  /// \endcode
2388  };
2389 
2390  /// IndentExternBlockStyle is the type of indenting of extern blocks.
2391  /// \version 11
2393 
2394  /// Indent the requires clause in a template. This only applies when
2395  /// ``RequiresClausePosition`` is ``OwnLine``, or ``WithFollowing``.
2396  ///
2397  /// In clang-format 12, 13 and 14 it was named ``IndentRequires``.
2398  /// \code
2399  /// true:
2400  /// template <typename It>
2401  /// requires Iterator<It>
2402  /// void sort(It begin, It end) {
2403  /// //....
2404  /// }
2405  ///
2406  /// false:
2407  /// template <typename It>
2408  /// requires Iterator<It>
2409  /// void sort(It begin, It end) {
2410  /// //....
2411  /// }
2412  /// \endcode
2413  /// \version 15
2415 
2416  /// The number of columns to use for indentation.
2417  /// \code
2418  /// IndentWidth: 3
2419  ///
2420  /// void f() {
2421  /// someFunction();
2422  /// if (true, false) {
2423  /// f();
2424  /// }
2425  /// }
2426  /// \endcode
2427  /// \version 3.7
2428  unsigned IndentWidth;
2429 
2430  /// Indent if a function definition or declaration is wrapped after the
2431  /// type.
2432  /// \code
2433  /// true:
2434  /// LoooooooooooooooooooooooooooooooooooooooongReturnType
2435  /// LoooooooooooooooooooooooooooooooongFunctionDeclaration();
2436  ///
2437  /// false:
2438  /// LoooooooooooooooooooooooooooooooooooooooongReturnType
2439  /// LoooooooooooooooooooooooooooooooongFunctionDeclaration();
2440  /// \endcode
2441  /// \version 3.7
2443 
2444  /// Insert braces after control statements (``if``, ``else``, ``for``, ``do``,
2445  /// and ``while``) in C++ unless the control statements are inside macro
2446  /// definitions or the braces would enclose preprocessor directives.
2447  /// \warning
2448  /// Setting this option to `true` could lead to incorrect code formatting due
2449  /// to clang-format's lack of complete semantic information. As such, extra
2450  /// care should be taken to review code changes made by this option.
2451  /// \endwarning
2452  /// \code
2453  /// false: true:
2454  ///
2455  /// if (isa<FunctionDecl>(D)) vs. if (isa<FunctionDecl>(D)) {
2456  /// handleFunctionDecl(D); handleFunctionDecl(D);
2457  /// else if (isa<VarDecl>(D)) } else if (isa<VarDecl>(D)) {
2458  /// handleVarDecl(D); handleVarDecl(D);
2459  /// else } else {
2460  /// return; return;
2461  /// }
2462  ///
2463  /// while (i--) vs. while (i--) {
2464  /// for (auto *A : D.attrs()) for (auto *A : D.attrs()) {
2465  /// handleAttr(A); handleAttr(A);
2466  /// }
2467  /// }
2468  ///
2469  /// do vs. do {
2470  /// --i; --i;
2471  /// while (i); } while (i);
2472  /// \endcode
2473  /// \version 15
2475 
2476  /// A vector of prefixes ordered by the desired groups for Java imports.
2477  ///
2478  /// One group's prefix can be a subset of another - the longest prefix is
2479  /// always matched. Within a group, the imports are ordered lexicographically.
2480  /// Static imports are grouped separately and follow the same group rules.
2481  /// By default, static imports are placed before non-static imports,
2482  /// but this behavior is changed by another option,
2483  /// ``SortJavaStaticImport``.
2484  ///
2485  /// In the .clang-format configuration file, this can be configured like
2486  /// in the following yaml example. This will result in imports being
2487  /// formatted as in the Java example below.
2488  /// \code{.yaml}
2489  /// JavaImportGroups: ['com.example', 'com', 'org']
2490  /// \endcode
2491  ///
2492  /// \code{.java}
2493  /// import static com.example.function1;
2494  ///
2495  /// import static com.test.function2;
2496  ///
2497  /// import static org.example.function3;
2498  ///
2499  /// import com.example.ClassA;
2500  /// import com.example.Test;
2501  /// import com.example.a.ClassB;
2502  ///
2503  /// import com.test.ClassC;
2504  ///
2505  /// import org.example.ClassD;
2506  /// \endcode
2507  /// \version 8
2508  std::vector<std::string> JavaImportGroups;
2509 
2510  /// Quotation styles for JavaScript strings. Does not affect template
2511  /// strings.
2512  enum JavaScriptQuoteStyle : int8_t {
2513  /// Leave string quotes as they are.
2514  /// \code{.js}
2515  /// string1 = "foo";
2516  /// string2 = 'bar';
2517  /// \endcode
2519  /// Always use single quotes.
2520  /// \code{.js}
2521  /// string1 = 'foo';
2522  /// string2 = 'bar';
2523  /// \endcode
2525  /// Always use double quotes.
2526  /// \code{.js}
2527  /// string1 = "foo";
2528  /// string2 = "bar";
2529  /// \endcode
2531  };
2532 
2533  /// The JavaScriptQuoteStyle to use for JavaScript strings.
2534  /// \version 3.9
2536 
2537  // clang-format off
2538  /// Whether to wrap JavaScript import/export statements.
2539  /// \code{.js}
2540  /// true:
2541  /// import {
2542  /// VeryLongImportsAreAnnoying,
2543  /// VeryLongImportsAreAnnoying,
2544  /// VeryLongImportsAreAnnoying,
2545  /// } from 'some/module.js'
2546  ///
2547  /// false:
2548  /// import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from "some/module.js"
2549  /// \endcode
2550  /// \version 3.9
2552  // clang-format on
2553 
2554  /// If true, the empty line at the start of blocks is kept.
2555  /// \code
2556  /// true: false:
2557  /// if (foo) { vs. if (foo) {
2558  /// bar();
2559  /// bar(); }
2560  /// }
2561  /// \endcode
2562  /// \version 3.7
2564 
2565  /// Supported languages.
2566  ///
2567  /// When stored in a configuration file, specifies the language, that the
2568  /// configuration targets. When passed to the ``reformat()`` function, enables
2569  /// syntax features specific to the language.
2570  enum LanguageKind : int8_t {
2571  /// Do not use.
2573  /// Should be used for C, C++.
2575  /// Should be used for C#.
2577  /// Should be used for Java.
2579  /// Should be used for JavaScript.
2581  /// Should be used for JSON.
2583  /// Should be used for Objective-C, Objective-C++.
2585  /// Should be used for Protocol Buffers
2586  /// (https://developers.google.com/protocol-buffers/).
2588  /// Should be used for TableGen code.
2590  /// Should be used for Protocol Buffer messages in text format
2591  /// (https://developers.google.com/protocol-buffers/).
2593  };
2594  bool isCpp() const { return Language == LK_Cpp || Language == LK_ObjC; }
2595  bool isCSharp() const { return Language == LK_CSharp; }
2596  bool isJson() const { return Language == LK_Json; }
2597  bool isJavaScript() const { return Language == LK_JavaScript; }
2598 
2599  /// Language, this format style is targeted at.
2600  /// \version 3.5
2602 
2603  /// Indentation logic for lambda bodies.
2605  /// Align lambda body relative to the lambda signature. This is the default.
2606  /// \code
2607  /// someMethod(
2608  /// [](SomeReallyLongLambdaSignatureArgument foo) {
2609  /// return;
2610  /// });
2611  /// \endcode
2613  /// Align lambda body relative to the indentation level of the outer scope
2614  /// the lambda signature resides in.
2615  /// \code
2616  /// someMethod(
2617  /// [](SomeReallyLongLambdaSignatureArgument foo) {
2618  /// return;
2619  /// });
2620  /// \endcode
2622  };
2623 
2624  /// The indentation style of lambda bodies. ``Signature`` (the default)
2625  /// causes the lambda body to be indented one additional level relative to
2626  /// the indentation level of the signature. ``OuterScope`` forces the lambda
2627  /// body to be indented one additional level relative to the parent scope
2628  /// containing the lambda signature. For callback-heavy code, it may improve
2629  /// readability to have the signature indented two levels and to use
2630  /// ``OuterScope``. The KJ style guide requires ``OuterScope``.
2631  /// `KJ style guide
2632  /// <https://github.com/capnproto/capnproto/blob/master/style-guide.md>`_
2633  /// \version 13
2635 
2636  /// A regular expression matching macros that start a block.
2637  /// \code
2638  /// # With:
2639  /// MacroBlockBegin: "^NS_MAP_BEGIN|\
2640  /// NS_TABLE_HEAD$"
2641  /// MacroBlockEnd: "^\
2642  /// NS_MAP_END|\
2643  /// NS_TABLE_.*_END$"
2644  ///
2645  /// NS_MAP_BEGIN
2646  /// foo();
2647  /// NS_MAP_END
2648  ///
2649  /// NS_TABLE_HEAD
2650  /// bar();
2651  /// NS_TABLE_FOO_END
2652  ///
2653  /// # Without:
2654  /// NS_MAP_BEGIN
2655  /// foo();
2656  /// NS_MAP_END
2657  ///
2658  /// NS_TABLE_HEAD
2659  /// bar();
2660  /// NS_TABLE_FOO_END
2661  /// \endcode
2662  /// \version 3.7
2664 
2665  /// A regular expression matching macros that end a block.
2666  /// \version 3.7
2668 
2669  /// The maximum number of consecutive empty lines to keep.
2670  /// \code
2671  /// MaxEmptyLinesToKeep: 1 vs. MaxEmptyLinesToKeep: 0
2672  /// int f() { int f() {
2673  /// int = 1; int i = 1;
2674  /// i = foo();
2675  /// i = foo(); return i;
2676  /// }
2677  /// return i;
2678  /// }
2679  /// \endcode
2680  /// \version 3.7
2682 
2683  /// Different ways to indent namespace contents.
2685  /// Don't indent in namespaces.
2686  /// \code
2687  /// namespace out {
2688  /// int i;
2689  /// namespace in {
2690  /// int i;
2691  /// }
2692  /// }
2693  /// \endcode
2695  /// Indent only in inner namespaces (nested in other namespaces).
2696  /// \code
2697  /// namespace out {
2698  /// int i;
2699  /// namespace in {
2700  /// int i;
2701  /// }
2702  /// }
2703  /// \endcode
2705  /// Indent in all namespaces.
2706  /// \code
2707  /// namespace out {
2708  /// int i;
2709  /// namespace in {
2710  /// int i;
2711  /// }
2712  /// }
2713  /// \endcode
2715  };
2716 
2717  /// The indentation used for namespaces.
2718  /// \version 3.7
2720 
2721  /// Controls bin-packing Objective-C protocol conformance list
2722  /// items into as few lines as possible when they go over ``ColumnLimit``.
2723  ///
2724  /// If ``Auto`` (the default), delegates to the value in
2725  /// ``BinPackParameters``. If that is ``true``, bin-packs Objective-C
2726  /// protocol conformance list items into as few lines as possible
2727  /// whenever they go over ``ColumnLimit``.
2728  ///
2729  /// If ``Always``, always bin-packs Objective-C protocol conformance
2730  /// list items into as few lines as possible whenever they go over
2731  /// ``ColumnLimit``.
2732  ///
2733  /// If ``Never``, lays out Objective-C protocol conformance list items
2734  /// onto individual lines whenever they go over ``ColumnLimit``.
2735  ///
2736  /// \code{.objc}
2737  /// Always (or Auto, if BinPackParameters=true):
2738  /// @interface ccccccccccccc () <
2739  /// ccccccccccccc, ccccccccccccc,
2740  /// ccccccccccccc, ccccccccccccc> {
2741  /// }
2742  ///
2743  /// Never (or Auto, if BinPackParameters=false):
2744  /// @interface ddddddddddddd () <
2745  /// ddddddddddddd,
2746  /// ddddddddddddd,
2747  /// ddddddddddddd,
2748  /// ddddddddddddd> {
2749  /// }
2750  /// \endcode
2751  /// \version 7
2753 
2754  /// The number of characters to use for indentation of ObjC blocks.
2755  /// \code{.objc}
2756  /// ObjCBlockIndentWidth: 4
2757  ///
2758  /// [operation setCompletionBlock:^{
2759  /// [self onOperationDone];
2760  /// }];
2761  /// \endcode
2762  /// \version 3.7
2764 
2765  /// Add a space after ``@property`` in Objective-C, i.e. use
2766  /// ``@property (readonly)`` instead of ``@property(readonly)``.
2767  /// \version 3.7
2769 
2770  /// Break parameters list into lines when there is nested block
2771  /// parameters in a function call.
2772  /// \code
2773  /// false:
2774  /// - (void)_aMethod
2775  /// {
2776  /// [self.test1 t:self w:self callback:^(typeof(self) self, NSNumber
2777  /// *u, NSNumber *v) {
2778  /// u = c;
2779  /// }]
2780  /// }
2781  /// true:
2782  /// - (void)_aMethod
2783  /// {
2784  /// [self.test1 t:self
2785  /// w:self
2786  /// callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
2787  /// u = c;
2788  /// }]
2789  /// }
2790  /// \endcode
2791  /// \version 11
2793 
2794  /// Add a space in front of an Objective-C protocol list, i.e. use
2795  /// ``Foo <Protocol>`` instead of ``Foo<Protocol>``.
2796  /// \version 3.7
2798 
2799  /// The penalty for breaking around an assignment operator.
2800  /// \version 5
2802 
2803  /// The penalty for breaking a function call after ``call(``.
2804  /// \version 3.7
2806 
2807  /// The penalty for each line break introduced inside a comment.
2808  /// \version 3.7
2810 
2811  /// The penalty for breaking before the first ``<<``.
2812  /// \version 3.7
2814 
2815  /// The penalty for breaking after ``(``.
2816  /// \version 14
2818 
2819  /// The penalty for each line break introduced inside a string literal.
2820  /// \version 3.7
2822 
2823  /// The penalty for breaking after template declaration.
2824  /// \version 7
2826 
2827  /// The penalty for each character outside of the column limit.
2828  /// \version 3.7
2830 
2831  /// Penalty for putting the return type of a function onto its own
2832  /// line.
2833  /// \version 3.7
2835 
2836  /// Penalty for each character of whitespace indentation
2837  /// (counted relative to leading non-whitespace column).
2838  /// \version 12
2840 
2841  /// The ``&``, ``&&`` and ``*`` alignment style.
2842  enum PointerAlignmentStyle : int8_t {
2843  /// Align pointer to the left.
2844  /// \code
2845  /// int* a;
2846  /// \endcode
2848  /// Align pointer to the right.
2849  /// \code
2850  /// int *a;
2851  /// \endcode
2853  /// Align pointer in the middle.
2854  /// \code
2855  /// int * a;
2856  /// \endcode
2858  };
2859 
2860  /// Pointer and reference alignment style.
2861  /// \version 3.7
2863 
2864  /// The number of columns to use for indentation of preprocessor statements.
2865  /// When set to -1 (default) ``IndentWidth`` is used also for preprocessor
2866  /// statements.
2867  /// \code
2868  /// PPIndentWidth: 1
2869  ///
2870  /// #ifdef __linux__
2871  /// # define FOO
2872  /// #else
2873  /// # define BAR
2874  /// #endif
2875  /// \endcode
2876  /// \version 13
2878 
2879  /// See documentation of ``RawStringFormats``.
2881  /// The language of this raw string.
2883  /// A list of raw string delimiters that match this language.
2884  std::vector<std::string> Delimiters;
2885  /// A list of enclosing function names that match this language.
2886  std::vector<std::string> EnclosingFunctions;
2887  /// The canonical delimiter for this language.
2889  /// The style name on which this raw string format is based on.
2890  /// If not specified, the raw string format is based on the style that this
2891  /// format is based on.
2893  bool operator==(const RawStringFormat &Other) const {
2894  return Language == Other.Language && Delimiters == Other.Delimiters &&
2897  BasedOnStyle == Other.BasedOnStyle;
2898  }
2899  };
2900 
2901  /// Defines hints for detecting supported languages code blocks in raw
2902  /// strings.
2903  ///
2904  /// A raw string with a matching delimiter or a matching enclosing function
2905  /// name will be reformatted assuming the specified language based on the
2906  /// style for that language defined in the .clang-format file. If no style has
2907  /// been defined in the .clang-format file for the specific language, a
2908  /// predefined style given by 'BasedOnStyle' is used. If 'BasedOnStyle' is not
2909  /// found, the formatting is based on llvm style. A matching delimiter takes
2910  /// precedence over a matching enclosing function name for determining the
2911  /// language of the raw string contents.
2912  ///
2913  /// If a canonical delimiter is specified, occurrences of other delimiters for
2914  /// the same language will be updated to the canonical if possible.
2915  ///
2916  /// There should be at most one specification per language and each delimiter
2917  /// and enclosing function should not occur in multiple specifications.
2918  ///
2919  /// To configure this in the .clang-format file, use:
2920  /// \code{.yaml}
2921  /// RawStringFormats:
2922  /// - Language: TextProto
2923  /// Delimiters:
2924  /// - 'pb'
2925  /// - 'proto'
2926  /// EnclosingFunctions:
2927  /// - 'PARSE_TEXT_PROTO'
2928  /// BasedOnStyle: google
2929  /// - Language: Cpp
2930  /// Delimiters:
2931  /// - 'cc'
2932  /// - 'cpp'
2933  /// BasedOnStyle: llvm
2934  /// CanonicalDelimiter: 'cc'
2935  /// \endcode
2936  /// \version 6
2937  std::vector<RawStringFormat> RawStringFormats;
2938 
2939  /// \brief The ``&`` and ``&&`` alignment style.
2940  enum ReferenceAlignmentStyle : int8_t {
2941  /// Align reference like ``PointerAlignment``.
2943  /// Align reference to the left.
2944  /// \code
2945  /// int& a;
2946  /// \endcode
2948  /// Align reference to the right.
2949  /// \code
2950  /// int &a;
2951  /// \endcode
2953  /// Align reference in the middle.
2954  /// \code
2955  /// int & a;
2956  /// \endcode
2958  };
2959 
2960  /// \brief Reference alignment style (overrides ``PointerAlignment`` for
2961  /// references).
2962  /// \version 13
2964 
2965  // clang-format off
2966  /// If ``true``, clang-format will attempt to re-flow comments.
2967  /// \code
2968  /// false:
2969  /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
2970  /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
2971  ///
2972  /// true:
2973  /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
2974  /// // information
2975  /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
2976  /// * information */
2977  /// \endcode
2978  /// \version 4
2980  // clang-format on
2981 
2982  /// Remove optional braces of control statements (``if``, ``else``, ``for``,
2983  /// and ``while``) in C++ according to the LLVM coding style.
2984  /// \warning
2985  /// This option will be renamed and expanded to support other styles.
2986  /// \endwarning
2987  /// \warning
2988  /// Setting this option to `true` could lead to incorrect code formatting due
2989  /// to clang-format's lack of complete semantic information. As such, extra
2990  /// care should be taken to review code changes made by this option.
2991  /// \endwarning
2992  /// \code
2993  /// false: true:
2994  ///
2995  /// if (isa<FunctionDecl>(D)) { vs. if (isa<FunctionDecl>(D))
2996  /// handleFunctionDecl(D); handleFunctionDecl(D);
2997  /// } else if (isa<VarDecl>(D)) { else if (isa<VarDecl>(D))
2998  /// handleVarDecl(D); handleVarDecl(D);
2999  /// }
3000  ///
3001  /// if (isa<VarDecl>(D)) { vs. if (isa<VarDecl>(D)) {
3002  /// for (auto *A : D.attrs()) { for (auto *A : D.attrs())
3003  /// if (shouldProcessAttr(A)) { if (shouldProcessAttr(A))
3004  /// handleAttr(A); handleAttr(A);
3005  /// } }
3006  /// }
3007  /// }
3008  ///
3009  /// if (isa<FunctionDecl>(D)) { vs. if (isa<FunctionDecl>(D))
3010  /// for (auto *A : D.attrs()) { for (auto *A : D.attrs())
3011  /// handleAttr(A); handleAttr(A);
3012  /// }
3013  /// }
3014  ///
3015  /// if (auto *D = (T)(D)) { vs. if (auto *D = (T)(D)) {
3016  /// if (shouldProcess(D)) { if (shouldProcess(D))
3017  /// handleVarDecl(D); handleVarDecl(D);
3018  /// } else { else
3019  /// markAsIgnored(D); markAsIgnored(D);
3020  /// } }
3021  /// }
3022  ///
3023  /// if (a) { vs. if (a)
3024  /// b(); b();
3025  /// } else { else if (c)
3026  /// if (c) { d();
3027  /// d(); else
3028  /// } else { e();
3029  /// e();
3030  /// }
3031  /// }
3032  /// \endcode
3033  /// \version 14
3035 
3036  /// \brief The possible positions for the requires clause. The
3037  /// ``IndentRequires`` option is only used if the ``requires`` is put on the
3038  /// start of a line.
3040  /// Always put the ``requires`` clause on its own line.
3041  /// \code
3042  /// template <typename T>
3043  /// requires C<T>
3044  /// struct Foo {...
3045  ///
3046  /// template <typename T>
3047  /// requires C<T>
3048  /// void bar(T t) {...
3049  ///
3050  /// template <typename T>
3051  /// void baz(T t)
3052  /// requires C<T>
3053  /// {...
3054  /// \endcode
3056  /// Try to put the clause together with the preceding part of a declaration.
3057  /// For class templates: stick to the template declaration.
3058  /// For function templates: stick to the template declaration.
3059  /// For function declaration followed by a requires clause: stick to the
3060  /// parameter list.
3061  /// \code
3062  /// template <typename T> requires C<T>
3063  /// struct Foo {...
3064  ///
3065  /// template <typename T> requires C<T>
3066  /// void bar(T t) {...
3067  ///
3068  /// template <typename T>
3069  /// void baz(T t) requires C<T>
3070  /// {...
3071  /// \endcode
3073  /// Try to put the ``requires`` clause together with the class or function
3074  /// declaration.
3075  /// \code
3076  /// template <typename T>
3077  /// requires C<T> struct Foo {...
3078  ///
3079  /// template <typename T>
3080  /// requires C<T> void bar(T t) {...
3081  ///
3082  /// template <typename T>
3083  /// void baz(T t)
3084  /// requires C<T> {...
3085  /// \endcode
3087  /// Try to put everything in the same line if possible. Otherwise normal
3088  /// line breaking rules take over.
3089  /// \code
3090  /// // Fitting:
3091  /// template <typename T> requires C<T> struct Foo {...
3092  ///
3093  /// template <typename T> requires C<T> void bar(T t) {...
3094  ///
3095  /// template <typename T> void bar(T t) requires C<T> {...
3096  ///
3097  /// // Not fitting, one possible example:
3098  /// template <typename LongName>
3099  /// requires C<LongName>
3100  /// struct Foo {...
3101  ///
3102  /// template <typename LongName>
3103  /// requires C<LongName>
3104  /// void bar(LongName ln) {
3105  ///
3106  /// template <typename LongName>
3107  /// void bar(LongName ln)
3108  /// requires C<LongName> {
3109  /// \endcode
3111  };
3112 
3113  /// \brief The position of the ``requires`` clause.
3114  /// \version 15
3116 
3117  /// \brief The style if definition blocks should be separated.
3118  enum SeparateDefinitionStyle : int8_t {
3119  /// Leave definition blocks as they are.
3121  /// Insert an empty line between definition blocks.
3123  /// Remove any empty line between definition blocks.
3125  };
3126 
3127  /// Specifies the use of empty lines to separate definition blocks, including
3128  /// classes, structs, enums, and functions.
3129  /// \code
3130  /// Never v.s. Always
3131  /// #include <cstring> #include <cstring>
3132  /// struct Foo {
3133  /// int a, b, c; struct Foo {
3134  /// }; int a, b, c;
3135  /// namespace Ns { };
3136  /// class Bar {
3137  /// public: namespace Ns {
3138  /// struct Foobar { class Bar {
3139  /// int a; public:
3140  /// int b; struct Foobar {
3141  /// }; int a;
3142  /// private: int b;
3143  /// int t; };
3144  /// int method1() {
3145  /// // ... private:
3146  /// } int t;
3147  /// enum List {
3148  /// ITEM1, int method1() {
3149  /// ITEM2 // ...
3150  /// }; }
3151  /// template<typename T>
3152  /// int method2(T x) { enum List {
3153  /// // ... ITEM1,
3154  /// } ITEM2
3155  /// int i, j, k; };
3156  /// int method3(int par) {
3157  /// // ... template<typename T>
3158  /// } int method2(T x) {
3159  /// }; // ...
3160  /// class C {}; }
3161  /// }
3162  /// int i, j, k;
3163  ///
3164  /// int method3(int par) {
3165  /// // ...
3166  /// }
3167  /// };
3168  ///
3169  /// class C {};
3170  /// }
3171  /// \endcode
3172  /// \version 14
3174 
3175  /// The maximal number of unwrapped lines that a short namespace spans.
3176  /// Defaults to 1.
3177  ///
3178  /// This determines the maximum length of short namespaces by counting
3179  /// unwrapped lines (i.e. containing neither opening nor closing
3180  /// namespace brace) and makes "FixNamespaceComments" omit adding
3181  /// end comments for those.
3182  /// \code
3183  /// ShortNamespaceLines: 1 vs. ShortNamespaceLines: 0
3184  /// namespace a { namespace a {
3185  /// int foo; int foo;
3186  /// } } // namespace a
3187  ///
3188  /// ShortNamespaceLines: 1 vs. ShortNamespaceLines: 0
3189  /// namespace b { namespace b {
3190  /// int foo; int foo;
3191  /// int bar; int bar;
3192  /// } // namespace b } // namespace b
3193  /// \endcode
3194  /// \version 13
3196 
3197  /// Include sorting options.
3198  enum SortIncludesOptions : int8_t {
3199  /// Includes are never sorted.
3200  /// \code
3201  /// #include "B/A.h"
3202  /// #include "A/B.h"
3203  /// #include "a/b.h"
3204  /// #include "A/b.h"
3205  /// #include "B/a.h"
3206  /// \endcode
3208  /// Includes are sorted in an ASCIIbetical or case sensitive fashion.
3209  /// \code
3210  /// #include "A/B.h"
3211  /// #include "A/b.h"
3212  /// #include "B/A.h"
3213  /// #include "B/a.h"
3214  /// #include "a/b.h"
3215  /// \endcode
3217  /// Includes are sorted in an alphabetical or case insensitive fashion.
3218  /// \code
3219  /// #include "A/B.h"
3220  /// #include "A/b.h"
3221  /// #include "a/b.h"
3222  /// #include "B/A.h"
3223  /// #include "B/a.h"
3224  /// \endcode
3226  };
3227 
3228  /// Controls if and how clang-format will sort ``#includes``.
3229  /// If ``Never``, includes are never sorted.
3230  /// If ``CaseInsensitive``, includes are sorted in an ASCIIbetical or case
3231  /// insensitive fashion.
3232  /// If ``CaseSensitive``, includes are sorted in an alphabetical or case
3233  /// sensitive fashion.
3234  /// \version 4
3236 
3237  /// Position for Java Static imports.
3239  /// Static imports are placed before non-static imports.
3240  /// \code{.java}
3241  /// import static org.example.function1;
3242  ///
3243  /// import org.example.ClassA;
3244  /// \endcode
3246  /// Static imports are placed after non-static imports.
3247  /// \code{.java}
3248  /// import org.example.ClassA;
3249  ///
3250  /// import static org.example.function1;
3251  /// \endcode
3253  };
3254 
3255  /// When sorting Java imports, by default static imports are placed before
3256  /// non-static imports. If ``JavaStaticImportAfterImport`` is ``After``,
3257  /// static imports are placed after non-static imports.
3258  /// \version 12
3260 
3261  /// If ``true``, clang-format will sort using declarations.
3262  ///
3263  /// The order of using declarations is defined as follows:
3264  /// Split the strings by "::" and discard any initial empty strings. The last
3265  /// element of each list is a non-namespace name; all others are namespace
3266  /// names. Sort the lists of names lexicographically, where the sort order of
3267  /// individual names is that all non-namespace names come before all namespace
3268  /// names, and within those groups, names are in case-insensitive
3269  /// lexicographic order.
3270  /// \code
3271  /// false: true:
3272  /// using std::cout; vs. using std::cin;
3273  /// using std::cin; using std::cout;
3274  /// \endcode
3275  /// \version 5
3277 
3278  /// If ``true``, a space is inserted after C style casts.
3279  /// \code
3280  /// true: false:
3281  /// (int) i; vs. (int)i;
3282  /// \endcode
3283  /// \version 3.5
3285 
3286  /// If ``true``, a space is inserted after the logical not operator (``!``).
3287  /// \code
3288  /// true: false:
3289  /// ! someExpression(); vs. !someExpression();
3290  /// \endcode
3291  /// \version 9
3293 
3294  /// If \c true, a space will be inserted after the 'template' keyword.
3295  /// \code
3296  /// true: false:
3297  /// template <int> void foo(); vs. template<int> void foo();
3298  /// \endcode
3299  /// \version 4
3301 
3302  /// Different ways to put a space before opening parentheses.
3304  /// Don't ensure spaces around pointer qualifiers and use PointerAlignment
3305  /// instead.
3306  /// \code
3307  /// PointerAlignment: Left PointerAlignment: Right
3308  /// void* const* x = NULL; vs. void *const *x = NULL;
3309  /// \endcode
3311  /// Ensure that there is a space before pointer qualifiers.
3312  /// \code
3313  /// PointerAlignment: Left PointerAlignment: Right
3314  /// void* const* x = NULL; vs. void * const *x = NULL;
3315  /// \endcode
3317  /// Ensure that there is a space after pointer qualifiers.
3318  /// \code
3319  /// PointerAlignment: Left PointerAlignment: Right
3320  /// void* const * x = NULL; vs. void *const *x = NULL;
3321  /// \endcode
3323  /// Ensure that there is a space both before and after pointer qualifiers.
3324  /// \code
3325  /// PointerAlignment: Left PointerAlignment: Right
3326  /// void* const * x = NULL; vs. void * const *x = NULL;
3327  /// \endcode
3329  };
3330 
3331  /// Defines in which cases to put a space before or after pointer qualifiers
3332  /// \version 12
3334 
3335  /// If ``false``, spaces will be removed before assignment operators.
3336  /// \code
3337  /// true: false:
3338  /// int a = 5; vs. int a= 5;
3339  /// a += 42; a+= 42;
3340  /// \endcode
3341  /// \version 3.7
3343 
3344  /// If ``false``, spaces will be removed before case colon.
3345  /// \code
3346  /// true: false
3347  /// switch (x) { vs. switch (x) {
3348  /// case 1 : break; case 1: break;
3349  /// } }
3350  /// \endcode
3351  /// \version 12
3353 
3354  /// If ``true``, a space will be inserted before a C++11 braced list
3355  /// used to initialize an object (after the preceding identifier or type).
3356  /// \code
3357  /// true: false:
3358  /// Foo foo { bar }; vs. Foo foo{ bar };
3359  /// Foo {}; Foo{};
3360  /// vector<int> { 1, 2, 3 }; vector<int>{ 1, 2, 3 };
3361  /// new int[3] { 1, 2, 3 }; new int[3]{ 1, 2, 3 };
3362  /// \endcode
3363  /// \version 7
3365 
3366  /// If ``false``, spaces will be removed before constructor initializer
3367  /// colon.
3368  /// \code
3369  /// true: false:
3370  /// Foo::Foo() : a(a) {} Foo::Foo(): a(a) {}
3371  /// \endcode
3372  /// \version 7
3374 
3375  /// If ``false``, spaces will be removed before inheritance colon.
3376  /// \code
3377  /// true: false:
3378  /// class Foo : Bar {} vs. class Foo: Bar {}
3379  /// \endcode
3380  /// \version 7
3382 
3383  /// Different ways to put a space before opening parentheses.
3384  enum SpaceBeforeParensStyle : int8_t {
3385  /// Never put a space before opening parentheses.
3386  /// \code
3387  /// void f() {
3388  /// if(true) {
3389  /// f();
3390  /// }
3391  /// }
3392  /// \endcode
3394  /// Put a space before opening parentheses only after control statement
3395  /// keywords (``for/if/while...``).
3396  /// \code
3397  /// void f() {
3398  /// if (true) {
3399  /// f();
3400  /// }
3401  /// }
3402  /// \endcode
3404  /// Same as ``SBPO_ControlStatements`` except this option doesn't apply to
3405  /// ForEach and If macros. This is useful in projects where ForEach/If
3406  /// macros are treated as function calls instead of control statements.
3407  /// ``SBPO_ControlStatementsExceptForEachMacros`` remains an alias for
3408  /// backward compatibility.
3409  /// \code
3410  /// void f() {
3411  /// Q_FOREACH(...) {
3412  /// f();
3413  /// }
3414  /// }
3415  /// \endcode
3417  /// Put a space before opening parentheses only if the parentheses are not
3418  /// empty i.e. '()'
3419  /// \code
3420  /// void() {
3421  /// if (true) {
3422  /// f();
3423  /// g (x, y, z);
3424  /// }
3425  /// }
3426  /// \endcode
3428  /// Always put a space before opening parentheses, except when it's
3429  /// prohibited by the syntax rules (in function-like macro definitions) or
3430  /// when determined by other style rules (after unary operators, opening
3431  /// parentheses, etc.)
3432  /// \code
3433  /// void f () {
3434  /// if (true) {
3435  /// f ();
3436  /// }
3437  /// }
3438  /// \endcode
3440  /// Configure each individual space before parentheses in
3441  /// `SpaceBeforeParensOptions`.
3443  };
3444 
3445  /// Defines in which cases to put a space before opening parentheses.
3446  /// \version 3.5
3448 
3449  /// Precise control over the spacing before parentheses.
3450  /// \code
3451  /// # Should be declared this way:
3452  /// SpaceBeforeParens: Custom
3453  /// SpaceBeforeParensOptions:
3454  /// AfterControlStatements: true
3455  /// AfterFunctionDefinitionName: true
3456  /// \endcode
3458  /// If ``true``, put space betwee control statement keywords
3459  /// (for/if/while...) and opening parentheses.
3460  /// \code
3461  /// true: false:
3462  /// if (...) {} vs. if(...) {}
3463  /// \endcode
3465  /// If ``true``, put space between foreach macros and opening parentheses.
3466  /// \code
3467  /// true: false:
3468  /// FOREACH (...) vs. FOREACH(...)
3469  /// <loop-body> <loop-body>
3470  /// \endcode
3472  /// If ``true``, put a space between function declaration name and opening
3473  /// parentheses.
3474  /// \code
3475  /// true: false:
3476  /// void f (); vs. void f();
3477  /// \endcode
3479  /// If ``true``, put a space between function definition name and opening
3480  /// parentheses.
3481  /// \code
3482  /// true: false:
3483  /// void f () {} vs. void f() {}
3484  /// \endcode
3486  /// If ``true``, put space between if macros and opening parentheses.
3487  /// \code
3488  /// true: false:
3489  /// IF (...) vs. IF(...)
3490  /// <conditional-body> <conditional-body>
3491  /// \endcode
3493  /// If ``true``, put a space between operator overloading and opening
3494  /// parentheses.
3495  /// \code
3496  /// true: false:
3497  /// void operator++ (int a); vs. void operator++(int a);
3498  /// object.operator++ (10); object.operator++(10);
3499  /// \endcode
3501  /// If ``true``, put space between requires keyword in a requires clause and
3502  /// opening parentheses, if there is one.
3503  /// \code
3504  /// true: false:
3505  /// template<typename T> vs. template<typename T>
3506  /// requires (A<T> && B<T>) requires(A<T> && B<T>)
3507  /// ... ...
3508  /// \endcode
3510  /// If ``true``, put space between requires keyword in a requires expression
3511  /// and opening parentheses.
3512  /// \code
3513  /// true: false:
3514  /// template<typename T> vs. template<typename T>
3515  /// concept C = requires (T t) { concept C = requires(T t) {
3516  /// ... ...
3517  /// } }
3518  /// \endcode
3520  /// If ``true``, put a space before opening parentheses only if the
3521  /// parentheses are not empty.
3522  /// \code
3523  /// true: false:
3524  /// void f (int a); vs. void f();
3525  /// f (a); f();
3526  /// \endcode
3528 
3535 
3536  bool operator==(const SpaceBeforeParensCustom &Other) const {
3542  AfterIfMacros == Other.AfterIfMacros &&
3547  }
3548  };
3549 
3550  /// Control of individual space before parentheses.
3551  ///
3552  /// If ``SpaceBeforeParens`` is set to ``Custom``, use this to specify
3553  /// how each individual space before parentheses case should be handled.
3554  /// Otherwise, this is ignored.
3555  /// \code{.yaml}
3556  /// # Example of usage:
3557  /// SpaceBeforeParens: Custom
3558  /// SpaceBeforeParensOptions:
3559  /// AfterControlStatements: true
3560  /// AfterFunctionDefinitionName: true
3561  /// \endcode
3562  /// \version 14
3564 
3565  /// If ``false``, spaces will be removed before range-based for loop
3566  /// colon.
3567  /// \code
3568  /// true: false:
3569  /// for (auto v : values) {} vs. for(auto v: values) {}
3570  /// \endcode
3571  /// \version 7
3573 
3574  /// If ``true``, spaces will be inserted into ``{}``.
3575  /// \code
3576  /// true: false:
3577  /// void f() { } vs. void f() {}
3578  /// while (true) { } while (true) {}
3579  /// \endcode
3580  /// \version 10
3582 
3583  /// If ``true``, spaces may be inserted into ``()``.
3584  /// \code
3585  /// true: false:
3586  /// void f( ) { vs. void f() {
3587  /// int x[] = {foo( ), bar( )}; int x[] = {foo(), bar()};
3588  /// if (true) { if (true) {
3589  /// f( ); f();
3590  /// } }
3591  /// } }
3592  /// \endcode
3593  /// \version 3.7
3595 
3596  /// The number of spaces before trailing line comments
3597  /// (``//`` - comments).
3598  ///
3599  /// This does not affect trailing block comments (``/*`` - comments) as
3600  /// those commonly have different usage patterns and a number of special
3601  /// cases.
3602  /// \code
3603  /// SpacesBeforeTrailingComments: 3
3604  /// void f() {
3605  /// if (true) { // foo1
3606  /// f(); // bar
3607  /// } // foo
3608  /// }
3609  /// \endcode
3610  /// \version 3.7
3612 
3613  /// Styles for adding spacing after ``<`` and before ``>`
3614  /// in template argument lists.
3615  enum SpacesInAnglesStyle : int8_t {
3616  /// Remove spaces after ``<`` and before ``>``.
3617  /// \code
3618  /// static_cast<int>(arg);
3619  /// std::function<void(int)> fct;
3620  /// \endcode
3622  /// Add spaces after ``<`` and before ``>``.
3623  /// \code
3624  /// static_cast< int >(arg);
3625  /// std::function< void(int) > fct;
3626  /// \endcode
3628  /// Keep a single space after ``<`` and before ``>`` if any spaces were
3629  /// present. Option ``Standard: Cpp03`` takes precedence.
3631  };
3632  /// The SpacesInAnglesStyle to use for template argument lists.
3633  /// \version 3.4
3635 
3636  /// If ``true``, spaces will be inserted around if/for/switch/while
3637  /// conditions.
3638  /// \code
3639  /// true: false:
3640  /// if ( a ) { ... } vs. if (a) { ... }
3641  /// while ( i < 5 ) { ... } while (i < 5) { ... }
3642  /// \endcode
3643  /// \version 10
3645 
3646  /// If ``true``, spaces are inserted inside container literals (e.g.
3647  /// ObjC and Javascript array and dict literals).
3648  /// \code{.js}
3649  /// true: false:
3650  /// var arr = [ 1, 2, 3 ]; vs. var arr = [1, 2, 3];
3651  /// f({a : 1, b : 2, c : 3}); f({a: 1, b: 2, c: 3});
3652  /// \endcode
3653  /// \version 3.7
3655 
3656  /// If ``true``, spaces may be inserted into C style casts.
3657  /// \code
3658  /// true: false:
3659  /// x = ( int32 )y vs. x = (int32)y
3660  /// \endcode
3661  /// \version 3.7
3663 
3664  /// Control of spaces within a single line comment
3666  /// The minimum number of spaces at the start of the comment.
3667  unsigned Minimum;
3668  /// The maximum number of spaces at the start of the comment.
3669  unsigned Maximum;
3670  };
3671 
3672  /// How many spaces are allowed at the start of a line comment. To disable the
3673  /// maximum set it to ``-1``, apart from that the maximum takes precedence
3674  /// over the minimum.
3675  /// \code
3676  /// Minimum = 1
3677  /// Maximum = -1
3678  /// // One space is forced
3679  ///
3680  /// // but more spaces are possible
3681  ///
3682  /// Minimum = 0
3683  /// Maximum = 0
3684  /// //Forces to start every comment directly after the slashes
3685  /// \endcode
3686  ///
3687  /// Note that in line comment sections the relative indent of the subsequent
3688  /// lines is kept, that means the following:
3689  /// \code
3690  /// before: after:
3691  /// Minimum: 1
3692  /// //if (b) { // if (b) {
3693  /// // return true; // return true;
3694  /// //} // }
3695  ///
3696  /// Maximum: 0
3697  /// /// List: ///List:
3698  /// /// - Foo /// - Foo
3699  /// /// - Bar /// - Bar
3700  /// \endcode
3701  /// \version 13
3703 
3704  /// If ``true``, spaces will be inserted after ``(`` and before ``)``.
3705  /// \code
3706  /// true: false:
3707  /// t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete;
3708  /// \endcode
3709  /// \version 3.7
3711 
3712  /// If ``true``, spaces will be inserted after ``[`` and before ``]``.
3713  /// Lambdas without arguments or unspecified size array declarations will not
3714  /// be affected.
3715  /// \code
3716  /// true: false:
3717  /// int a[ 5 ]; vs. int a[5];
3718  /// std::unique_ptr<int[]> foo() {} // Won't be affected
3719  /// \endcode
3720  /// \version 3.7
3722 
3723  /// If ``true``, spaces will be before ``[``.
3724  /// Lambdas will not be affected. Only the first ``[`` will get a space added.
3725  /// \code
3726  /// true: false:
3727  /// int a [5]; vs. int a[5];
3728  /// int a [5][5]; vs. int a[5][5];
3729  /// \endcode
3730  /// \version 10
3732 
3733  /// Styles for adding spacing around ``:`` in bitfield definitions.
3735  /// Add one space on each side of the ``:``
3736  /// \code
3737  /// unsigned bf : 2;
3738  /// \endcode
3740  /// Add no space around the ``:`` (except when needed for
3741  /// ``AlignConsecutiveBitFields``).
3742  /// \code
3743  /// unsigned bf:2;
3744  /// \endcode
3746  /// Add space before the ``:`` only
3747  /// \code
3748  /// unsigned bf :2;
3749  /// \endcode
3751  /// Add space after the ``:`` only (space may be added before if
3752  /// needed for ``AlignConsecutiveBitFields``).
3753  /// \code
3754  /// unsigned bf: 2;
3755  /// \endcode
3757  };
3758  /// The BitFieldColonSpacingStyle to use for bitfields.
3759  /// \version 12
3761 
3762  /// Supported language standards for parsing and formatting C++ constructs.
3763  /// \code
3764  /// Latest: vector<set<int>>
3765  /// c++03 vs. vector<set<int> >
3766  /// \endcode
3767  ///
3768  /// The correct way to spell a specific language version is e.g. ``c++11``.
3769  /// The historical aliases ``Cpp03`` and ``Cpp11`` are deprecated.
3770  enum LanguageStandard : int8_t {
3771  /// Parse and format as C++03.
3772  /// ``Cpp03`` is a deprecated alias for ``c++03``
3773  LS_Cpp03, // c++03
3774  /// Parse and format as C++11.
3775  LS_Cpp11, // c++11
3776  /// Parse and format as C++14.
3777  LS_Cpp14, // c++14
3778  /// Parse and format as C++17.
3779  LS_Cpp17, // c++17
3780  /// Parse and format as C++20.
3781  LS_Cpp20, // c++20
3782  /// Parse and format using the latest supported language version.
3783  /// ``Cpp11`` is a deprecated alias for ``Latest``
3785  /// Automatic detection based on the input.
3787  };
3788 
3789  /// Parse and format C++ constructs compatible with this standard.
3790  /// \code
3791  /// c++03: latest:
3792  /// vector<set<int> > x; vs. vector<set<int>> x;
3793  /// \endcode
3794  /// \version 3.7
3796 
3797  /// Macros which are ignored in front of a statement, as if they were an
3798  /// attribute. So that they are not parsed as identifier, for example for Qts
3799  /// emit.
3800  /// \code
3801  /// AlignConsecutiveDeclarations: true
3802  /// StatementAttributeLikeMacros: []
3803  /// unsigned char data = 'x';
3804  /// emit signal(data); // This is parsed as variable declaration.
3805  ///
3806  /// AlignConsecutiveDeclarations: true
3807  /// StatementAttributeLikeMacros: [emit]
3808  /// unsigned char data = 'x';
3809  /// emit signal(data); // Now it's fine again.
3810  /// \endcode
3811  /// \version 12
3812  std::vector<std::string> StatementAttributeLikeMacros;
3813 
3814  /// The number of columns used for tab stops.
3815  /// \version 3.7
3816  unsigned TabWidth;
3817 
3818  /// Different ways to use tab in formatting.
3819  enum UseTabStyle : int8_t {
3820  /// Never use tab.
3822  /// Use tabs only for indentation.
3824  /// Fill all leading whitespace with tabs, and use spaces for alignment that
3825  /// appears within a line (e.g. consecutive assignments and declarations).
3827  /// Use tabs for line continuation and indentation, and spaces for
3828  /// alignment.
3830  /// Use tabs whenever we need to fill whitespace that spans at least from
3831  /// one tab stop to the next one.
3833  };
3834 
3835  /// \brief Use ``\r\n`` instead of ``\n`` for line breaks.
3836  /// Also used as fallback if ``DeriveLineEnding`` is true.
3837  /// \version 10
3838  bool UseCRLF;
3839 
3840  /// The way to use tab characters in the resulting file.
3841  /// \version 3.7
3843 
3844  bool operator==(const FormatStyle &R) const {
3913  IndentWidth == R.IndentWidth && Language == R.Language &&
3952  SortIncludes == R.SortIncludes &&
3983  Standard == R.Standard &&
3986  UseTab == R.UseTab && UseCRLF == R.UseCRLF &&
3988  }
3989 
3991 
3992  // Stores per-language styles. A FormatStyle instance inside has an empty
3993  // StyleSet. A FormatStyle instance returned by the Get method has its
3994  // StyleSet set to a copy of the originating StyleSet, effectively keeping the
3995  // internal representation of that StyleSet alive.
3996  //
3997  // The memory management and ownership reminds of a birds nest: chicks
3998  // leaving the nest take photos of the nest with them.
4000  typedef std::map<FormatStyle::LanguageKind, FormatStyle> MapType;
4001 
4003 
4004  // Adds \p Style to this FormatStyleSet. Style must not have an associated
4005  // FormatStyleSet.
4006  // Style.Language should be different than LK_None. If this FormatStyleSet
4007  // already contains an entry for Style.Language, that gets replaced with the
4008  // passed Style.
4009  void Add(FormatStyle Style);
4010 
4011  // Clears this FormatStyleSet.
4012  void Clear();
4013 
4014  private:
4015  std::shared_ptr<MapType> Styles;
4016  };
4017 
4019  const FormatStyle &MainStyle,
4020  const std::vector<FormatStyle> &ConfigurationStyles);
4021 
4022 private:
4023  FormatStyleSet StyleSet;
4024 
4025  friend std::error_code
4026  parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style,
4027  bool AllowUnknownOptions,
4028  llvm::SourceMgr::DiagHandlerTy DiagHandler,
4029  void *DiagHandlerCtxt);
4030 };
4031 
4032 /// Returns a format style complying with the LLVM coding standards:
4033 /// http://llvm.org/docs/CodingStandards.html.
4035  FormatStyle::LanguageKind Language = FormatStyle::LanguageKind::LK_Cpp);
4036 
4037 /// Returns a format style complying with one of Google's style guides:
4038 /// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml.
4039 /// http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml.
4040 /// https://developers.google.com/protocol-buffers/docs/style.
4042 
4043 /// Returns a format style complying with Chromium's style guide:
4044 /// http://www.chromium.org/developers/coding-style.
4046 
4047 /// Returns a format style complying with Mozilla's style guide:
4048 /// https://firefox-source-docs.mozilla.org/code-quality/coding-style/index.html.
4050 
4051 /// Returns a format style complying with Webkit's style guide:
4052 /// http://www.webkit.org/coding/coding-style.html
4054 
4055 /// Returns a format style complying with GNU Coding Standards:
4056 /// http://www.gnu.org/prep/standards/standards.html
4058 
4059 /// Returns a format style complying with Microsoft style guide:
4060 /// https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017
4062 
4063 /// Returns style indicating formatting should be not applied at all.
4065 
4066 /// Gets a predefined style for the specified language by name.
4067 ///
4068 /// Currently supported names: LLVM, Google, Chromium, Mozilla. Names are
4069 /// compared case-insensitively.
4070 ///
4071 /// Returns ``true`` if the Style has been set.
4073  FormatStyle *Style);
4074 
4075 /// Parse configuration from YAML-formatted text.
4076 ///
4077 /// Style->Language is used to get the base style, if the ``BasedOnStyle``
4078 /// option is present.
4079 ///
4080 /// The FormatStyleSet of Style is reset.
4081 ///
4082 /// When ``BasedOnStyle`` is not present, options not present in the YAML
4083 /// document, are retained in \p Style.
4084 ///
4085 /// If AllowUnknownOptions is true, no errors are emitted if unknown
4086 /// format options are occurred.
4087 ///
4088 /// If set all diagnostics are emitted through the DiagHandler.
4089 std::error_code
4090 parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style,
4091  bool AllowUnknownOptions = false,
4092  llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr,
4093  void *DiagHandlerCtx = nullptr);
4094 
4095 /// Like above but accepts an unnamed buffer.
4096 inline std::error_code parseConfiguration(StringRef Config, FormatStyle *Style,
4097  bool AllowUnknownOptions = false) {
4098  return parseConfiguration(llvm::MemoryBufferRef(Config, "YAML"), Style,
4099  AllowUnknownOptions);
4100 }
4101 
4102 /// Gets configuration in a YAML string.
4103 std::string configurationAsText(const FormatStyle &Style);
4104 
4105 /// Returns the replacements necessary to sort all ``#include`` blocks
4106 /// that are affected by ``Ranges``.
4107 tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
4108  ArrayRef<tooling::Range> Ranges,
4109  StringRef FileName,
4110  unsigned *Cursor = nullptr);
4111 
4112 /// Returns the replacements corresponding to applying and formatting
4113 /// \p Replaces on success; otheriwse, return an llvm::Error carrying
4114 /// llvm::StringError.
4116 formatReplacements(StringRef Code, const tooling::Replacements &Replaces,
4117  const FormatStyle &Style);
4118 
4119 /// Returns the replacements corresponding to applying \p Replaces and
4120 /// cleaning up the code after that on success; otherwise, return an llvm::Error
4121 /// carrying llvm::StringError.
4122 /// This also supports inserting/deleting C++ #include directives:
4123 /// - If a replacement has offset UINT_MAX, length 0, and a replacement text
4124 /// that is an #include directive, this will insert the #include into the
4125 /// correct block in the \p Code.
4126 /// - If a replacement has offset UINT_MAX, length 1, and a replacement text
4127 /// that is the name of the header to be removed, the header will be removed
4128 /// from \p Code if it exists.
4129 /// The include manipulation is done via `tooling::HeaderInclude`, see its
4130 /// documentation for more details on how include insertion points are found and
4131 /// what edits are produced.
4133 cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces,
4134  const FormatStyle &Style);
4135 
4136 /// Represents the status of a formatting attempt.
4138  /// A value of ``false`` means that any of the affected ranges were not
4139  /// formatted due to a non-recoverable syntax error.
4140  bool FormatComplete = true;
4141 
4142  /// If ``FormatComplete`` is false, ``Line`` records a one-based
4143  /// original line number at which a syntax error might have occurred. This is
4144  /// based on a best-effort analysis and could be imprecise.
4145  unsigned Line = 0;
4146 };
4147 
4148 /// Reformats the given \p Ranges in \p Code.
4149 ///
4150 /// Each range is extended on either end to its next bigger logic unit, i.e.
4151 /// everything that might influence its formatting or might be influenced by its
4152 /// formatting.
4153 ///
4154 /// Returns the ``Replacements`` necessary to make all \p Ranges comply with
4155 /// \p Style.
4156 ///
4157 /// If ``Status`` is non-null, its value will be populated with the status of
4158 /// this formatting attempt. See \c FormattingAttemptStatus.
4159 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
4160  ArrayRef<tooling::Range> Ranges,
4161  StringRef FileName = "<stdin>",
4162  FormattingAttemptStatus *Status = nullptr);
4163 
4164 /// Same as above, except if ``IncompleteFormat`` is non-null, its value
4165 /// will be set to true if any of the affected ranges were not formatted due to
4166 /// a non-recoverable syntax error.
4167 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
4168  ArrayRef<tooling::Range> Ranges,
4169  StringRef FileName, bool *IncompleteFormat);
4170 
4171 /// Clean up any erroneous/redundant code in the given \p Ranges in \p
4172 /// Code.
4173 ///
4174 /// Returns the ``Replacements`` that clean up all \p Ranges in \p Code.
4175 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code,
4176  ArrayRef<tooling::Range> Ranges,
4177  StringRef FileName = "<stdin>");
4178 
4179 /// Fix namespace end comments in the given \p Ranges in \p Code.
4180 ///
4181 /// Returns the ``Replacements`` that fix the namespace comments in all
4182 /// \p Ranges in \p Code.
4184  StringRef Code,
4185  ArrayRef<tooling::Range> Ranges,
4186  StringRef FileName = "<stdin>");
4187 
4188 /// Inserts or removes empty lines separating definition blocks including
4189 /// classes, structs, functions, namespaces, and enums in the given \p Ranges in
4190 /// \p Code.
4191 ///
4192 /// Returns the ``Replacements`` that inserts or removes empty lines separating
4193 /// definition blocks in all \p Ranges in \p Code.
4195  StringRef Code,
4196  ArrayRef<tooling::Range> Ranges,
4197  StringRef FileName = "<stdin>");
4198 
4199 /// Sort consecutive using declarations in the given \p Ranges in
4200 /// \p Code.
4201 ///
4202 /// Returns the ``Replacements`` that sort the using declarations in all
4203 /// \p Ranges in \p Code.
4205  StringRef Code,
4206  ArrayRef<tooling::Range> Ranges,
4207  StringRef FileName = "<stdin>");
4208 
4209 /// Returns the ``LangOpts`` that the formatter expects you to set.
4210 ///
4211 /// \param Style determines specific settings for lexing mode.
4213 
4214 /// Description to be used for help text for a ``llvm::cl`` option for
4215 /// specifying format style. The description is closely related to the operation
4216 /// of ``getStyle()``.
4217 extern const char *StyleOptionHelpDescription;
4218 
4219 /// The suggested format style to use by default. This allows tools using
4220 /// `getStyle` to have a consistent default style.
4221 /// Different builds can modify the value to the preferred styles.
4222 extern const char *DefaultFormatStyle;
4223 
4224 /// The suggested predefined style to use as the fallback style in `getStyle`.
4225 /// Different builds can modify the value to the preferred styles.
4226 extern const char *DefaultFallbackStyle;
4227 
4228 /// Construct a FormatStyle based on ``StyleName``.
4229 ///
4230 /// ``StyleName`` can take several forms:
4231 /// * "{<key>: <value>, ...}" - Set specic style parameters.
4232 /// * "<style name>" - One of the style names supported by
4233 /// getPredefinedStyle().
4234 /// * "file" - Load style configuration from a file called ``.clang-format``
4235 /// located in one of the parent directories of ``FileName`` or the current
4236 /// directory if ``FileName`` is empty.
4237 /// * "file:<format_file_path>" to explicitly specify the configuration file to
4238 /// use.
4239 ///
4240 /// \param[in] StyleName Style name to interpret according to the description
4241 /// above.
4242 /// \param[in] FileName Path to start search for .clang-format if ``StyleName``
4243 /// == "file".
4244 /// \param[in] FallbackStyle The name of a predefined style used to fallback to
4245 /// in case \p StyleName is "file" and no file can be found.
4246 /// \param[in] Code The actual code to be formatted. Used to determine the
4247 /// language if the filename isn't sufficient.
4248 /// \param[in] FS The underlying file system, in which the file resides. By
4249 /// default, the file system is the real file system.
4250 /// \param[in] AllowUnknownOptions If true, unknown format options only
4251 /// emit a warning. If false, errors are emitted on unknown format
4252 /// options.
4253 ///
4254 /// \returns FormatStyle as specified by ``StyleName``. If ``StyleName`` is
4255 /// "file" and no file is found, returns ``FallbackStyle``. If no style could be
4256 /// determined, returns an Error.
4257 llvm::Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
4258  StringRef FallbackStyle,
4259  StringRef Code = "",
4260  llvm::vfs::FileSystem *FS = nullptr,
4261  bool AllowUnknownOptions = false);
4262 
4263 // Guesses the language from the ``FileName`` and ``Code`` to be formatted.
4264 // Defaults to FormatStyle::LK_Cpp.
4265 FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code);
4266 
4267 // Returns a string representation of ``Language``.
4269  switch (Language) {
4270  case FormatStyle::LK_Cpp:
4271  return "C++";
4273  return "CSharp";
4274  case FormatStyle::LK_ObjC:
4275  return "Objective-C";
4276  case FormatStyle::LK_Java:
4277  return "Java";
4279  return "JavaScript";
4280  case FormatStyle::LK_Json:
4281  return "Json";
4282  case FormatStyle::LK_Proto:
4283  return "Proto";
4285  return "TableGen";
4287  return "TextProto";
4288  default:
4289  return "Unknown";
4290  }
4291 }
4292 
4293 } // end namespace format
4294 } // end namespace clang
4295 
4296 namespace std {
4297 template <>
4298 struct is_error_code_enum<clang::format::ParseError> : std::true_type {};
4299 } // namespace std
4300 
4301 #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:3572
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:3447
clang::format::FormatStyle::PPDIS_BeforeHash
@ PPDIS_BeforeHash
Indents directives before the hash.
Definition: Format.h:2347
clang::format::FormatStyle::BILS_BeforeColon
@ BILS_BeforeColon
Break inheritance list before the colon and after the commas.
Definition: Format.h:1831
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:1649
clang::format::FormatStyle::NI_Inner
@ NI_Inner
Indent only in inner namespaces (nested in other namespaces).
Definition: Format.h:2704
clang::format::FormatStyle::SDS_Never
@ SDS_Never
Remove any empty line between definition blocks.
Definition: Format.h:3124
clang::format::FormatStyle::SIAS_Always
@ SIAS_Always
Add spaces after < and before >.
Definition: Format.h:3627
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:3478
clang::format::FormatStyle::RCPS_WithPreceding
@ RCPS_WithPreceding
Try to put the clause together with the preceding part of a declaration.
Definition: Format.h:3072
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:1840
clang::format::FormatStyle::SDS_Always
@ SDS_Always
Insert an empty line between definition blocks.
Definition: Format.h:3122
clang::format::configurationAsText
std::string configurationAsText(const FormatStyle &Style)
Gets configuration in a YAML string.
Definition: Format.cpp:1787
clang::format::FormatStyle::ELAAMS_Always
@ ELAAMS_Always
Always add empty line after access modifiers if there are none.
Definition: Format.h:1989
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:1690
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:1309
clang::format::FormatStyle::BraceWrappingFlags::AfterStruct
bool AfterStruct
Wrap struct definitions.
Definition: Format.h:1497
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:3364
clang::format::FormatStyle::SpaceBeforeAssignmentOperators
bool SpaceBeforeAssignmentOperators
If false, spaces will be removed before assignment operators.
Definition: Format.h:3342
clang::format::FormatStyle::BreakStringLiterals
bool BreakStringLiterals
Allow breaking string literals when formatting.
Definition: Format.h:1734
clang::format::FormatStyle::MaxEmptyLinesToKeep
unsigned MaxEmptyLinesToKeep
The maximum number of consecutive empty lines to keep.
Definition: Format.h:2681
clang::format::FormatStyle::FormatStyleSet::MapType
std::map< FormatStyle::LanguageKind, FormatStyle > MapType
Definition: Format.h:4000
clang::format::FormatStyle::LanguageStandard
LanguageStandard
Supported language standards for parsing and formatting C++ constructs.
Definition: Format.h:3770
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterControlStatements
bool AfterControlStatements
If true, put space betwee control statement keywords (for/if/while...) and opening parentheses.
Definition: Format.h:3464
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:3079
clang::format::FormatStyle::QAS_Right
@ QAS_Right
Change specifiers/qualifiers to be right-aligned.
Definition: Format.h:1774
clang::format::ParseError::MissingQualifierOrder
@ MissingQualifierOrder
clang::format::FormatStyle::FormatStyleSet::Get
llvm::Optional< FormatStyle > Get(FormatStyle::LanguageKind Language) const
Definition: Format.cpp:1802
clang::format::FormatStyle::RequiresClausePosition
RequiresClausePositionStyle RequiresClausePosition
The position of the requires clause.
Definition: Format.h:3115
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:1721
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:1721
clang::format::FormatStyle::PenaltyBreakString
unsigned PenaltyBreakString
The penalty for each line break introduced inside a string literal.
Definition: Format.h:2821
clang::format::getMicrosoftStyle
FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language)
Returns a format style complying with Microsoft style guide: https://docs.microsoft....
Definition: Format.cpp:1622
clang::format::FormatStyle::BraceWrappingFlags::AfterControlStatement
BraceWrappingAfterControlStatementStyle AfterControlStatement
Wrap control statements (if/for/while/switch/..).
Definition: Format.h:1435
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:2752
clang::format::FormatStyle::BOS_None
@ BOS_None
Break after operators.
Definition: Format.h:899
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:3439
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:3385
clang::format::getParseCategory
const std::error_category & getParseCategory()
Definition: Format.cpp:1005
clang::format::FormatStyle::DerivePointerAlignment
bool DerivePointerAlignment
If true, analyze the formatted file for the most common alignment of & and *.
Definition: Format.h:1941
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:1358
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterRequiresInClause
bool AfterRequiresInClause
If true, put space between requires keyword in a requires clause and opening parentheses,...
Definition: Format.h:3509
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:3536
clang::format::FormatStyle::Standard
LanguageStandard Standard
Parse and format C++ constructs compatible with this standard.
Definition: Format.h:3795
clang::format::FormatStyle::IndentAccessModifiers
bool IndentAccessModifiers
Specify whether access modifiers should have their own indentation level.
Definition: Format.h:2258
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:3662
clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyRecord
bool SplitEmptyRecord
If false, empty record (e.g.
Definition: Format.h:1613
clang::format::FormatStyle::JSQS_Double
@ JSQS_Double
Always use double quotes.
Definition: Format.h:2530
clang::format::FormatStyle::BraceBreakingStyle
BraceBreakingStyle
Different ways to attach braces to their surrounding context.
Definition: Format.h:931
clang::format::DefaultFallbackStyle
const char * DefaultFallbackStyle
The suggested predefined style to use as the fallback style in getStyle.
Definition: Format.cpp:3497
clang::format::FormatStyle::ShortNamespaceLines
unsigned ShortNamespaceLines
The maximal number of unwrapped lines that a short namespace spans.
Definition: Format.h:3195
clang::format::FormatStyle::PCIS_CurrentLine
@ PCIS_CurrentLine
Put all constructor initializers on the current line if they fit.
Definition: Format.h:2100
clang::format::FormatStyle::JavaScriptQuoteStyle
JavaScriptQuoteStyle
Quotation styles for JavaScript strings.
Definition: Format.h:2512
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:3034
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:1752
clang::format::FormatStyle::SpacesInConditionalStatement
bool SpacesInConditionalStatement
If true, spaces will be inserted around if/for/switch/while conditions.
Definition: Format.h:3644
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:3665
Cursor
Cursor
Definition: SerializedDiagnosticReader.cpp:109
clang::format::FormatStyle::SortIncludes
SortIncludesOptions SortIncludes
Controls if and how clang-format will sort #includes.
Definition: Format.h:3235
clang::format::FormatStyle::SIAS_Never
@ SIAS_Never
Remove spaces after < and before >.
Definition: Format.h:3621
clang::format::FormatStyle::BraceWrappingFlags::BeforeLambdaBody
bool BeforeLambdaBody
Wrap lambda block.
Definition: Format.h:1572
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:2852
clang::format::FormatStyle::LK_TableGen
@ LK_TableGen
Should be used for TableGen code.
Definition: Format.h:2589
clang::format::FormatStyle::BraceWrappingAfterControlStatementStyle
BraceWrappingAfterControlStatementStyle
Different ways to wrap braces after control statements.
Definition: Format.h:1366
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:2474
clang::format::FormatStyle::RAS_Right
@ RAS_Right
Align reference to the right.
Definition: Format.h:2952
clang::format::FormatStyle::StatementMacros
std::vector< std::string > StatementMacros
A vector of macros that should be interpreted as complete statements.
Definition: Format.h:2199
clang::format::FormatStyle::BS_Mozilla
@ BS_Mozilla
Like Attach, but break before braces on enum, function, and record definitions.
Definition: Format.h:1076
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:928
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:3477
clang::format::FormatStyle::PAS_Left
@ PAS_Left
Align pointer to the left.
Definition: Format.h:2847
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:2034
clang::format::FormatStyle::SpaceAroundPointerQualifiers
SpaceAroundPointerQualifiersStyle SpaceAroundPointerQualifiers
Defines in which cases to put a space before or after pointer qualifiers.
Definition: Format.h:3333
clang::format::FormatStyle::IndentCaseLabels
bool IndentCaseLabels
Indent case labels one level from the switch statement.
Definition: Format.h:2277
clang::format::FormatStyle::QAS_Leave
@ QAS_Leave
Don't change specifiers/qualifiers to either Left or Right alignment (default).
Definition: Format.h:1762
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:3471
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::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:4145
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:1660
clang::format::FormatStyle::PenaltyReturnTypeOnItsOwnLine
unsigned PenaltyReturnTypeOnItsOwnLine
Penalty for putting the return type of a function onto its own line.
Definition: Format.h:2834
clang::format::FormatStyle::RawStringFormat::CanonicalDelimiter
std::string CanonicalDelimiter
The canonical delimiter for this language.
Definition: Format.h:2888
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:2300
llvm::Expected
Definition: LLVM.h:41
clang::format::FormatStyle::BBCDS_Allowed
@ BBCDS_Allowed
Breaking between template declaration and concept is allowed.
Definition: Format.h:1653
clang::format::FormatStyle::IndentWrappedFunctionNames
bool IndentWrappedFunctionNames
Indent if a function definition or declaration is wrapped after the type.
Definition: Format.h:2442
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:3435
clang::format::FormatStyle::BraceWrappingFlags::AfterFunction
bool AfterFunction
Wrap function definitions.
Definition: Format.h:1463
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:2886
clang::format::FormatStyle::SpaceBeforeCaseColon
bool SpaceBeforeCaseColon
If false, spaces will be removed before case colon.
Definition: Format.h:3352
clang::format::FormatStyle::BS_Linux
@ BS_Linux
Like Attach, but break before braces on function, namespace and class definitions.
Definition: Format.h:1026
clang::format::FormatStyle::BitFieldColonSpacingStyle
BitFieldColonSpacingStyle
Styles for adding spacing around : in bitfield definitions.
Definition: Format.h:3734
clang::format::FormatStyle::PCIS_Never
@ PCIS_Never
Always put each constructor initializer on its own line.
Definition: Format.h:2082
clang::format::FormatStyle::SAPQ_Before
@ SAPQ_Before
Ensure that there is a space before pointer qualifiers.
Definition: Format.h:3316
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:2857
clang::format::FormatStyle::PPIndentWidth
int PPIndentWidth
The number of columns to use for indentation of preprocessor statements.
Definition: Format.h:2877
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:1928
clang::format::FormatStyle::SpaceBeforeCtorInitializerColon
bool SpaceBeforeCtorInitializerColon
If false, spaces will be removed before constructor initializer colon.
Definition: Format.h:3373
clang::format::FormatStyle::BinPackStyle
BinPackStyle
The style of wrapping parameters on the same line (bin-packed) or on one line each.
Definition: Format.h:877
clang::format::FormatStyle::UseCRLF
bool UseCRLF
Use \r\n instead of \n for line breaks.
Definition: Format.h:3838
clang::format::FormatStyle::BraceWrappingFlags::AfterExternBlock
bool AfterExternBlock
Wrap extern blocks.
Definition: Format.h:1525
clang::format::FormatStyle::LK_None
@ LK_None
Do not use.
Definition: Format.h:2572
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:911
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:2604
clang::format::FormatStyle::BraceWrappingFlags::AfterUnion
bool AfterUnion
Wrap union definitions.
Definition: Format.h:1511
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:3519
clang::format::FormatStyle::BFCS_Before
@ BFCS_Before
Add space before the : only.
Definition: Format.h:3750
clang::format::FormatStyle::LS_Auto
@ LS_Auto
Automatic detection based on the input.
Definition: Format.h:3786
clang::format::FormatStyle::SAPQ_After
@ SAPQ_After
Ensure that there is a space after pointer qualifiers.
Definition: Format.h:3322
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:3832
clang::format::FormatStyle::LK_Json
@ LK_Json
Should be used for JSON.
Definition: Format.h:2582
clang::format::FormatStyle::BFCS_Both
@ BFCS_Both
Add one space on each side of the :
Definition: Format.h:3739
clang::format::FormatStyle::BraceWrappingFlags::BeforeElse
bool BeforeElse
Wrap before else.
Definition: Format.h:1555
clang::format::FormatStyle::operator==
bool operator==(const FormatStyle &R) const
Definition: Format.h:3844
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:2979
clang::format::FormatStyle::SpaceAfterCStyleCast
bool SpaceAfterCStyleCast
If true, a space is inserted after C style casts.
Definition: Format.h:3284
clang::format::FormatStyle::ExperimentalAutoDetectBinPacking
bool ExperimentalAutoDetectBinPacking
If true, clang-format detects whether function calls and definitions are formatted with one parameter...
Definition: Format.h:2072
clang::format::FormatStyle::PenaltyBreakOpenParenthesis
unsigned PenaltyBreakOpenParenthesis
The penalty for breaking after (.
Definition: Format.h:2817
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:2114
clang::format::FormatStyle::SBPO_Never
@ SBPO_Never
Never put a space before opening parentheses.
Definition: Format.h:3393
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:1698
clang::format::FormatStyle::BraceWrappingFlags
Precise control over the wrapping of braces.
Definition: Format.h:1406
clang::format::FormatStyle::IndentWidth
unsigned IndentWidth
The number of columns to use for indentation.
Definition: Format.h:2428
clang::format::FormatStyle::RawStringFormat::operator==
bool operator==(const RawStringFormat &Other) const
Definition: Format.h:2893
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:2171
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:2338
clang::format::FormatStyle::IEBS_NoIndent
@ IEBS_NoIndent
Does not indent extern blocks.
Definition: Format.h:2380
clang::format::FormatStyle::LK_TextProto
@ LK_TextProto
Should be used for Protocol Buffer messages in text format (https://developers.google....
Definition: Format.h:2592
clang::format::FormatStyle::SpaceBeforeParensStyle
SpaceBeforeParensStyle
Different ways to put a space before opening parentheses.
Definition: Format.h:3384
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:3395
clang::format::FormatStyle::RAS_Pointer
@ RAS_Pointer
Align reference like PointerAlignment.
Definition: Format.h:2942
clang::format::FormatStyle::LS_Cpp11
@ LS_Cpp11
Parse and format as C++11.
Definition: Format.h:3775
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:1720
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:2587
LangOptions.h
clang::format::FormatStyle::IndentExternBlock
IndentExternBlockStyle IndentExternBlock
IndentExternBlockStyle is the type of indenting of extern blocks.
Definition: Format.h:2392
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:3375
clang::format::FormatStyle::SpacesInLineComment::Minimum
unsigned Minimum
The minimum number of spaces at the start of the comment.
Definition: Format.h:3667
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:1498
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:2373
clang::format::FormatStyle::SJSIO_After
@ SJSIO_After
Static imports are placed after non-static imports.
Definition: Format.h:3252
clang::format::FormatStyle::BS_Allman
@ BS_Allman
Always break before braces.
Definition: Format.h:1186
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:1999
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:2763
clang::format::FormatStyle::NamespaceIndentation
NamespaceIndentationKind NamespaceIndentation
The indentation used for namespaces.
Definition: Format.h:2719
clang::format::FormatStyle::SpaceInEmptyBlock
bool SpaceInEmptyBlock
If true, spaces will be inserted into {}.
Definition: Format.h:3581
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:3120
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:1447
clang::format::FormatStyle::SpaceAfterTemplateKeyword
bool SpaceAfterTemplateKeyword
If true, a space will be inserted after the 'template' keyword.
Definition: Format.h:3300
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:2212
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:2813
clang::format::getFormattingLangOpts
LangOptions getFormattingLangOpts(const FormatStyle &Style=getLLVMStyle())
Returns the LangOpts that the formatter expects you to set.
Definition: Format.cpp:3405
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterIfMacros
bool AfterIfMacros
If true, put space between if macros and opening parentheses.
Definition: Format.h:3492
clang::format::FormatStyle::BFCS_After
@ BFCS_After
Add space after the : only (space may be added before if needed for AlignConsecutiveBitFields).
Definition: Format.h:3756
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:2387
clang::format::FormatStyle::SJSIO_Before
@ SJSIO_Before
Static imports are placed before non-static imports.
Definition: Format.h:3245
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:1363
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:1175
clang::format::FormattingAttemptStatus
Represents the status of a formatting attempt.
Definition: Format.h:4137
clang::format::FormatStyle::BreakInheritanceListStyle
BreakInheritanceListStyle
Different ways to break inheritance list.
Definition: Format.h:1823
clang::format::FormatStyle::SAPQ_Default
@ SAPQ_Default
Don't ensure spaces around pointer qualifiers and use PointerAlignment instead.
Definition: Format.h:3310
clang::format::FormatStyle::ColumnLimit
unsigned ColumnLimit
The column limit.
Definition: Format.h:1742
clang::format::FormatStyle::ReferenceAlignmentStyle
ReferenceAlignmentStyle
The & and && alignment style.
Definition: Format.h:2940
clang::format::FormatStyle::isJson
bool isJson() const
Definition: Format.h:2596
clang::format::FormatStyle::KeepEmptyLinesAtTheStartOfBlocks
bool KeepEmptyLinesAtTheStartOfBlocks
If true, the empty line at the start of blocks is kept.
Definition: Format.h:2563
clang::format::FormatStyle::JavaScriptWrapImports
bool JavaScriptWrapImports
Whether to wrap JavaScript import/export statements.
Definition: Format.h:2551
clang::format::FormatStyle::BraceWrappingFlags::AfterObjCDeclaration
bool AfterObjCDeclaration
Wrap ObjC definitions (interfaces, implementations...).
Definition: Format.h:1483
clang::format::FormatStyle::BS_Attach
@ BS_Attach
Always attach braces to surrounding context.
Definition: Format.h:976
clang::format::FormatStyle::PenaltyBreakAssignment
unsigned PenaltyBreakAssignment
The penalty for breaking around an assignment operator.
Definition: Format.h:2801
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:2132
clang::format::FormatStyle::PenaltyExcessCharacter
unsigned PenaltyExcessCharacter
The penalty for each character outside of the column limit.
Definition: Format.h:2829
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:2355
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:2634
clang::format::FormatStyle::BraceWrappingFlags::IndentBraces
bool IndentBraces
Indent the wrapped braces themselves.
Definition: Format.h:1588
clang::format::FormatStyle::QualifierOrder
std::vector< std::string > QualifierOrder
The order in which the qualifiers appear.
Definition: Format.h:1820
clang::format::FormatStyle::BitFieldColonSpacing
BitFieldColonSpacingStyle BitFieldColonSpacing
The BitFieldColonSpacingStyle to use for bitfields.
Definition: Format.h:3760
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:3342
clang::format::FormatStyle::IndentGotoLabels
bool IndentGotoLabels
Indent goto labels.
Definition: Format.h:2317
clang::format::FormatStyle::MacroBlockEnd
std::string MacroBlockEnd
A regular expression matching macros that end a block.
Definition: Format.h:2667
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:2229
clang::format::FormatStyle::BFCS_None
@ BFCS_None
Add no space around the : (except when needed for AlignConsecutiveBitFields).
Definition: Format.h:3745
clang::format::FormatStyle::QualifierAlignment
QualifierAlignmentStyle QualifierAlignment
Different ways to arrange specifiers and qualifiers (e.g.
Definition: Format.h:1798
clang::format::FormatStyle::BWACS_Never
@ BWACS_Never
Never wrap braces after a control statement.
Definition: Format.h:1375
clang::format::FormatStyle::TabWidth
unsigned TabWidth
The number of columns used for tab stops.
Definition: Format.h:3816
clang::format::FormatStyle::LK_Cpp
@ LK_Cpp
Should be used for C, C++.
Definition: Format.h:2574
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:3812
clang::format::FormatStyle::BILS_AfterColon
@ BILS_AfterColon
Break inheritance list after the colon and commas.
Definition: Format.h:1848
clang::format::FormatStyle::QAS_Left
@ QAS_Left
Change specifiers/qualifiers to be left-aligned.
Definition: Format.h:1768
clang::format::FormatStyle::RawStringFormat::BasedOnStyle
std::string BasedOnStyle
The style name on which this raw string format is based on.
Definition: Format.h:2892
clang::format::FormatStyle::BraceWrappingFlags::BeforeCatch
bool BeforeCatch
Wrap before catch.
Definition: Format.h:1541
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:3721
clang::format::FormatStyle::isJavaScript
bool isJavaScript() const
Definition: Format.h:2597
clang::format::FormatStyle::BraceWrapping
BraceWrappingFlags BraceWrapping
Control of individual brace wrapping cases.
Definition: Format.h:1641
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:2016
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:3821
clang::format::FormatStyle::BreakBeforeConceptDeclarationsStyle
BreakBeforeConceptDeclarationsStyle
Different ways to break before concept declarations.
Definition: Format.h:1644
clang::format::FormatStyle::BreakConstructorInitializers
BreakConstructorInitializersStyle BreakConstructorInitializers
The break constructor initializers style to use.
Definition: Format.h:1710
clang::format::FormatStyle::SpacesInContainerLiterals
bool SpacesInContainerLiterals
If true, spaces are inserted inside container literals (e.g.
Definition: Format.h:3654
clang::format::FormatStyle::PointerAlignmentStyle
PointerAlignmentStyle
The &, && and * alignment style.
Definition: Format.h:2842
clang::format::FormatStyle::ObjCSpaceAfterProperty
bool ObjCSpaceAfterProperty
Add a space after @property in Objective-C, i.e.
Definition: Format.h:2768
clang::format::FormatStyle::QAS_Custom
@ QAS_Custom
Change specifiers/qualifiers to be aligned based on QualifierOrder.
Definition: Format.h:1786
clang::format::FormatStyle::LBI_Signature
@ LBI_Signature
Align lambda body relative to the lambda signature.
Definition: Format.h:2612
clang::format::FormatStyle::PPDIS_None
@ PPDIS_None
Does not indent any directives.
Definition: Format.h:2329
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:3259
clang::format::FormatStyle::SpacesInLineComment::Maximum
unsigned Maximum
The maximum number of spaces at the start of the comment.
Definition: Format.h:3669
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterOverloadedOperator
bool AfterOverloadedOperator
If true, put a space between operator overloading and opening parentheses.
Definition: Format.h:3500
clang::format::FormatStyle::SBPO_ControlStatements
@ SBPO_ControlStatements
Put a space before opening parentheses only after control statement keywords (for/if/while....
Definition: Format.h:3403
clang::format::FormatStyle::DisableFormat
bool DisableFormat
Disables formatting completely.
Definition: Format.h:1945
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:3216
clang::format::FormatStyle::SpacesInParentheses
bool SpacesInParentheses
If true, spaces will be inserted after ( and before ).
Definition: Format.h:3710
clang::format::FormatStyle::ContinuationIndentWidth
unsigned ContinuationIndentWidth
Indent width for line continuations.
Definition: Format.h:1905
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:2621
clang::format::FormatStyle::isCSharp
bool isCSharp() const
Definition: Format.h:2595
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:3039
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:1396
clang::format::FormatStyle::SpaceBeforeInheritanceColon
bool SpaceBeforeInheritanceColon
If false, spaces will be removed before inheritance colon.
Definition: Format.h:3381
clang::format::FormatStyle::BCIS_AfterColon
@ BCIS_AfterColon
Break constructor initializers after the colon and commas.
Definition: Format.h:1705
clang::format::FormatStyle::SpacesInAnglesStyle
SpacesInAnglesStyle
Styles for adding spacing after < and before `> in template argument lists.
Definition: Format.h:3615
clang::format::DefaultFormatStyle
const char * DefaultFormatStyle
The suggested format style to use by default.
Definition: Format.cpp:3495
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:3189
clang::format::FormatStyle::RCPS_SingleLine
@ RCPS_SingleLine
Try to put everything in the same line if possible.
Definition: Format.h:3110
clang::format::FormatStyle::PenaltyBreakTemplateDeclaration
unsigned PenaltyBreakTemplateDeclaration
The penalty for breaking after template declaration.
Definition: Format.h:2825
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:1126
clang::format::FormatStyle::FormatStyleSet::Add
void Add(FormatStyle Style)
Definition: Format.cpp:1813
Replacement.h
clang::format::FormatStyle::JSQS_Leave
@ JSQS_Leave
Leave string quotes as they are.
Definition: Format.h:2518
clang::format::FormatStyle::Language
LanguageKind Language
Language, this format style is targeted at.
Definition: Format.h:2601
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:3529
clang::format::FormatStyle::SpaceBeforeSquareBrackets
bool SpaceBeforeSquareBrackets
If true, spaces will be before [.
Definition: Format.h:3731
clang::format::FormatStyle::LK_Java
@ LK_Java
Should be used for Java.
Definition: Format.h:2578
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:3038
clang::format::FormatStyle::NI_None
@ NI_None
Don't indent in namespaces.
Definition: Format.h:2694
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:3427
clang::format::FormatStyle::LS_Cpp17
@ LS_Cpp17
Parse and format as C++17.
Definition: Format.h:3779
clang::format::FormatStyle::PackConstructorInitializersStyle
PackConstructorInitializersStyle
Different ways to try to fit all constructor initializers on a line.
Definition: Format.h:2075
clang::format::FormatStyle::SpacesInAngles
SpacesInAnglesStyle SpacesInAngles
The SpacesInAnglesStyle to use for template argument lists.
Definition: Format.h:3634
clang::format::FormatStyle::EmptyLineAfterAccessModifierStyle
EmptyLineAfterAccessModifierStyle
Different styles for empty line after access modifiers.
Definition: Format.h:1950
clang::format::FormatStyle::CompactNamespaces
bool CompactNamespaces
If true, consecutive namespace declarations will be on the same line.
Definition: Format.h:1884
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:3999
clang::format::FormatStyle::BBCDS_Always
@ BBCDS_Always
Always break before concept, putting it in the line after the template declaration.
Definition: Format.h:1660
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:3511
clang::format::FormatStyle::SBPO_Custom
@ SBPO_Custom
Configure each individual space before parentheses in SpaceBeforeParensOptions.
Definition: Format.h:3442
clang::format::FormatStyle::NI_All
@ NI_All
Indent in all namespaces.
Definition: Format.h:2714
clang::format::FormatStyle::ObjCBreakBeforeNestedBlockParam
bool ObjCBreakBeforeNestedBlockParam
Break parameters list into lines when there is nested block parameters in a function call.
Definition: Format.h:2792
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:1584
clang::format::FormatStyle::SortUsingDeclarations
bool SortUsingDeclarations
If true, clang-format will sort using declarations.
Definition: Format.h:3276
clang::format::FormatStyle::ELAAMS_Never
@ ELAAMS_Never
Remove all empty lines after access modifiers.
Definition: Format.h:1965
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:3198
clang::format::FormatStyle::RCPS_OwnLine
@ RCPS_OwnLine
Always put the requires clause on its own line.
Definition: Format.h:3055
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:2882
clang::format::FormatStyle::SpaceBeforeParensCustom::AfterFunctionDefinitionName
bool AfterFunctionDefinitionName
If true, put a space between function definition name and opening parentheses.
Definition: Format.h:3485
clang::format::FormatStyle::MacroBlockBegin
std::string MacroBlockBegin
A regular expression matching macros that start a block.
Definition: Format.h:2663
clang::format::FormatStyle::BinaryOperatorStyle
BinaryOperatorStyle
The style of breaking before or after binary operators.
Definition: Format.h:887
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:2014
clang::format::FormatStyle::SpaceAfterLogicalNot
bool SpaceAfterLogicalNot
If true, a space is inserted after the logical not operator (!).
Definition: Format.h:3292
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:2054
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:1996
clang::format::FormatStyle::JSQS_Single
@ JSQS_Single
Always use single quotes.
Definition: Format.h:2524
clang::format::FormatStyle::BILS_AfterComma
@ BILS_AfterComma
Break inheritance list only after the commas.
Definition: Format.h:1855
std
Definition: Format.h:4296
clang::format::FormatStyle::UseTabStyle
UseTabStyle
Different ways to use tab in formatting.
Definition: Format.h:3819
clang::format::FormatStyle::SpaceAroundPointerQualifiersStyle
SpaceAroundPointerQualifiersStyle
Different ways to put a space before opening parentheses.
Definition: Format.h:3303
clang::format::FormatStyle::SAPQ_Both
@ SAPQ_Both
Ensure that there is a space both before and after pointer qualifiers.
Definition: Format.h:3328
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:2684
clang::format::FormatStyle::SpacesInLineCommentPrefix
SpacesInLineComment SpacesInLineCommentPrefix
How many spaces are allowed at the start of a line comment.
Definition: Format.h:3702
clang::format::FormatStyle::SpaceBeforeParensCustom
Precise control over the spacing before parentheses.
Definition: Format.h:3457
clang::format::FormatStyle::BraceWrappingFlags::AfterClass
bool AfterClass
Wrap class definitions.
Definition: Format.h:1432
clang::format::FormatStyle::LS_Cpp20
@ LS_Cpp20
Parse and format as C++20.
Definition: Format.h:3781
clang::format::FormatStyle::ConstructorInitializerIndentWidth
unsigned ConstructorInitializerIndentWidth
This option is deprecated.
Definition: Format.h:1894
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:1827
clang
Definition: CalledOnceCheck.h:17
clang::format::FormatStyle::IncludeStyle
tooling::IncludeStyle IncludeStyle
Definition: Format.h:2231
clang::format::getLanguageName
StringRef getLanguageName(FormatStyle::LanguageKind Language)
Definition: Format.h:4268
clang::format::FormatStyle::SeparateDefinitionBlocks
SeparateDefinitionStyle SeparateDefinitionBlocks
Specifies the use of empty lines to separate definition blocks, including classes,...
Definition: Format.h:3173
clang::format::FormatStyle::RawStringFormats
std::vector< RawStringFormat > RawStringFormats
Defines hints for detecting supported languages code blocks in raw strings.
Definition: Format.h:2937
clang::format::getNoStyle
FormatStyle getNoStyle()
Returns style indicating formatting should be not applied at all.
Definition: Format.cpp:1652
clang::format::FormatStyle::BS_WebKit
@ BS_WebKit
Like Attach, but break before functions.
Definition: Format.h:1356
clang::format::getMozillaStyle
FormatStyle getMozillaStyle()
Returns a format style complying with Mozilla's style guide: https://firefox-source-docs....
Definition: Format.cpp:1558
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:1755
clang::format::FormatStyle::BPS_Always
@ BPS_Always
Always bin-pack parameters.
Definition: Format.h:881
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:1246
clang::format::FormatStyle::SpacesBeforeTrailingComments
unsigned SpacesBeforeTrailingComments
The number of spaces before trailing line comments (// - comments).
Definition: Format.h:3611
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:2963
clang::format::ParseError::DuplicateQualifierSpecified
@ DuplicateQualifierSpecified
clang::format::FormatStyle::BreakInheritanceList
BreakInheritanceListStyle BreakInheritanceList
The inheritance list style to use.
Definition: Format.h:1860
clang::format::FormatStyle::BraceWrappingFlags::AfterNamespace
bool AfterNamespace
Wrap namespace definitions.
Definition: Format.h:1479
clang::format::FormatStyle::ObjCSpaceBeforeProtocolList
bool ObjCSpaceBeforeProtocolList
Add a space in front of an Objective-C protocol list, i.e.
Definition: Format.h:2797
clang::format::FormatStyle::LanguageKind
LanguageKind
Supported languages.
Definition: Format.h:2570
clang::format::FormatStyle::RAS_Middle
@ RAS_Middle
Align reference in the middle.
Definition: Format.h:2957
clang::format::FormatStyle::isCpp
bool isCpp() const
Definition: Format.h:2594
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:3225
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:1018
clang::format::FormatStyle::PCIS_BinPack
@ PCIS_BinPack
Bin-pack constructor initializers.
Definition: Format.h:2089
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:2862
clang::format::FormatStyle::LS_Latest
@ LS_Latest
Parse and format using the latest supported language version.
Definition: Format.h:3784
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:3826
clang::format::FormatStyle::BraceWrappingFlags::BeforeWhile
bool BeforeWhile
Wrap before while.
Definition: Format.h:1586
clang::format::FormatStyle::JavaImportGroups
std::vector< std::string > JavaImportGroups
A vector of prefixes ordered by the desired groups for Java imports.
Definition: Format.h:2508
clang::format::FormatStyle::BPS_Never
@ BPS_Never
Never bin-pack parameters.
Definition: Format.h:883
clang::format::FormatStyle::FormatStyleSet::Clear
void Clear()
Definition: Format.cpp:1824
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:2188
clang::format::FormatStyle::IndentRequiresClause
bool IndentRequiresClause
Indent the requires clause in a template.
Definition: Format.h:2414
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:2150
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:3563
clang::format::FormatStyle::SeparateDefinitionStyle
SeparateDefinitionStyle
The style if definition blocks should be separated.
Definition: Format.h:3118
clang::format::ParseErrorCategory
Definition: Format.h:44
clang::format::FormatStyle::PackConstructorInitializers
PackConstructorInitializersStyle PackConstructorInitializers
The pack constructor initializers style to use.
Definition: Format.h:2119
clang::format::FormatStyle::EmptyLineBeforeAccessModifier
EmptyLineBeforeAccessModifierStyle EmptyLineBeforeAccessModifier
Defines in which cases to put empty line before access modifiers.
Definition: Format.h:2059
clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyFunction
bool SplitEmptyFunction
If false, empty function body can be put on a single line.
Definition: Format.h:1601
clang::format::FormatStyle::UseTab
UseTabStyle UseTab
The way to use tab characters in the resulting file.
Definition: Format.h:3842
clang::format::FormatStyle::IndentPPDirectives
PPDirectiveIndentStyle IndentPPDirectives
The preprocessor directive indenting style to use.
Definition: Format.h:2352
clang::format::FormatStyle::RAS_Left
@ RAS_Left
Align reference to the left.
Definition: Format.h:2947
clang::format::FormatStyle::BS_Custom
@ BS_Custom
Configure each individual brace in BraceWrapping.
Definition: Format.h:1358
clang::format::FormatStyle::ELAAMS_Leave
@ ELAAMS_Leave
Keep existing empty lines after access modifiers.
Definition: Format.h:1968
clang::format::FormatStyle::JavaScriptQuotes
JavaScriptQuoteStyle JavaScriptQuotes
The JavaScriptQuoteStyle to use for JavaScript strings.
Definition: Format.h:2535
clang::format::FormatStyle::BraceWrappingFlags::SplitEmptyNamespace
bool SplitEmptyNamespace
If false, empty namespace body can be put on a single line.
Definition: Format.h:1625
clang::format::FormatStyle::BreakBeforeTernaryOperators
bool BreakBeforeTernaryOperators
If true, ternary operators will be placed after line breaks.
Definition: Format.h:1680
clang::format::ParseErrorCategory::message
std::string message(int EV) const override
Definition: Format.cpp:1022
clang::format::make_error_code
std::error_code make_error_code(ParseError e)
Definition: Format.cpp:1009
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:3527
clang::format::FormatStyle::LK_CSharp
@ LK_CSharp
Should be used for C#.
Definition: Format.h:2576
clang::format::FormatStyle::SpaceInEmptyParentheses
bool SpaceInEmptyParentheses
If true, spaces may be inserted into ().
Definition: Format.h:3594
clang::format::FormatStyle::PenaltyIndentedWhitespace
unsigned PenaltyIndentedWhitespace
Penalty for each character of whitespace indentation (counted relative to leading non-whitespace colu...
Definition: Format.h:2839
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:3238
clang::format::FormatStyle::RCPS_WithFollowing
@ RCPS_WithFollowing
Try to put the requires clause together with the class or function declaration.
Definition: Format.h:3086
clang::format::FormatStyle::PPDirectiveIndentStyle
PPDirectiveIndentStyle
Options for indenting preprocessor directives.
Definition: Format.h:2320
clang::format::FormatStyle::BWACS_MultiLine
@ BWACS_MultiLine
Only wrap braces after a multi-line control statement.
Definition: Format.h:1386
clang::format::FormatStyle::SIAS_Leave
@ SIAS_Leave
Keep a single space after < and before > if any spaces were present.
Definition: Format.h:3630
clang::format::ParseError::InvalidQualifierSpecified
@ InvalidQualifierSpecified
clang::format::FormatStyle::LS_Cpp14
@ LS_Cpp14
Parse and format as C++14.
Definition: Format.h:3777
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:3353
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:2884
clang::format::ParseError::BinPackTrailingCommaConflict
@ BinPackTrailingCommaConflict
clang::format::FormatStyle::BreakConstructorInitializersStyle
BreakConstructorInitializersStyle
Different ways to break initializers.
Definition: Format.h:1683
clang::format::FormatStyle::BraceWrappingFlags::AfterCaseLabel
bool AfterCaseLabel
Wrap case labels.
Definition: Format.h:1422
clang::format::getGNUStyle
FormatStyle getGNUStyle()
Returns a format style complying with GNU Coding Standards: http://www.gnu.org/prep/standards/standar...
Definition: Format.cpp:1607
clang::format::FormatStyle::PenaltyBreakBeforeFirstCallParameter
unsigned PenaltyBreakBeforeFirstCallParameter
The penalty for breaking a function call after call(.
Definition: Format.h:2805
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:4140
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:3416
clang::format::FormatStyle::LK_ObjC
@ LK_ObjC
Should be used for Objective-C, Objective-C++.
Definition: Format.h:2584
clang::format::FormatStyle::DeriveLineEnding
bool DeriveLineEnding
Analyze the formatted file for the most used line ending (\r\n or \n).
Definition: Format.h:1933
clang::format::FormatStyle::BPS_Auto
@ BPS_Auto
Automatically determine parameter bin-packing behavior.
Definition: Format.h:879
clang::format::FormatStyle::RawStringFormat
See documentation of RawStringFormats.
Definition: Format.h:2880
clang::format::FormatStyle::BreakBeforeConceptDeclarations
BreakBeforeConceptDeclarationsStyle BreakBeforeConceptDeclarations
The concept declaration style to use.
Definition: Format.h:1665
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:3207
clang::format::FormatStyle::LS_Cpp03
@ LS_Cpp03
Parse and format as C++03.
Definition: Format.h:3773
clang::format::FormatStyle::UT_ForIndentation
@ UT_ForIndentation
Use tabs only for indentation.
Definition: Format.h:3823
clang::format::FormatStyle::LK_JavaScript
@ LK_JavaScript
Should be used for JavaScript.
Definition: Format.h:2580
clang::format::FormatStyle::UT_AlignWithSpaces
@ UT_AlignWithSpaces
Use tabs for line continuation and indentation, and spaces for alignment.
Definition: Format.h:3829
clang::format::FormatStyle::PenaltyBreakComment
unsigned PenaltyBreakComment
The penalty for each line break introduced inside a comment.
Definition: Format.h:2809
clang::format::FormatStyle::BOS_All
@ BOS_All
Break before operators.
Definition: Format.h:923
clang::format::FormatStyle::SIS_AllIfsAndElse
@ SIS_AllIfsAndElse
Always put short ifs, else ifs and else statements on the same line.
Definition: Format.h:599