Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:54

0001 //===--- Format.h - Format C++ code -----------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 ///
0009 /// \file
0010 /// Various functions to configurably format source code.
0011 ///
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CLANG_FORMAT_FORMAT_H
0015 #define LLVM_CLANG_FORMAT_FORMAT_H
0016 
0017 #include "clang/Basic/LangOptions.h"
0018 #include "clang/Tooling/Core/Replacement.h"
0019 #include "clang/Tooling/Inclusions/IncludeStyle.h"
0020 #include "llvm/ADT/ArrayRef.h"
0021 #include "llvm/Support/Regex.h"
0022 #include "llvm/Support/SourceMgr.h"
0023 #include <optional>
0024 #include <system_error>
0025 
0026 namespace llvm {
0027 namespace vfs {
0028 class FileSystem;
0029 }
0030 } // namespace llvm
0031 
0032 namespace clang {
0033 namespace format {
0034 
0035 enum class ParseError {
0036   Success = 0,
0037   Error,
0038   Unsuitable,
0039   BinPackTrailingCommaConflict,
0040   InvalidQualifierSpecified,
0041   DuplicateQualifierSpecified,
0042   MissingQualifierType,
0043   MissingQualifierOrder
0044 };
0045 class ParseErrorCategory final : public std::error_category {
0046 public:
0047   const char *name() const noexcept override;
0048   std::string message(int EV) const override;
0049 };
0050 const std::error_category &getParseCategory();
0051 std::error_code make_error_code(ParseError e);
0052 
0053 /// The ``FormatStyle`` is used to configure the formatting to follow
0054 /// specific guidelines.
0055 struct FormatStyle {
0056   // If the BasedOn: was InheritParentConfig and this style needs the file from
0057   // the parent directories. It is not part of the actual style for formatting.
0058   // Thus the // instead of ///.
0059   bool InheritsParentConfig;
0060 
0061   /// The extra indent or outdent of access modifiers, e.g. ``public:``.
0062   /// \version 3.3
0063   int AccessModifierOffset;
0064 
0065   /// Different styles for aligning after open brackets.
0066   enum BracketAlignmentStyle : int8_t {
0067     /// Align parameters on the open bracket, e.g.:
0068     /// \code
0069     ///   someLongFunction(argument1,
0070     ///                    argument2);
0071     /// \endcode
0072     BAS_Align,
0073     /// Don't align, instead use ``ContinuationIndentWidth``, e.g.:
0074     /// \code
0075     ///   someLongFunction(argument1,
0076     ///       argument2);
0077     /// \endcode
0078     BAS_DontAlign,
0079     /// Always break after an open bracket, if the parameters don't fit
0080     /// on a single line, e.g.:
0081     /// \code
0082     ///   someLongFunction(
0083     ///       argument1, argument2);
0084     /// \endcode
0085     BAS_AlwaysBreak,
0086     /// Always break after an open bracket, if the parameters don't fit
0087     /// on a single line. Closing brackets will be placed on a new line.
0088     /// E.g.:
0089     /// \code
0090     ///   someLongFunction(
0091     ///       argument1, argument2
0092     ///   )
0093     /// \endcode
0094     ///
0095     /// \note
0096     ///  This currently only applies to braced initializer lists (when
0097     ///  ``Cpp11BracedListStyle`` is ``true``) and parentheses.
0098     /// \endnote
0099     BAS_BlockIndent,
0100   };
0101 
0102   /// If ``true``, horizontally aligns arguments after an open bracket.
0103   ///
0104   /// This applies to round brackets (parentheses), angle brackets and square
0105   /// brackets.
0106   /// \version 3.8
0107   BracketAlignmentStyle AlignAfterOpenBracket;
0108 
0109   /// Different style for aligning array initializers.
0110   enum ArrayInitializerAlignmentStyle : int8_t {
0111     /// Align array column and left justify the columns e.g.:
0112     /// \code
0113     ///   struct test demo[] =
0114     ///   {
0115     ///       {56, 23,    "hello"},
0116     ///       {-1, 93463, "world"},
0117     ///       {7,  5,     "!!"   }
0118     ///   };
0119     /// \endcode
0120     AIAS_Left,
0121     /// Align array column and right justify the columns e.g.:
0122     /// \code
0123     ///   struct test demo[] =
0124     ///   {
0125     ///       {56,    23, "hello"},
0126     ///       {-1, 93463, "world"},
0127     ///       { 7,     5,    "!!"}
0128     ///   };
0129     /// \endcode
0130     AIAS_Right,
0131     /// Don't align array initializer columns.
0132     AIAS_None
0133   };
0134   /// If not ``None``, when using initialization for an array of structs
0135   /// aligns the fields into columns.
0136   ///
0137   /// \note
0138   ///  As of clang-format 15 this option only applied to arrays with equal
0139   ///  number of columns per row.
0140   /// \endnote
0141   ///
0142   /// \version 13
0143   ArrayInitializerAlignmentStyle AlignArrayOfStructures;
0144 
0145   /// Alignment options.
0146   ///
0147   /// They can also be read as a whole for compatibility. The choices are:
0148   ///
0149   /// * ``None``
0150   /// * ``Consecutive``
0151   /// * ``AcrossEmptyLines``
0152   /// * ``AcrossComments``
0153   /// * ``AcrossEmptyLinesAndComments``
0154   ///
0155   /// For example, to align across empty lines and not across comments, either
0156   /// of these work.
0157   /// \code
0158   ///   <option-name>: AcrossEmptyLines
0159   ///
0160   ///   <option-name>:
0161   ///     Enabled: true
0162   ///     AcrossEmptyLines: true
0163   ///     AcrossComments: false
0164   /// \endcode
0165   struct AlignConsecutiveStyle {
0166     /// Whether aligning is enabled.
0167     /// \code
0168     ///   #define SHORT_NAME       42
0169     ///   #define LONGER_NAME      0x007f
0170     ///   #define EVEN_LONGER_NAME (2)
0171     ///   #define foo(x)           (x * x)
0172     ///   #define bar(y, z)        (y + z)
0173     ///
0174     ///   int a            = 1;
0175     ///   int somelongname = 2;
0176     ///   double c         = 3;
0177     ///
0178     ///   int aaaa : 1;
0179     ///   int b    : 12;
0180     ///   int ccc  : 8;
0181     ///
0182     ///   int         aaaa = 12;
0183     ///   float       b = 23;
0184     ///   std::string ccc;
0185     /// \endcode
0186     bool Enabled;
0187     /// Whether to align across empty lines.
0188     /// \code
0189     ///   true:
0190     ///   int a            = 1;
0191     ///   int somelongname = 2;
0192     ///   double c         = 3;
0193     ///
0194     ///   int d            = 3;
0195     ///
0196     ///   false:
0197     ///   int a            = 1;
0198     ///   int somelongname = 2;
0199     ///   double c         = 3;
0200     ///
0201     ///   int d = 3;
0202     /// \endcode
0203     bool AcrossEmptyLines;
0204     /// Whether to align across comments.
0205     /// \code
0206     ///   true:
0207     ///   int d    = 3;
0208     ///   /* A comment. */
0209     ///   double e = 4;
0210     ///
0211     ///   false:
0212     ///   int d = 3;
0213     ///   /* A comment. */
0214     ///   double e = 4;
0215     /// \endcode
0216     bool AcrossComments;
0217     /// Only for ``AlignConsecutiveAssignments``.  Whether compound assignments
0218     /// like ``+=`` are aligned along with ``=``.
0219     /// \code
0220     ///   true:
0221     ///   a   &= 2;
0222     ///   bbb  = 2;
0223     ///
0224     ///   false:
0225     ///   a &= 2;
0226     ///   bbb = 2;
0227     /// \endcode
0228     bool AlignCompound;
0229     /// Only for ``AlignConsecutiveDeclarations``. Whether function declarations
0230     /// are aligned.
0231     /// \code
0232     ///   true:
0233     ///   unsigned int f1(void);
0234     ///   void         f2(void);
0235     ///   size_t       f3(void);
0236     ///
0237     ///   false:
0238     ///   unsigned int f1(void);
0239     ///   void f2(void);
0240     ///   size_t f3(void);
0241     /// \endcode
0242     bool AlignFunctionDeclarations;
0243     /// Only for ``AlignConsecutiveDeclarations``. Whether function pointers are
0244     /// aligned.
0245     /// \code
0246     ///   true:
0247     ///   unsigned i;
0248     ///   int     &r;
0249     ///   int     *p;
0250     ///   int      (*f)();
0251     ///
0252     ///   false:
0253     ///   unsigned i;
0254     ///   int     &r;
0255     ///   int     *p;
0256     ///   int (*f)();
0257     /// \endcode
0258     bool AlignFunctionPointers;
0259     /// Only for ``AlignConsecutiveAssignments``.  Whether short assignment
0260     /// operators are left-padded to the same length as long ones in order to
0261     /// put all assignment operators to the right of the left hand side.
0262     /// \code
0263     ///   true:
0264     ///   a   >>= 2;
0265     ///   bbb   = 2;
0266     ///
0267     ///   a     = 2;
0268     ///   bbb >>= 2;
0269     ///
0270     ///   false:
0271     ///   a >>= 2;
0272     ///   bbb = 2;
0273     ///
0274     ///   a     = 2;
0275     ///   bbb >>= 2;
0276     /// \endcode
0277     bool PadOperators;
0278     bool operator==(const AlignConsecutiveStyle &R) const {
0279       return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines &&
0280              AcrossComments == R.AcrossComments &&
0281              AlignCompound == R.AlignCompound &&
0282              AlignFunctionDeclarations == R.AlignFunctionDeclarations &&
0283              AlignFunctionPointers == R.AlignFunctionPointers &&
0284              PadOperators == R.PadOperators;
0285     }
0286     bool operator!=(const AlignConsecutiveStyle &R) const {
0287       return !(*this == R);
0288     }
0289   };
0290 
0291   /// Style of aligning consecutive macro definitions.
0292   ///
0293   /// ``Consecutive`` will result in formattings like:
0294   /// \code
0295   ///   #define SHORT_NAME       42
0296   ///   #define LONGER_NAME      0x007f
0297   ///   #define EVEN_LONGER_NAME (2)
0298   ///   #define foo(x)           (x * x)
0299   ///   #define bar(y, z)        (y + z)
0300   /// \endcode
0301   /// \version 9
0302   AlignConsecutiveStyle AlignConsecutiveMacros;
0303   /// Style of aligning consecutive assignments.
0304   ///
0305   /// ``Consecutive`` will result in formattings like:
0306   /// \code
0307   ///   int a            = 1;
0308   ///   int somelongname = 2;
0309   ///   double c         = 3;
0310   /// \endcode
0311   /// \version 3.8
0312   AlignConsecutiveStyle AlignConsecutiveAssignments;
0313   /// Style of aligning consecutive bit fields.
0314   ///
0315   /// ``Consecutive`` will align the bitfield separators of consecutive lines.
0316   /// This will result in formattings like:
0317   /// \code
0318   ///   int aaaa : 1;
0319   ///   int b    : 12;
0320   ///   int ccc  : 8;
0321   /// \endcode
0322   /// \version 11
0323   AlignConsecutiveStyle AlignConsecutiveBitFields;
0324   /// Style of aligning consecutive declarations.
0325   ///
0326   /// ``Consecutive`` will align the declaration names of consecutive lines.
0327   /// This will result in formattings like:
0328   /// \code
0329   ///   int         aaaa = 12;
0330   ///   float       b = 23;
0331   ///   std::string ccc;
0332   /// \endcode
0333   /// \version 3.8
0334   AlignConsecutiveStyle AlignConsecutiveDeclarations;
0335 
0336   /// Alignment options.
0337   ///
0338   struct ShortCaseStatementsAlignmentStyle {
0339     /// Whether aligning is enabled.
0340     /// \code
0341     ///   true:
0342     ///   switch (level) {
0343     ///   case log::info:    return "info:";
0344     ///   case log::warning: return "warning:";
0345     ///   default:           return "";
0346     ///   }
0347     ///
0348     ///   false:
0349     ///   switch (level) {
0350     ///   case log::info: return "info:";
0351     ///   case log::warning: return "warning:";
0352     ///   default: return "";
0353     ///   }
0354     /// \endcode
0355     bool Enabled;
0356     /// Whether to align across empty lines.
0357     /// \code
0358     ///   true:
0359     ///   switch (level) {
0360     ///   case log::info:    return "info:";
0361     ///   case log::warning: return "warning:";
0362     ///
0363     ///   default:           return "";
0364     ///   }
0365     ///
0366     ///   false:
0367     ///   switch (level) {
0368     ///   case log::info:    return "info:";
0369     ///   case log::warning: return "warning:";
0370     ///
0371     ///   default: return "";
0372     ///   }
0373     /// \endcode
0374     bool AcrossEmptyLines;
0375     /// Whether to align across comments.
0376     /// \code
0377     ///   true:
0378     ///   switch (level) {
0379     ///   case log::info:    return "info:";
0380     ///   case log::warning: return "warning:";
0381     ///   /* A comment. */
0382     ///   default:           return "";
0383     ///   }
0384     ///
0385     ///   false:
0386     ///   switch (level) {
0387     ///   case log::info:    return "info:";
0388     ///   case log::warning: return "warning:";
0389     ///   /* A comment. */
0390     ///   default: return "";
0391     ///   }
0392     /// \endcode
0393     bool AcrossComments;
0394     /// Whether to align the case arrows when aligning short case expressions.
0395     /// \code{.java}
0396     ///   true:
0397     ///   i = switch (day) {
0398     ///     case THURSDAY, SATURDAY -> 8;
0399     ///     case WEDNESDAY          -> 9;
0400     ///     default                 -> 0;
0401     ///   };
0402     ///
0403     ///   false:
0404     ///   i = switch (day) {
0405     ///     case THURSDAY, SATURDAY -> 8;
0406     ///     case WEDNESDAY ->          9;
0407     ///     default ->                 0;
0408     ///   };
0409     /// \endcode
0410     bool AlignCaseArrows;
0411     /// Whether aligned case labels are aligned on the colon, or on the tokens
0412     /// after the colon.
0413     /// \code
0414     ///   true:
0415     ///   switch (level) {
0416     ///   case log::info   : return "info:";
0417     ///   case log::warning: return "warning:";
0418     ///   default          : return "";
0419     ///   }
0420     ///
0421     ///   false:
0422     ///   switch (level) {
0423     ///   case log::info:    return "info:";
0424     ///   case log::warning: return "warning:";
0425     ///   default:           return "";
0426     ///   }
0427     /// \endcode
0428     bool AlignCaseColons;
0429     bool operator==(const ShortCaseStatementsAlignmentStyle &R) const {
0430       return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines &&
0431              AcrossComments == R.AcrossComments &&
0432              AlignCaseArrows == R.AlignCaseArrows &&
0433              AlignCaseColons == R.AlignCaseColons;
0434     }
0435   };
0436 
0437   /// Style of aligning consecutive short case labels.
0438   /// Only applies if ``AllowShortCaseExpressionOnASingleLine`` or
0439   /// ``AllowShortCaseLabelsOnASingleLine`` is ``true``.
0440   ///
0441   /// \code{.yaml}
0442   ///   # Example of usage:
0443   ///   AlignConsecutiveShortCaseStatements:
0444   ///     Enabled: true
0445   ///     AcrossEmptyLines: true
0446   ///     AcrossComments: true
0447   ///     AlignCaseColons: false
0448   /// \endcode
0449   /// \version 17
0450   ShortCaseStatementsAlignmentStyle AlignConsecutiveShortCaseStatements;
0451 
0452   /// Style of aligning consecutive TableGen DAGArg operator colons.
0453   /// If enabled, align the colon inside DAGArg which have line break inside.
0454   /// This works only when TableGenBreakInsideDAGArg is BreakElements or
0455   /// BreakAll and the DAGArg is not excepted by
0456   /// TableGenBreakingDAGArgOperators's effect.
0457   /// \code
0458   ///   let dagarg = (ins
0459   ///       a  :$src1,
0460   ///       aa :$src2,
0461   ///       aaa:$src3
0462   ///   )
0463   /// \endcode
0464   /// \version 19
0465   AlignConsecutiveStyle AlignConsecutiveTableGenBreakingDAGArgColons;
0466 
0467   /// Style of aligning consecutive TableGen cond operator colons.
0468   /// Align the colons of cases inside !cond operators.
0469   /// \code
0470   ///   !cond(!eq(size, 1) : 1,
0471   ///         !eq(size, 16): 1,
0472   ///         true         : 0)
0473   /// \endcode
0474   /// \version 19
0475   AlignConsecutiveStyle AlignConsecutiveTableGenCondOperatorColons;
0476 
0477   /// Style of aligning consecutive TableGen definition colons.
0478   /// This aligns the inheritance colons of consecutive definitions.
0479   /// \code
0480   ///   def Def       : Parent {}
0481   ///   def DefDef    : Parent {}
0482   ///   def DefDefDef : Parent {}
0483   /// \endcode
0484   /// \version 19
0485   AlignConsecutiveStyle AlignConsecutiveTableGenDefinitionColons;
0486 
0487   /// Different styles for aligning escaped newlines.
0488   enum EscapedNewlineAlignmentStyle : int8_t {
0489     /// Don't align escaped newlines.
0490     /// \code
0491     ///   #define A \
0492     ///     int aaaa; \
0493     ///     int b; \
0494     ///     int dddddddddd;
0495     /// \endcode
0496     ENAS_DontAlign,
0497     /// Align escaped newlines as far left as possible.
0498     /// \code
0499     ///   #define A   \
0500     ///     int aaaa; \
0501     ///     int b;    \
0502     ///     int dddddddddd;
0503     /// \endcode
0504     ENAS_Left,
0505     /// Align escaped newlines as far left as possible, using the last line of
0506     /// the preprocessor directive as the reference if it's the longest.
0507     /// \code
0508     ///   #define A         \
0509     ///     int aaaa;       \
0510     ///     int b;          \
0511     ///     int dddddddddd;
0512     /// \endcode
0513     ENAS_LeftWithLastLine,
0514     /// Align escaped newlines in the right-most column.
0515     /// \code
0516     ///   #define A                                                                      \
0517     ///     int aaaa;                                                                    \
0518     ///     int b;                                                                       \
0519     ///     int dddddddddd;
0520     /// \endcode
0521     ENAS_Right,
0522   };
0523 
0524   /// Options for aligning backslashes in escaped newlines.
0525   /// \version 5
0526   EscapedNewlineAlignmentStyle AlignEscapedNewlines;
0527 
0528   /// Different styles for aligning operands.
0529   enum OperandAlignmentStyle : int8_t {
0530     /// Do not align operands of binary and ternary expressions.
0531     /// The wrapped lines are indented ``ContinuationIndentWidth`` spaces from
0532     /// the start of the line.
0533     OAS_DontAlign,
0534     /// Horizontally align operands of binary and ternary expressions.
0535     ///
0536     /// Specifically, this aligns operands of a single expression that needs
0537     /// to be split over multiple lines, e.g.:
0538     /// \code
0539     ///   int aaa = bbbbbbbbbbbbbbb +
0540     ///             ccccccccccccccc;
0541     /// \endcode
0542     ///
0543     /// When ``BreakBeforeBinaryOperators`` is set, the wrapped operator is
0544     /// aligned with the operand on the first line.
0545     /// \code
0546     ///   int aaa = bbbbbbbbbbbbbbb
0547     ///             + ccccccccccccccc;
0548     /// \endcode
0549     OAS_Align,
0550     /// Horizontally align operands of binary and ternary expressions.
0551     ///
0552     /// This is similar to ``OAS_Align``, except when
0553     /// ``BreakBeforeBinaryOperators`` is set, the operator is un-indented so
0554     /// that the wrapped operand is aligned with the operand on the first line.
0555     /// \code
0556     ///   int aaa = bbbbbbbbbbbbbbb
0557     ///           + ccccccccccccccc;
0558     /// \endcode
0559     OAS_AlignAfterOperator,
0560   };
0561 
0562   /// If ``true``, horizontally align operands of binary and ternary
0563   /// expressions.
0564   /// \version 3.5
0565   OperandAlignmentStyle AlignOperands;
0566 
0567   /// Enums for AlignTrailingComments
0568   enum TrailingCommentsAlignmentKinds : int8_t {
0569     /// Leave trailing comments as they are.
0570     /// \code
0571     ///   int a;    // comment
0572     ///   int ab;       // comment
0573     ///
0574     ///   int abc;  // comment
0575     ///   int abcd;     // comment
0576     /// \endcode
0577     TCAS_Leave,
0578     /// Align trailing comments.
0579     /// \code
0580     ///   int a;  // comment
0581     ///   int ab; // comment
0582     ///
0583     ///   int abc;  // comment
0584     ///   int abcd; // comment
0585     /// \endcode
0586     TCAS_Always,
0587     /// Don't align trailing comments but other formatter applies.
0588     /// \code
0589     ///   int a; // comment
0590     ///   int ab; // comment
0591     ///
0592     ///   int abc; // comment
0593     ///   int abcd; // comment
0594     /// \endcode
0595     TCAS_Never,
0596   };
0597 
0598   /// Alignment options
0599   struct TrailingCommentsAlignmentStyle {
0600     /// Specifies the way to align trailing comments.
0601     TrailingCommentsAlignmentKinds Kind;
0602     /// How many empty lines to apply alignment.
0603     /// When both ``MaxEmptyLinesToKeep`` and ``OverEmptyLines`` are set to 2,
0604     /// it formats like below.
0605     /// \code
0606     ///   int a;      // all these
0607     ///
0608     ///   int ab;     // comments are
0609     ///
0610     ///
0611     ///   int abcdef; // aligned
0612     /// \endcode
0613     ///
0614     /// When ``MaxEmptyLinesToKeep`` is set to 2 and ``OverEmptyLines`` is set
0615     /// to 1, it formats like below.
0616     /// \code
0617     ///   int a;  // these are
0618     ///
0619     ///   int ab; // aligned
0620     ///
0621     ///
0622     ///   int abcdef; // but this isn't
0623     /// \endcode
0624     unsigned OverEmptyLines;
0625 
0626     bool operator==(const TrailingCommentsAlignmentStyle &R) const {
0627       return Kind == R.Kind && OverEmptyLines == R.OverEmptyLines;
0628     }
0629     bool operator!=(const TrailingCommentsAlignmentStyle &R) const {
0630       return !(*this == R);
0631     }
0632   };
0633 
0634   /// Control of trailing comments.
0635   ///
0636   /// The alignment stops at closing braces after a line break, and only
0637   /// followed by other closing braces, a (``do-``) ``while``, a lambda call, or
0638   /// a semicolon.
0639   ///
0640   /// \note
0641   ///  As of clang-format 16 this option is not a bool but can be set
0642   ///  to the options. Conventional bool options still can be parsed as before.
0643   /// \endnote
0644   ///
0645   /// \code{.yaml}
0646   ///   # Example of usage:
0647   ///   AlignTrailingComments:
0648   ///     Kind: Always
0649   ///     OverEmptyLines: 2
0650   /// \endcode
0651   /// \version 3.7
0652   TrailingCommentsAlignmentStyle AlignTrailingComments;
0653 
0654   /// \brief If a function call or braced initializer list doesn't fit on a
0655   /// line, allow putting all arguments onto the next line, even if
0656   /// ``BinPackArguments`` is ``false``.
0657   /// \code
0658   ///   true:
0659   ///   callFunction(
0660   ///       a, b, c, d);
0661   ///
0662   ///   false:
0663   ///   callFunction(a,
0664   ///                b,
0665   ///                c,
0666   ///                d);
0667   /// \endcode
0668   /// \version 9
0669   bool AllowAllArgumentsOnNextLine;
0670 
0671   /// This option is **deprecated**. See ``NextLine`` of
0672   /// ``PackConstructorInitializers``.
0673   /// \version 9
0674   // bool AllowAllConstructorInitializersOnNextLine;
0675 
0676   /// If the function declaration doesn't fit on a line,
0677   /// allow putting all parameters of a function declaration onto
0678   /// the next line even if ``BinPackParameters`` is ``OnePerLine``.
0679   /// \code
0680   ///   true:
0681   ///   void myFunction(
0682   ///       int a, int b, int c, int d, int e);
0683   ///
0684   ///   false:
0685   ///   void myFunction(int a,
0686   ///                   int b,
0687   ///                   int c,
0688   ///                   int d,
0689   ///                   int e);
0690   /// \endcode
0691   /// \version 3.3
0692   bool AllowAllParametersOfDeclarationOnNextLine;
0693 
0694   /// Different ways to break before a noexcept specifier.
0695   enum BreakBeforeNoexceptSpecifierStyle : int8_t {
0696     /// No line break allowed.
0697     /// \code
0698     ///   void foo(int arg1,
0699     ///            double arg2) noexcept;
0700     ///
0701     ///   void bar(int arg1, double arg2) noexcept(
0702     ///       noexcept(baz(arg1)) &&
0703     ///       noexcept(baz(arg2)));
0704     /// \endcode
0705     BBNSS_Never,
0706     /// For a simple ``noexcept`` there is no line break allowed, but when we
0707     /// have a condition it is.
0708     /// \code
0709     ///   void foo(int arg1,
0710     ///            double arg2) noexcept;
0711     ///
0712     ///   void bar(int arg1, double arg2)
0713     ///       noexcept(noexcept(baz(arg1)) &&
0714     ///                noexcept(baz(arg2)));
0715     /// \endcode
0716     BBNSS_OnlyWithParen,
0717     /// Line breaks are allowed. But note that because of the associated
0718     /// penalties ``clang-format`` often prefers not to break before the
0719     /// ``noexcept``.
0720     /// \code
0721     ///   void foo(int arg1,
0722     ///            double arg2) noexcept;
0723     ///
0724     ///   void bar(int arg1, double arg2)
0725     ///       noexcept(noexcept(baz(arg1)) &&
0726     ///                noexcept(baz(arg2)));
0727     /// \endcode
0728     BBNSS_Always,
0729   };
0730 
0731   /// Controls if there could be a line break before a ``noexcept`` specifier.
0732   /// \version 18
0733   BreakBeforeNoexceptSpecifierStyle AllowBreakBeforeNoexceptSpecifier;
0734 
0735   /// Different styles for merging short blocks containing at most one
0736   /// statement.
0737   enum ShortBlockStyle : int8_t {
0738     /// Never merge blocks into a single line.
0739     /// \code
0740     ///   while (true) {
0741     ///   }
0742     ///   while (true) {
0743     ///     continue;
0744     ///   }
0745     /// \endcode
0746     SBS_Never,
0747     /// Only merge empty blocks.
0748     /// \code
0749     ///   while (true) {}
0750     ///   while (true) {
0751     ///     continue;
0752     ///   }
0753     /// \endcode
0754     SBS_Empty,
0755     /// Always merge short blocks into a single line.
0756     /// \code
0757     ///   while (true) {}
0758     ///   while (true) { continue; }
0759     /// \endcode
0760     SBS_Always,
0761   };
0762 
0763   /// Dependent on the value, ``while (true) { continue; }`` can be put on a
0764   /// single line.
0765   /// \version 3.5
0766   ShortBlockStyle AllowShortBlocksOnASingleLine;
0767 
0768   /// Whether to merge a short switch labeled rule into a single line.
0769   /// \code{.java}
0770   ///   true:                               false:
0771   ///   switch (a) {           vs.          switch (a) {
0772   ///   case 1 -> 1;                        case 1 ->
0773   ///   default -> 0;                         1;
0774   ///   };                                  default ->
0775   ///                                         0;
0776   ///                                       };
0777   /// \endcode
0778   /// \version 19
0779   bool AllowShortCaseExpressionOnASingleLine;
0780 
0781   /// If ``true``, short case labels will be contracted to a single line.
0782   /// \code
0783   ///   true:                                   false:
0784   ///   switch (a) {                    vs.     switch (a) {
0785   ///   case 1: x = 1; break;                   case 1:
0786   ///   case 2: return;                           x = 1;
0787   ///   }                                         break;
0788   ///                                           case 2:
0789   ///                                             return;
0790   ///                                           }
0791   /// \endcode
0792   /// \version 3.6
0793   bool AllowShortCaseLabelsOnASingleLine;
0794 
0795   /// Allow short compound requirement on a single line.
0796   /// \code
0797   ///   true:
0798   ///   template <typename T>
0799   ///   concept c = requires(T x) {
0800   ///     { x + 1 } -> std::same_as<int>;
0801   ///   };
0802   ///
0803   ///   false:
0804   ///   template <typename T>
0805   ///   concept c = requires(T x) {
0806   ///     {
0807   ///       x + 1
0808   ///     } -> std::same_as<int>;
0809   ///   };
0810   /// \endcode
0811   /// \version 18
0812   bool AllowShortCompoundRequirementOnASingleLine;
0813 
0814   /// Allow short enums on a single line.
0815   /// \code
0816   ///   true:
0817   ///   enum { A, B } myEnum;
0818   ///
0819   ///   false:
0820   ///   enum {
0821   ///     A,
0822   ///     B
0823   ///   } myEnum;
0824   /// \endcode
0825   /// \version 11
0826   bool AllowShortEnumsOnASingleLine;
0827 
0828   /// Different styles for merging short functions containing at most one
0829   /// statement.
0830   enum ShortFunctionStyle : int8_t {
0831     /// Never merge functions into a single line.
0832     SFS_None,
0833     /// Only merge functions defined inside a class. Same as ``inline``,
0834     /// except it does not implies ``empty``: i.e. top level empty functions
0835     /// are not merged either.
0836     /// \code
0837     ///   class Foo {
0838     ///     void f() { foo(); }
0839     ///   };
0840     ///   void f() {
0841     ///     foo();
0842     ///   }
0843     ///   void f() {
0844     ///   }
0845     /// \endcode
0846     SFS_InlineOnly,
0847     /// Only merge empty functions.
0848     /// \code
0849     ///   void f() {}
0850     ///   void f2() {
0851     ///     bar2();
0852     ///   }
0853     /// \endcode
0854     SFS_Empty,
0855     /// Only merge functions defined inside a class. Implies ``empty``.
0856     /// \code
0857     ///   class Foo {
0858     ///     void f() { foo(); }
0859     ///   };
0860     ///   void f() {
0861     ///     foo();
0862     ///   }
0863     ///   void f() {}
0864     /// \endcode
0865     SFS_Inline,
0866     /// Merge all functions fitting on a single line.
0867     /// \code
0868     ///   class Foo {
0869     ///     void f() { foo(); }
0870     ///   };
0871     ///   void f() { bar(); }
0872     /// \endcode
0873     SFS_All,
0874   };
0875 
0876   /// Dependent on the value, ``int f() { return 0; }`` can be put on a
0877   /// single line.
0878   /// \version 3.5
0879   ShortFunctionStyle AllowShortFunctionsOnASingleLine;
0880 
0881   /// Different styles for handling short if statements.
0882   enum ShortIfStyle : int8_t {
0883     /// Never put short ifs on the same line.
0884     /// \code
0885     ///   if (a)
0886     ///     return;
0887     ///
0888     ///   if (b)
0889     ///     return;
0890     ///   else
0891     ///     return;
0892     ///
0893     ///   if (c)
0894     ///     return;
0895     ///   else {
0896     ///     return;
0897     ///   }
0898     /// \endcode
0899     SIS_Never,
0900     /// Put short ifs on the same line only if there is no else statement.
0901     /// \code
0902     ///   if (a) return;
0903     ///
0904     ///   if (b)
0905     ///     return;
0906     ///   else
0907     ///     return;
0908     ///
0909     ///   if (c)
0910     ///     return;
0911     ///   else {
0912     ///     return;
0913     ///   }
0914     /// \endcode
0915     SIS_WithoutElse,
0916     /// Put short ifs, but not else ifs nor else statements, on the same line.
0917     /// \code
0918     ///   if (a) return;
0919     ///
0920     ///   if (b) return;
0921     ///   else if (b)
0922     ///     return;
0923     ///   else
0924     ///     return;
0925     ///
0926     ///   if (c) return;
0927     ///   else {
0928     ///     return;
0929     ///   }
0930     /// \endcode
0931     SIS_OnlyFirstIf,
0932     /// Always put short ifs, else ifs and else statements on the same
0933     /// line.
0934     /// \code
0935     ///   if (a) return;
0936     ///
0937     ///   if (b) return;
0938     ///   else return;
0939     ///
0940     ///   if (c) return;
0941     ///   else {
0942     ///     return;
0943     ///   }
0944     /// \endcode
0945     SIS_AllIfsAndElse,
0946   };
0947 
0948   /// Dependent on the value, ``if (a) return;`` can be put on a single line.
0949   /// \version 3.3
0950   ShortIfStyle AllowShortIfStatementsOnASingleLine;
0951 
0952   /// Different styles for merging short lambdas containing at most one
0953   /// statement.
0954   enum ShortLambdaStyle : int8_t {
0955     /// Never merge lambdas into a single line.
0956     SLS_None,
0957     /// Only merge empty lambdas.
0958     /// \code
0959     ///   auto lambda = [](int a) {};
0960     ///   auto lambda2 = [](int a) {
0961     ///       return a;
0962     ///   };
0963     /// \endcode
0964     SLS_Empty,
0965     /// Merge lambda into a single line if the lambda is argument of a function.
0966     /// \code
0967     ///   auto lambda = [](int x, int y) {
0968     ///       return x < y;
0969     ///   };
0970     ///   sort(a.begin(), a.end(), [](int x, int y) { return x < y; });
0971     /// \endcode
0972     SLS_Inline,
0973     /// Merge all lambdas fitting on a single line.
0974     /// \code
0975     ///   auto lambda = [](int a) {};
0976     ///   auto lambda2 = [](int a) { return a; };
0977     /// \endcode
0978     SLS_All,
0979   };
0980 
0981   /// Dependent on the value, ``auto lambda []() { return 0; }`` can be put on a
0982   /// single line.
0983   /// \version 9
0984   ShortLambdaStyle AllowShortLambdasOnASingleLine;
0985 
0986   /// If ``true``, ``while (true) continue;`` can be put on a single
0987   /// line.
0988   /// \version 3.7
0989   bool AllowShortLoopsOnASingleLine;
0990 
0991   /// If ``true``, ``namespace a { class b; }`` can be put on a single line.
0992   /// \version 20
0993   bool AllowShortNamespacesOnASingleLine;
0994 
0995   /// Different ways to break after the function definition return type.
0996   /// This option is **deprecated** and is retained for backwards compatibility.
0997   enum DefinitionReturnTypeBreakingStyle : int8_t {
0998     /// Break after return type automatically.
0999     /// ``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
1000     DRTBS_None,
1001     /// Always break after the return type.
1002     DRTBS_All,
1003     /// Always break after the return types of top-level functions.
1004     DRTBS_TopLevel,
1005   };
1006 
1007   /// Different ways to break after the function definition or
1008   /// declaration return type.
1009   enum ReturnTypeBreakingStyle : int8_t {
1010     /// This is **deprecated**. See ``Automatic`` below.
1011     RTBS_None,
1012     /// Break after return type based on ``PenaltyReturnTypeOnItsOwnLine``.
1013     /// \code
1014     ///   class A {
1015     ///     int f() { return 0; };
1016     ///   };
1017     ///   int f();
1018     ///   int f() { return 1; }
1019     ///   int
1020     ///   LongName::AnotherLongName();
1021     /// \endcode
1022     RTBS_Automatic,
1023     /// Same as ``Automatic`` above, except that there is no break after short
1024     /// return types.
1025     /// \code
1026     ///   class A {
1027     ///     int f() { return 0; };
1028     ///   };
1029     ///   int f();
1030     ///   int f() { return 1; }
1031     ///   int LongName::
1032     ///       AnotherLongName();
1033     /// \endcode
1034     RTBS_ExceptShortType,
1035     /// Always break after the return type.
1036     /// \code
1037     ///   class A {
1038     ///     int
1039     ///     f() {
1040     ///       return 0;
1041     ///     };
1042     ///   };
1043     ///   int
1044     ///   f();
1045     ///   int
1046     ///   f() {
1047     ///     return 1;
1048     ///   }
1049     ///   int
1050     ///   LongName::AnotherLongName();
1051     /// \endcode
1052     RTBS_All,
1053     /// Always break after the return types of top-level functions.
1054     /// \code
1055     ///   class A {
1056     ///     int f() { return 0; };
1057     ///   };
1058     ///   int
1059     ///   f();
1060     ///   int
1061     ///   f() {
1062     ///     return 1;
1063     ///   }
1064     ///   int
1065     ///   LongName::AnotherLongName();
1066     /// \endcode
1067     RTBS_TopLevel,
1068     /// Always break after the return type of function definitions.
1069     /// \code
1070     ///   class A {
1071     ///     int
1072     ///     f() {
1073     ///       return 0;
1074     ///     };
1075     ///   };
1076     ///   int f();
1077     ///   int
1078     ///   f() {
1079     ///     return 1;
1080     ///   }
1081     ///   int
1082     ///   LongName::AnotherLongName();
1083     /// \endcode
1084     RTBS_AllDefinitions,
1085     /// Always break after the return type of top-level definitions.
1086     /// \code
1087     ///   class A {
1088     ///     int f() { return 0; };
1089     ///   };
1090     ///   int f();
1091     ///   int
1092     ///   f() {
1093     ///     return 1;
1094     ///   }
1095     ///   int
1096     ///   LongName::AnotherLongName();
1097     /// \endcode
1098     RTBS_TopLevelDefinitions,
1099   };
1100 
1101   /// The function definition return type breaking style to use.  This
1102   /// option is **deprecated** and is retained for backwards compatibility.
1103   /// \version 3.7
1104   DefinitionReturnTypeBreakingStyle AlwaysBreakAfterDefinitionReturnType;
1105 
1106   /// This option is renamed to ``BreakAfterReturnType``.
1107   /// \version 3.8
1108   /// @deprecated
1109   // ReturnTypeBreakingStyle AlwaysBreakAfterReturnType;
1110 
1111   /// If ``true``, always break before multiline string literals.
1112   ///
1113   /// This flag is mean to make cases where there are multiple multiline strings
1114   /// in a file look more consistent. Thus, it will only take effect if wrapping
1115   /// the string at that point leads to it being indented
1116   /// ``ContinuationIndentWidth`` spaces from the start of the line.
1117   /// \code
1118   ///    true:                                  false:
1119   ///    aaaa =                         vs.     aaaa = "bbbb"
1120   ///        "bbbb"                                    "cccc";
1121   ///        "cccc";
1122   /// \endcode
1123   /// \version 3.4
1124   bool AlwaysBreakBeforeMultilineStrings;
1125 
1126   /// Different ways to break after the template declaration.
1127   enum BreakTemplateDeclarationsStyle : int8_t {
1128     /// Do not change the line breaking before the declaration.
1129     /// \code
1130     ///    template <typename T>
1131     ///    T foo() {
1132     ///    }
1133     ///    template <typename T> T foo(int aaaaaaaaaaaaaaaaaaaaa,
1134     ///                                int bbbbbbbbbbbbbbbbbbbbb) {
1135     ///    }
1136     /// \endcode
1137     BTDS_Leave,
1138     /// Do not force break before declaration.
1139     /// ``PenaltyBreakTemplateDeclaration`` is taken into account.
1140     /// \code
1141     ///    template <typename T> T foo() {
1142     ///    }
1143     ///    template <typename T> T foo(int aaaaaaaaaaaaaaaaaaaaa,
1144     ///                                int bbbbbbbbbbbbbbbbbbbbb) {
1145     ///    }
1146     /// \endcode
1147     BTDS_No,
1148     /// Force break after template declaration only when the following
1149     /// declaration spans multiple lines.
1150     /// \code
1151     ///    template <typename T> T foo() {
1152     ///    }
1153     ///    template <typename T>
1154     ///    T foo(int aaaaaaaaaaaaaaaaaaaaa,
1155     ///          int bbbbbbbbbbbbbbbbbbbbb) {
1156     ///    }
1157     /// \endcode
1158     BTDS_MultiLine,
1159     /// Always break after template declaration.
1160     /// \code
1161     ///    template <typename T>
1162     ///    T foo() {
1163     ///    }
1164     ///    template <typename T>
1165     ///    T foo(int aaaaaaaaaaaaaaaaaaaaa,
1166     ///          int bbbbbbbbbbbbbbbbbbbbb) {
1167     ///    }
1168     /// \endcode
1169     BTDS_Yes
1170   };
1171 
1172   /// This option is renamed to ``BreakTemplateDeclarations``.
1173   /// \version 3.4
1174   /// @deprecated
1175   // BreakTemplateDeclarationsStyle AlwaysBreakTemplateDeclarations;
1176 
1177   /// A vector of strings that should be interpreted as attributes/qualifiers
1178   /// instead of identifiers. This can be useful for language extensions or
1179   /// static analyzer annotations.
1180   ///
1181   /// For example:
1182   /// \code
1183   ///   x = (char *__capability)&y;
1184   ///   int function(void) __unused;
1185   ///   void only_writes_to_buffer(char *__output buffer);
1186   /// \endcode
1187   ///
1188   /// In the .clang-format configuration file, this can be configured like:
1189   /// \code{.yaml}
1190   ///   AttributeMacros: [__capability, __output, __unused]
1191   /// \endcode
1192   ///
1193   /// \version 12
1194   std::vector<std::string> AttributeMacros;
1195 
1196   /// If ``false``, a function call's arguments will either be all on the
1197   /// same line or will have one line each.
1198   /// \code
1199   ///   true:
1200   ///   void f() {
1201   ///     f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,
1202   ///       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
1203   ///   }
1204   ///
1205   ///   false:
1206   ///   void f() {
1207   ///     f(aaaaaaaaaaaaaaaaaaaa,
1208   ///       aaaaaaaaaaaaaaaaaaaa,
1209   ///       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
1210   ///   }
1211   /// \endcode
1212   /// \version 3.7
1213   bool BinPackArguments;
1214 
1215   /// Different way to try to fit all parameters on a line.
1216   enum BinPackParametersStyle : int8_t {
1217     /// Bin-pack parameters.
1218     /// \code
1219     ///    void f(int a, int bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
1220     ///           int ccccccccccccccccccccccccccccccccccccccccccc);
1221     /// \endcode
1222     BPPS_BinPack,
1223     /// Put all parameters on the current line if they fit.
1224     /// Otherwise, put each one on its own line.
1225     /// \code
1226     ///    void f(int a, int b, int c);
1227     ///
1228     ///    void f(int a,
1229     ///           int b,
1230     ///           int ccccccccccccccccccccccccccccccccccccc);
1231     /// \endcode
1232     BPPS_OnePerLine,
1233     /// Always put each parameter on its own line.
1234     /// \code
1235     ///    void f(int a,
1236     ///           int b,
1237     ///           int c);
1238     /// \endcode
1239     BPPS_AlwaysOnePerLine,
1240   };
1241 
1242   /// The bin pack parameters style to use.
1243   /// \version 3.7
1244   BinPackParametersStyle BinPackParameters;
1245 
1246   /// Styles for adding spacing around ``:`` in bitfield definitions.
1247   enum BitFieldColonSpacingStyle : int8_t {
1248     /// Add one space on each side of the ``:``
1249     /// \code
1250     ///   unsigned bf : 2;
1251     /// \endcode
1252     BFCS_Both,
1253     /// Add no space around the ``:`` (except when needed for
1254     /// ``AlignConsecutiveBitFields``).
1255     /// \code
1256     ///   unsigned bf:2;
1257     /// \endcode
1258     BFCS_None,
1259     /// Add space before the ``:`` only
1260     /// \code
1261     ///   unsigned bf :2;
1262     /// \endcode
1263     BFCS_Before,
1264     /// Add space after the ``:`` only (space may be added before if
1265     /// needed for ``AlignConsecutiveBitFields``).
1266     /// \code
1267     ///   unsigned bf: 2;
1268     /// \endcode
1269     BFCS_After
1270   };
1271   /// The BitFieldColonSpacingStyle to use for bitfields.
1272   /// \version 12
1273   BitFieldColonSpacingStyle BitFieldColonSpacing;
1274 
1275   /// The number of columns to use to indent the contents of braced init lists.
1276   /// If unset, ``ContinuationIndentWidth`` is used.
1277   /// \code
1278   ///   AlignAfterOpenBracket: AlwaysBreak
1279   ///   BracedInitializerIndentWidth: 2
1280   ///
1281   ///   void f() {
1282   ///     SomeClass c{
1283   ///       "foo",
1284   ///       "bar",
1285   ///       "baz",
1286   ///     };
1287   ///     auto s = SomeStruct{
1288   ///       .foo = "foo",
1289   ///       .bar = "bar",
1290   ///       .baz = "baz",
1291   ///     };
1292   ///     SomeArrayT a[3] = {
1293   ///       {
1294   ///         foo,
1295   ///         bar,
1296   ///       },
1297   ///       {
1298   ///         foo,
1299   ///         bar,
1300   ///       },
1301   ///       SomeArrayT{},
1302   ///     };
1303   ///   }
1304   /// \endcode
1305   /// \version 17
1306   std::optional<unsigned> BracedInitializerIndentWidth;
1307 
1308   /// Different ways to wrap braces after control statements.
1309   enum BraceWrappingAfterControlStatementStyle : int8_t {
1310     /// Never wrap braces after a control statement.
1311     /// \code
1312     ///   if (foo()) {
1313     ///   } else {
1314     ///   }
1315     ///   for (int i = 0; i < 10; ++i) {
1316     ///   }
1317     /// \endcode
1318     BWACS_Never,
1319     /// Only wrap braces after a multi-line control statement.
1320     /// \code
1321     ///   if (foo && bar &&
1322     ///       baz)
1323     ///   {
1324     ///     quux();
1325     ///   }
1326     ///   while (foo || bar) {
1327     ///   }
1328     /// \endcode
1329     BWACS_MultiLine,
1330     /// Always wrap braces after a control statement.
1331     /// \code
1332     ///   if (foo())
1333     ///   {
1334     ///   } else
1335     ///   {}
1336     ///   for (int i = 0; i < 10; ++i)
1337     ///   {}
1338     /// \endcode
1339     BWACS_Always
1340   };
1341 
1342   /// Precise control over the wrapping of braces.
1343   /// \code
1344   ///   # Should be declared this way:
1345   ///   BreakBeforeBraces: Custom
1346   ///   BraceWrapping:
1347   ///       AfterClass: true
1348   /// \endcode
1349   struct BraceWrappingFlags {
1350     /// Wrap case labels.
1351     /// \code
1352     ///   false:                                true:
1353     ///   switch (foo) {                vs.     switch (foo) {
1354     ///     case 1: {                             case 1:
1355     ///       bar();                              {
1356     ///       break;                                bar();
1357     ///     }                                       break;
1358     ///     default: {                            }
1359     ///       plop();                             default:
1360     ///     }                                     {
1361     ///   }                                         plop();
1362     ///                                           }
1363     ///                                         }
1364     /// \endcode
1365     bool AfterCaseLabel;
1366     /// Wrap class definitions.
1367     /// \code
1368     ///   true:
1369     ///   class foo
1370     ///   {};
1371     ///
1372     ///   false:
1373     ///   class foo {};
1374     /// \endcode
1375     bool AfterClass;
1376 
1377     /// Wrap control statements (``if``/``for``/``while``/``switch``/..).
1378     BraceWrappingAfterControlStatementStyle AfterControlStatement;
1379     /// Wrap enum definitions.
1380     /// \code
1381     ///   true:
1382     ///   enum X : int
1383     ///   {
1384     ///     B
1385     ///   };
1386     ///
1387     ///   false:
1388     ///   enum X : int { B };
1389     /// \endcode
1390     bool AfterEnum;
1391     /// Wrap function definitions.
1392     /// \code
1393     ///   true:
1394     ///   void foo()
1395     ///   {
1396     ///     bar();
1397     ///     bar2();
1398     ///   }
1399     ///
1400     ///   false:
1401     ///   void foo() {
1402     ///     bar();
1403     ///     bar2();
1404     ///   }
1405     /// \endcode
1406     bool AfterFunction;
1407     /// Wrap namespace definitions.
1408     /// \code
1409     ///   true:
1410     ///   namespace
1411     ///   {
1412     ///   int foo();
1413     ///   int bar();
1414     ///   }
1415     ///
1416     ///   false:
1417     ///   namespace {
1418     ///   int foo();
1419     ///   int bar();
1420     ///   }
1421     /// \endcode
1422     bool AfterNamespace;
1423     /// Wrap ObjC definitions (interfaces, implementations...).
1424     /// \note
1425     ///  @autoreleasepool and @synchronized blocks are wrapped
1426     ///  according to ``AfterControlStatement`` flag.
1427     /// \endnote
1428     bool AfterObjCDeclaration;
1429     /// Wrap struct definitions.
1430     /// \code
1431     ///   true:
1432     ///   struct foo
1433     ///   {
1434     ///     int x;
1435     ///   };
1436     ///
1437     ///   false:
1438     ///   struct foo {
1439     ///     int x;
1440     ///   };
1441     /// \endcode
1442     bool AfterStruct;
1443     /// Wrap union definitions.
1444     /// \code
1445     ///   true:
1446     ///   union foo
1447     ///   {
1448     ///     int x;
1449     ///   }
1450     ///
1451     ///   false:
1452     ///   union foo {
1453     ///     int x;
1454     ///   }
1455     /// \endcode
1456     bool AfterUnion;
1457     /// Wrap extern blocks.
1458     /// \code
1459     ///   true:
1460     ///   extern "C"
1461     ///   {
1462     ///     int foo();
1463     ///   }
1464     ///
1465     ///   false:
1466     ///   extern "C" {
1467     ///   int foo();
1468     ///   }
1469     /// \endcode
1470     bool AfterExternBlock; // Partially superseded by IndentExternBlock
1471     /// Wrap before ``catch``.
1472     /// \code
1473     ///   true:
1474     ///   try {
1475     ///     foo();
1476     ///   }
1477     ///   catch () {
1478     ///   }
1479     ///
1480     ///   false:
1481     ///   try {
1482     ///     foo();
1483     ///   } catch () {
1484     ///   }
1485     /// \endcode
1486     bool BeforeCatch;
1487     /// Wrap before ``else``.
1488     /// \code
1489     ///   true:
1490     ///   if (foo()) {
1491     ///   }
1492     ///   else {
1493     ///   }
1494     ///
1495     ///   false:
1496     ///   if (foo()) {
1497     ///   } else {
1498     ///   }
1499     /// \endcode
1500     bool BeforeElse;
1501     /// Wrap lambda block.
1502     /// \code
1503     ///   true:
1504     ///   connect(
1505     ///     []()
1506     ///     {
1507     ///       foo();
1508     ///       bar();
1509     ///     });
1510     ///
1511     ///   false:
1512     ///   connect([]() {
1513     ///     foo();
1514     ///     bar();
1515     ///   });
1516     /// \endcode
1517     bool BeforeLambdaBody;
1518     /// Wrap before ``while``.
1519     /// \code
1520     ///   true:
1521     ///   do {
1522     ///     foo();
1523     ///   }
1524     ///   while (1);
1525     ///
1526     ///   false:
1527     ///   do {
1528     ///     foo();
1529     ///   } while (1);
1530     /// \endcode
1531     bool BeforeWhile;
1532     /// Indent the wrapped braces themselves.
1533     bool IndentBraces;
1534     /// If ``false``, empty function body can be put on a single line.
1535     /// This option is used only if the opening brace of the function has
1536     /// already been wrapped, i.e. the ``AfterFunction`` brace wrapping mode is
1537     /// set, and the function could/should not be put on a single line (as per
1538     /// ``AllowShortFunctionsOnASingleLine`` and constructor formatting
1539     /// options).
1540     /// \code
1541     ///   false:          true:
1542     ///   int f()   vs.   int f()
1543     ///   {}              {
1544     ///                   }
1545     /// \endcode
1546     ///
1547     bool SplitEmptyFunction;
1548     /// If ``false``, empty record (e.g. class, struct or union) body
1549     /// can be put on a single line. This option is used only if the opening
1550     /// brace of the record has already been wrapped, i.e. the ``AfterClass``
1551     /// (for classes) brace wrapping mode is set.
1552     /// \code
1553     ///   false:           true:
1554     ///   class Foo   vs.  class Foo
1555     ///   {}               {
1556     ///                    }
1557     /// \endcode
1558     ///
1559     bool SplitEmptyRecord;
1560     /// If ``false``, empty namespace body can be put on a single line.
1561     /// This option is used only if the opening brace of the namespace has
1562     /// already been wrapped, i.e. the ``AfterNamespace`` brace wrapping mode is
1563     /// set.
1564     /// \code
1565     ///   false:               true:
1566     ///   namespace Foo   vs.  namespace Foo
1567     ///   {}                   {
1568     ///                        }
1569     /// \endcode
1570     ///
1571     bool SplitEmptyNamespace;
1572   };
1573 
1574   /// Control of individual brace wrapping cases.
1575   ///
1576   /// If ``BreakBeforeBraces`` is set to ``Custom``, use this to specify how
1577   /// each individual brace case should be handled. Otherwise, this is ignored.
1578   /// \code{.yaml}
1579   ///   # Example of usage:
1580   ///   BreakBeforeBraces: Custom
1581   ///   BraceWrapping:
1582   ///     AfterEnum: true
1583   ///     AfterStruct: false
1584   ///     SplitEmptyFunction: false
1585   /// \endcode
1586   /// \version 3.8
1587   BraceWrappingFlags BraceWrapping;
1588 
1589   /// Break between adjacent string literals.
1590   /// \code
1591   ///    true:
1592   ///    return "Code"
1593   ///           "\0\52\26\55\55\0"
1594   ///           "x013"
1595   ///           "\02\xBA";
1596   ///    false:
1597   ///    return "Code" "\0\52\26\55\55\0" "x013" "\02\xBA";
1598   /// \endcode
1599   /// \version 18
1600   bool BreakAdjacentStringLiterals;
1601 
1602   /// Different ways to break after attributes.
1603   enum AttributeBreakingStyle : int8_t {
1604     /// Always break after attributes.
1605     /// \code
1606     ///   [[maybe_unused]]
1607     ///   const int i;
1608     ///   [[gnu::const]] [[maybe_unused]]
1609     ///   int j;
1610     ///
1611     ///   [[nodiscard]]
1612     ///   inline int f();
1613     ///   [[gnu::const]] [[nodiscard]]
1614     ///   int g();
1615     ///
1616     ///   [[likely]]
1617     ///   if (a)
1618     ///     f();
1619     ///   else
1620     ///     g();
1621     ///
1622     ///   switch (b) {
1623     ///   [[unlikely]]
1624     ///   case 1:
1625     ///     ++b;
1626     ///     break;
1627     ///   [[likely]]
1628     ///   default:
1629     ///     return;
1630     ///   }
1631     /// \endcode
1632     ABS_Always,
1633     /// Leave the line breaking after attributes as is.
1634     /// \code
1635     ///   [[maybe_unused]] const int i;
1636     ///   [[gnu::const]] [[maybe_unused]]
1637     ///   int j;
1638     ///
1639     ///   [[nodiscard]] inline int f();
1640     ///   [[gnu::const]] [[nodiscard]]
1641     ///   int g();
1642     ///
1643     ///   [[likely]] if (a)
1644     ///     f();
1645     ///   else
1646     ///     g();
1647     ///
1648     ///   switch (b) {
1649     ///   [[unlikely]] case 1:
1650     ///     ++b;
1651     ///     break;
1652     ///   [[likely]]
1653     ///   default:
1654     ///     return;
1655     ///   }
1656     /// \endcode
1657     ABS_Leave,
1658     /// Never break after attributes.
1659     /// \code
1660     ///   [[maybe_unused]] const int i;
1661     ///   [[gnu::const]] [[maybe_unused]] int j;
1662     ///
1663     ///   [[nodiscard]] inline int f();
1664     ///   [[gnu::const]] [[nodiscard]] int g();
1665     ///
1666     ///   [[likely]] if (a)
1667     ///     f();
1668     ///   else
1669     ///     g();
1670     ///
1671     ///   switch (b) {
1672     ///   [[unlikely]] case 1:
1673     ///     ++b;
1674     ///     break;
1675     ///   [[likely]] default:
1676     ///     return;
1677     ///   }
1678     /// \endcode
1679     ABS_Never,
1680   };
1681 
1682   /// Break after a group of C++11 attributes before variable or function
1683   /// (including constructor/destructor) declaration/definition names or before
1684   /// control statements, i.e. ``if``, ``switch`` (including ``case`` and
1685   /// ``default`` labels), ``for``, and ``while`` statements.
1686   /// \version 16
1687   AttributeBreakingStyle BreakAfterAttributes;
1688 
1689   /// The function declaration return type breaking style to use.
1690   /// \version 19
1691   ReturnTypeBreakingStyle BreakAfterReturnType;
1692 
1693   /// If ``true``, clang-format will always break after a Json array ``[``
1694   /// otherwise it will scan until the closing ``]`` to determine if it should
1695   /// add newlines between elements (prettier compatible).
1696   ///
1697   /// \note
1698   ///  This is currently only for formatting JSON.
1699   /// \endnote
1700   /// \code
1701   ///    true:                                  false:
1702   ///    [                          vs.      [1, 2, 3, 4]
1703   ///      1,
1704   ///      2,
1705   ///      3,
1706   ///      4
1707   ///    ]
1708   /// \endcode
1709   /// \version 16
1710   bool BreakArrays;
1711 
1712   /// The style of wrapping parameters on the same line (bin-packed) or
1713   /// on one line each.
1714   enum BinPackStyle : int8_t {
1715     /// Automatically determine parameter bin-packing behavior.
1716     BPS_Auto,
1717     /// Always bin-pack parameters.
1718     BPS_Always,
1719     /// Never bin-pack parameters.
1720     BPS_Never,
1721   };
1722 
1723   /// The style of breaking before or after binary operators.
1724   enum BinaryOperatorStyle : int8_t {
1725     /// Break after operators.
1726     /// \code
1727     ///    LooooooooooongType loooooooooooooooooooooongVariable =
1728     ///        someLooooooooooooooooongFunction();
1729     ///
1730     ///    bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
1731     ///                         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ==
1732     ///                     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
1733     ///                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >
1734     ///                     ccccccccccccccccccccccccccccccccccccccccc;
1735     /// \endcode
1736     BOS_None,
1737     /// Break before operators that aren't assignments.
1738     /// \code
1739     ///    LooooooooooongType loooooooooooooooooooooongVariable =
1740     ///        someLooooooooooooooooongFunction();
1741     ///
1742     ///    bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1743     ///                         + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1744     ///                     == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1745     ///                 && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1746     ///                        > ccccccccccccccccccccccccccccccccccccccccc;
1747     /// \endcode
1748     BOS_NonAssignment,
1749     /// Break before operators.
1750     /// \code
1751     ///    LooooooooooongType loooooooooooooooooooooongVariable
1752     ///        = someLooooooooooooooooongFunction();
1753     ///
1754     ///    bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1755     ///                         + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1756     ///                     == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1757     ///                 && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1758     ///                        > ccccccccccccccccccccccccccccccccccccccccc;
1759     /// \endcode
1760     BOS_All,
1761   };
1762 
1763   /// The way to wrap binary operators.
1764   /// \version 3.6
1765   BinaryOperatorStyle BreakBeforeBinaryOperators;
1766 
1767   /// Different ways to attach braces to their surrounding context.
1768   enum BraceBreakingStyle : int8_t {
1769     /// Always attach braces to surrounding context.
1770     /// \code
1771     ///   namespace N {
1772     ///   enum E {
1773     ///     E1,
1774     ///     E2,
1775     ///   };
1776     ///
1777     ///   class C {
1778     ///   public:
1779     ///     C();
1780     ///   };
1781     ///
1782     ///   bool baz(int i) {
1783     ///     try {
1784     ///       do {
1785     ///         switch (i) {
1786     ///         case 1: {
1787     ///           foobar();
1788     ///           break;
1789     ///         }
1790     ///         default: {
1791     ///           break;
1792     ///         }
1793     ///         }
1794     ///       } while (--i);
1795     ///       return true;
1796     ///     } catch (...) {
1797     ///       handleError();
1798     ///       return false;
1799     ///     }
1800     ///   }
1801     ///
1802     ///   void foo(bool b) {
1803     ///     if (b) {
1804     ///       baz(2);
1805     ///     } else {
1806     ///       baz(5);
1807     ///     }
1808     ///   }
1809     ///
1810     ///   void bar() { foo(true); }
1811     ///   } // namespace N
1812     /// \endcode
1813     BS_Attach,
1814     /// Like ``Attach``, but break before braces on function, namespace and
1815     /// class definitions.
1816     /// \code
1817     ///   namespace N
1818     ///   {
1819     ///   enum E {
1820     ///     E1,
1821     ///     E2,
1822     ///   };
1823     ///
1824     ///   class C
1825     ///   {
1826     ///   public:
1827     ///     C();
1828     ///   };
1829     ///
1830     ///   bool baz(int i)
1831     ///   {
1832     ///     try {
1833     ///       do {
1834     ///         switch (i) {
1835     ///         case 1: {
1836     ///           foobar();
1837     ///           break;
1838     ///         }
1839     ///         default: {
1840     ///           break;
1841     ///         }
1842     ///         }
1843     ///       } while (--i);
1844     ///       return true;
1845     ///     } catch (...) {
1846     ///       handleError();
1847     ///       return false;
1848     ///     }
1849     ///   }
1850     ///
1851     ///   void foo(bool b)
1852     ///   {
1853     ///     if (b) {
1854     ///       baz(2);
1855     ///     } else {
1856     ///       baz(5);
1857     ///     }
1858     ///   }
1859     ///
1860     ///   void bar() { foo(true); }
1861     ///   } // namespace N
1862     /// \endcode
1863     BS_Linux,
1864     /// Like ``Attach``, but break before braces on enum, function, and record
1865     /// definitions.
1866     /// \code
1867     ///   namespace N {
1868     ///   enum E
1869     ///   {
1870     ///     E1,
1871     ///     E2,
1872     ///   };
1873     ///
1874     ///   class C
1875     ///   {
1876     ///   public:
1877     ///     C();
1878     ///   };
1879     ///
1880     ///   bool baz(int i)
1881     ///   {
1882     ///     try {
1883     ///       do {
1884     ///         switch (i) {
1885     ///         case 1: {
1886     ///           foobar();
1887     ///           break;
1888     ///         }
1889     ///         default: {
1890     ///           break;
1891     ///         }
1892     ///         }
1893     ///       } while (--i);
1894     ///       return true;
1895     ///     } catch (...) {
1896     ///       handleError();
1897     ///       return false;
1898     ///     }
1899     ///   }
1900     ///
1901     ///   void foo(bool b)
1902     ///   {
1903     ///     if (b) {
1904     ///       baz(2);
1905     ///     } else {
1906     ///       baz(5);
1907     ///     }
1908     ///   }
1909     ///
1910     ///   void bar() { foo(true); }
1911     ///   } // namespace N
1912     /// \endcode
1913     BS_Mozilla,
1914     /// Like ``Attach``, but break before function definitions, ``catch``, and
1915     /// ``else``.
1916     /// \code
1917     ///   namespace N {
1918     ///   enum E {
1919     ///     E1,
1920     ///     E2,
1921     ///   };
1922     ///
1923     ///   class C {
1924     ///   public:
1925     ///     C();
1926     ///   };
1927     ///
1928     ///   bool baz(int i)
1929     ///   {
1930     ///     try {
1931     ///       do {
1932     ///         switch (i) {
1933     ///         case 1: {
1934     ///           foobar();
1935     ///           break;
1936     ///         }
1937     ///         default: {
1938     ///           break;
1939     ///         }
1940     ///         }
1941     ///       } while (--i);
1942     ///       return true;
1943     ///     }
1944     ///     catch (...) {
1945     ///       handleError();
1946     ///       return false;
1947     ///     }
1948     ///   }
1949     ///
1950     ///   void foo(bool b)
1951     ///   {
1952     ///     if (b) {
1953     ///       baz(2);
1954     ///     }
1955     ///     else {
1956     ///       baz(5);
1957     ///     }
1958     ///   }
1959     ///
1960     ///   void bar() { foo(true); }
1961     ///   } // namespace N
1962     /// \endcode
1963     BS_Stroustrup,
1964     /// Always break before braces.
1965     /// \code
1966     ///   namespace N
1967     ///   {
1968     ///   enum E
1969     ///   {
1970     ///     E1,
1971     ///     E2,
1972     ///   };
1973     ///
1974     ///   class C
1975     ///   {
1976     ///   public:
1977     ///     C();
1978     ///   };
1979     ///
1980     ///   bool baz(int i)
1981     ///   {
1982     ///     try
1983     ///     {
1984     ///       do
1985     ///       {
1986     ///         switch (i)
1987     ///         {
1988     ///         case 1:
1989     ///         {
1990     ///           foobar();
1991     ///           break;
1992     ///         }
1993     ///         default:
1994     ///         {
1995     ///           break;
1996     ///         }
1997     ///         }
1998     ///       } while (--i);
1999     ///       return true;
2000     ///     }
2001     ///     catch (...)
2002     ///     {
2003     ///       handleError();
2004     ///       return false;
2005     ///     }
2006     ///   }
2007     ///
2008     ///   void foo(bool b)
2009     ///   {
2010     ///     if (b)
2011     ///     {
2012     ///       baz(2);
2013     ///     }
2014     ///     else
2015     ///     {
2016     ///       baz(5);
2017     ///     }
2018     ///   }
2019     ///
2020     ///   void bar() { foo(true); }
2021     ///   } // namespace N
2022     /// \endcode
2023     BS_Allman,
2024     /// Like ``Allman`` but always indent braces and line up code with braces.
2025     /// \code
2026     ///   namespace N
2027     ///     {
2028     ///   enum E
2029     ///     {
2030     ///     E1,
2031     ///     E2,
2032     ///     };
2033     ///
2034     ///   class C
2035     ///     {
2036     ///   public:
2037     ///     C();
2038     ///     };
2039     ///
2040     ///   bool baz(int i)
2041     ///     {
2042     ///     try
2043     ///       {
2044     ///       do
2045     ///         {
2046     ///         switch (i)
2047     ///           {
2048     ///           case 1:
2049     ///           {
2050     ///           foobar();
2051     ///           break;
2052     ///           }
2053     ///           default:
2054     ///           {
2055     ///           break;
2056     ///           }
2057     ///           }
2058     ///         } while (--i);
2059     ///       return true;
2060     ///       }
2061     ///     catch (...)
2062     ///       {
2063     ///       handleError();
2064     ///       return false;
2065     ///       }
2066     ///     }
2067     ///
2068     ///   void foo(bool b)
2069     ///     {
2070     ///     if (b)
2071     ///       {
2072     ///       baz(2);
2073     ///       }
2074     ///     else
2075     ///       {
2076     ///       baz(5);
2077     ///       }
2078     ///     }
2079     ///
2080     ///   void bar() { foo(true); }
2081     ///     } // namespace N
2082     /// \endcode
2083     BS_Whitesmiths,
2084     /// Always break before braces and add an extra level of indentation to
2085     /// braces of control statements, not to those of class, function
2086     /// or other definitions.
2087     /// \code
2088     ///   namespace N
2089     ///   {
2090     ///   enum E
2091     ///   {
2092     ///     E1,
2093     ///     E2,
2094     ///   };
2095     ///
2096     ///   class C
2097     ///   {
2098     ///   public:
2099     ///     C();
2100     ///   };
2101     ///
2102     ///   bool baz(int i)
2103     ///   {
2104     ///     try
2105     ///       {
2106     ///         do
2107     ///           {
2108     ///             switch (i)
2109     ///               {
2110     ///               case 1:
2111     ///                 {
2112     ///                   foobar();
2113     ///                   break;
2114     ///                 }
2115     ///               default:
2116     ///                 {
2117     ///                   break;
2118     ///                 }
2119     ///               }
2120     ///           }
2121     ///         while (--i);
2122     ///         return true;
2123     ///       }
2124     ///     catch (...)
2125     ///       {
2126     ///         handleError();
2127     ///         return false;
2128     ///       }
2129     ///   }
2130     ///
2131     ///   void foo(bool b)
2132     ///   {
2133     ///     if (b)
2134     ///       {
2135     ///         baz(2);
2136     ///       }
2137     ///     else
2138     ///       {
2139     ///         baz(5);
2140     ///       }
2141     ///   }
2142     ///
2143     ///   void bar() { foo(true); }
2144     ///   } // namespace N
2145     /// \endcode
2146     BS_GNU,
2147     /// Like ``Attach``, but break before functions.
2148     /// \code
2149     ///   namespace N {
2150     ///   enum E {
2151     ///     E1,
2152     ///     E2,
2153     ///   };
2154     ///
2155     ///   class C {
2156     ///   public:
2157     ///     C();
2158     ///   };
2159     ///
2160     ///   bool baz(int i)
2161     ///   {
2162     ///     try {
2163     ///       do {
2164     ///         switch (i) {
2165     ///         case 1: {
2166     ///           foobar();
2167     ///           break;
2168     ///         }
2169     ///         default: {
2170     ///           break;
2171     ///         }
2172     ///         }
2173     ///       } while (--i);
2174     ///       return true;
2175     ///     } catch (...) {
2176     ///       handleError();
2177     ///       return false;
2178     ///     }
2179     ///   }
2180     ///
2181     ///   void foo(bool b)
2182     ///   {
2183     ///     if (b) {
2184     ///       baz(2);
2185     ///     } else {
2186     ///       baz(5);
2187     ///     }
2188     ///   }
2189     ///
2190     ///   void bar() { foo(true); }
2191     ///   } // namespace N
2192     /// \endcode
2193     BS_WebKit,
2194     /// Configure each individual brace in ``BraceWrapping``.
2195     BS_Custom
2196   };
2197 
2198   /// The brace breaking style to use.
2199   /// \version 3.7
2200   BraceBreakingStyle BreakBeforeBraces;
2201 
2202   /// Different ways to break before concept declarations.
2203   enum BreakBeforeConceptDeclarationsStyle : int8_t {
2204     /// Keep the template declaration line together with ``concept``.
2205     /// \code
2206     ///   template <typename T> concept C = ...;
2207     /// \endcode
2208     BBCDS_Never,
2209     /// Breaking between template declaration and ``concept`` is allowed. The
2210     /// actual behavior depends on the content and line breaking rules and
2211     /// penalties.
2212     BBCDS_Allowed,
2213     /// Always break before ``concept``, putting it in the line after the
2214     /// template declaration.
2215     /// \code
2216     ///   template <typename T>
2217     ///   concept C = ...;
2218     /// \endcode
2219     BBCDS_Always,
2220   };
2221 
2222   /// The concept declaration style to use.
2223   /// \version 12
2224   BreakBeforeConceptDeclarationsStyle BreakBeforeConceptDeclarations;
2225 
2226   /// Different ways to break ASM parameters.
2227   enum BreakBeforeInlineASMColonStyle : int8_t {
2228     /// No break before inline ASM colon.
2229     /// \code
2230     ///    asm volatile("string", : : val);
2231     /// \endcode
2232     BBIAS_Never,
2233     /// Break before inline ASM colon if the line length is longer than column
2234     /// limit.
2235     /// \code
2236     ///    asm volatile("string", : : val);
2237     ///    asm("cmoveq %1, %2, %[result]"
2238     ///        : [result] "=r"(result)
2239     ///        : "r"(test), "r"(new), "[result]"(old));
2240     /// \endcode
2241     BBIAS_OnlyMultiline,
2242     /// Always break before inline ASM colon.
2243     /// \code
2244     ///    asm volatile("string",
2245     ///                 :
2246     ///                 : val);
2247     /// \endcode
2248     BBIAS_Always,
2249   };
2250 
2251   /// The inline ASM colon style to use.
2252   /// \version 16
2253   BreakBeforeInlineASMColonStyle BreakBeforeInlineASMColon;
2254 
2255   /// If ``true``, ternary operators will be placed after line breaks.
2256   /// \code
2257   ///    true:
2258   ///    veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
2259   ///        ? firstValue
2260   ///        : SecondValueVeryVeryVeryVeryLong;
2261   ///
2262   ///    false:
2263   ///    veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?
2264   ///        firstValue :
2265   ///        SecondValueVeryVeryVeryVeryLong;
2266   /// \endcode
2267   /// \version 3.7
2268   bool BreakBeforeTernaryOperators;
2269 
2270   /// Different ways to break binary operations.
2271   enum BreakBinaryOperationsStyle : int8_t {
2272     /// Don't break binary operations
2273     /// \code
2274     ///    aaa + bbbb * ccccc - ddddd +
2275     ///    eeeeeeeeeeeeeeee;
2276     /// \endcode
2277     BBO_Never,
2278 
2279     /// Binary operations will either be all on the same line, or each operation
2280     /// will have one line each.
2281     /// \code
2282     ///    aaa +
2283     ///    bbbb *
2284     ///    ccccc -
2285     ///    ddddd +
2286     ///    eeeeeeeeeeeeeeee;
2287     /// \endcode
2288     BBO_OnePerLine,
2289 
2290     /// Binary operations of a particular precedence that exceed the column
2291     /// limit will have one line each.
2292     /// \code
2293     ///    aaa +
2294     ///    bbbb * ccccc -
2295     ///    ddddd +
2296     ///    eeeeeeeeeeeeeeee;
2297     /// \endcode
2298     BBO_RespectPrecedence
2299   };
2300 
2301   /// The break binary operations style to use.
2302   /// \version 20
2303   BreakBinaryOperationsStyle BreakBinaryOperations;
2304 
2305   /// Different ways to break initializers.
2306   enum BreakConstructorInitializersStyle : int8_t {
2307     /// Break constructor initializers before the colon and after the commas.
2308     /// \code
2309     ///    Constructor()
2310     ///        : initializer1(),
2311     ///          initializer2()
2312     /// \endcode
2313     BCIS_BeforeColon,
2314     /// Break constructor initializers before the colon and commas, and align
2315     /// the commas with the colon.
2316     /// \code
2317     ///    Constructor()
2318     ///        : initializer1()
2319     ///        , initializer2()
2320     /// \endcode
2321     BCIS_BeforeComma,
2322     /// Break constructor initializers after the colon and commas.
2323     /// \code
2324     ///    Constructor() :
2325     ///        initializer1(),
2326     ///        initializer2()
2327     /// \endcode
2328     BCIS_AfterColon
2329   };
2330 
2331   /// The break constructor initializers style to use.
2332   /// \version 5
2333   BreakConstructorInitializersStyle BreakConstructorInitializers;
2334 
2335   /// If ``true``, clang-format will always break before function definition
2336   /// parameters.
2337   /// \code
2338   ///    true:
2339   ///    void functionDefinition(
2340   ///             int A, int B) {}
2341   ///
2342   ///    false:
2343   ///    void functionDefinition(int A, int B) {}
2344   ///
2345   /// \endcode
2346   /// \version 19
2347   bool BreakFunctionDefinitionParameters;
2348 
2349   /// Break after each annotation on a field in Java files.
2350   /// \code{.java}
2351   ///    true:                                  false:
2352   ///    @Partial                       vs.     @Partial @Mock DataLoad loader;
2353   ///    @Mock
2354   ///    DataLoad loader;
2355   /// \endcode
2356   /// \version 3.8
2357   bool BreakAfterJavaFieldAnnotations;
2358 
2359   /// Allow breaking string literals when formatting.
2360   ///
2361   /// In C, C++, and Objective-C:
2362   /// \code
2363   ///    true:
2364   ///    const char* x = "veryVeryVeryVeryVeryVe"
2365   ///                    "ryVeryVeryVeryVeryVery"
2366   ///                    "VeryLongString";
2367   ///
2368   ///    false:
2369   ///    const char* x =
2370   ///        "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
2371   /// \endcode
2372   ///
2373   /// In C# and Java:
2374   /// \code
2375   ///    true:
2376   ///    string x = "veryVeryVeryVeryVeryVe" +
2377   ///               "ryVeryVeryVeryVeryVery" +
2378   ///               "VeryLongString";
2379   ///
2380   ///    false:
2381   ///    string x =
2382   ///        "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
2383   /// \endcode
2384   ///
2385   /// C# interpolated strings are not broken.
2386   ///
2387   /// In Verilog:
2388   /// \code
2389   ///    true:
2390   ///    string x = {"veryVeryVeryVeryVeryVe",
2391   ///                "ryVeryVeryVeryVeryVery",
2392   ///                "VeryLongString"};
2393   ///
2394   ///    false:
2395   ///    string x =
2396   ///        "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
2397   /// \endcode
2398   ///
2399   /// \version 3.9
2400   bool BreakStringLiterals;
2401 
2402   /// The column limit.
2403   ///
2404   /// A column limit of ``0`` means that there is no column limit. In this case,
2405   /// clang-format will respect the input's line breaking decisions within
2406   /// statements unless they contradict other rules.
2407   /// \version 3.7
2408   unsigned ColumnLimit;
2409 
2410   /// A regular expression that describes comments with special meaning,
2411   /// which should not be split into lines or otherwise changed.
2412   /// \code
2413   ///    // CommentPragmas: '^ FOOBAR pragma:'
2414   ///    // Will leave the following line unaffected
2415   ///    #include <vector> // FOOBAR pragma: keep
2416   /// \endcode
2417   /// \version 3.7
2418   std::string CommentPragmas;
2419 
2420   /// Different ways to break inheritance list.
2421   enum BreakInheritanceListStyle : int8_t {
2422     /// Break inheritance list before the colon and after the commas.
2423     /// \code
2424     ///    class Foo
2425     ///        : Base1,
2426     ///          Base2
2427     ///    {};
2428     /// \endcode
2429     BILS_BeforeColon,
2430     /// Break inheritance list before the colon and commas, and align
2431     /// the commas with the colon.
2432     /// \code
2433     ///    class Foo
2434     ///        : Base1
2435     ///        , Base2
2436     ///    {};
2437     /// \endcode
2438     BILS_BeforeComma,
2439     /// Break inheritance list after the colon and commas.
2440     /// \code
2441     ///    class Foo :
2442     ///        Base1,
2443     ///        Base2
2444     ///    {};
2445     /// \endcode
2446     BILS_AfterColon,
2447     /// Break inheritance list only after the commas.
2448     /// \code
2449     ///    class Foo : Base1,
2450     ///                Base2
2451     ///    {};
2452     /// \endcode
2453     BILS_AfterComma,
2454   };
2455 
2456   /// The inheritance list style to use.
2457   /// \version 7
2458   BreakInheritanceListStyle BreakInheritanceList;
2459 
2460   /// The template declaration breaking style to use.
2461   /// \version 19
2462   BreakTemplateDeclarationsStyle BreakTemplateDeclarations;
2463 
2464   /// If ``true``, consecutive namespace declarations will be on the same
2465   /// line. If ``false``, each namespace is declared on a new line.
2466   /// \code
2467   ///   true:
2468   ///   namespace Foo { namespace Bar {
2469   ///   }}
2470   ///
2471   ///   false:
2472   ///   namespace Foo {
2473   ///   namespace Bar {
2474   ///   }
2475   ///   }
2476   /// \endcode
2477   ///
2478   /// If it does not fit on a single line, the overflowing namespaces get
2479   /// wrapped:
2480   /// \code
2481   ///   namespace Foo { namespace Bar {
2482   ///   namespace Extra {
2483   ///   }}}
2484   /// \endcode
2485   /// \version 5
2486   bool CompactNamespaces;
2487 
2488   /// This option is **deprecated**. See ``CurrentLine`` of
2489   /// ``PackConstructorInitializers``.
2490   /// \version 3.7
2491   // bool ConstructorInitializerAllOnOneLineOrOnePerLine;
2492 
2493   /// The number of characters to use for indentation of constructor
2494   /// initializer lists as well as inheritance lists.
2495   /// \version 3.7
2496   unsigned ConstructorInitializerIndentWidth;
2497 
2498   /// Indent width for line continuations.
2499   /// \code
2500   ///    ContinuationIndentWidth: 2
2501   ///
2502   ///    int i =         //  VeryVeryVeryVeryVeryLongComment
2503   ///      longFunction( // Again a long comment
2504   ///        arg);
2505   /// \endcode
2506   /// \version 3.7
2507   unsigned ContinuationIndentWidth;
2508 
2509   /// If ``true``, format braced lists as best suited for C++11 braced
2510   /// lists.
2511   ///
2512   /// Important differences:
2513   ///
2514   /// * No spaces inside the braced list.
2515   /// * No line break before the closing brace.
2516   /// * Indentation with the continuation indent, not with the block indent.
2517   ///
2518   /// Fundamentally, C++11 braced lists are formatted exactly like function
2519   /// calls would be formatted in their place. If the braced list follows a name
2520   /// (e.g. a type or variable name), clang-format formats as if the ``{}`` were
2521   /// the parentheses of a function call with that name. If there is no name,
2522   /// a zero-length name is assumed.
2523   /// \code
2524   ///    true:                                  false:
2525   ///    vector<int> x{1, 2, 3, 4};     vs.     vector<int> x{ 1, 2, 3, 4 };
2526   ///    vector<T> x{{}, {}, {}, {}};           vector<T> x{ {}, {}, {}, {} };
2527   ///    f(MyMap[{composite, key}]);            f(MyMap[{ composite, key }]);
2528   ///    new int[3]{1, 2, 3};                   new int[3]{ 1, 2, 3 };
2529   /// \endcode
2530   /// \version 3.4
2531   bool Cpp11BracedListStyle;
2532 
2533   /// This option is **deprecated**. See ``DeriveLF`` and ``DeriveCRLF`` of
2534   /// ``LineEnding``.
2535   /// \version 10
2536   // bool DeriveLineEnding;
2537 
2538   /// If ``true``, analyze the formatted file for the most common
2539   /// alignment of ``&`` and ``*``.
2540   /// Pointer and reference alignment styles are going to be updated according
2541   /// to the preferences found in the file.
2542   /// ``PointerAlignment`` is then used only as fallback.
2543   /// \version 3.7
2544   bool DerivePointerAlignment;
2545 
2546   /// Disables formatting completely.
2547   /// \version 3.7
2548   bool DisableFormat;
2549 
2550   /// Different styles for empty line after access modifiers.
2551   /// ``EmptyLineBeforeAccessModifier`` configuration handles the number of
2552   /// empty lines between two access modifiers.
2553   enum EmptyLineAfterAccessModifierStyle : int8_t {
2554     /// Remove all empty lines after access modifiers.
2555     /// \code
2556     ///   struct foo {
2557     ///   private:
2558     ///     int i;
2559     ///   protected:
2560     ///     int j;
2561     ///     /* comment */
2562     ///   public:
2563     ///     foo() {}
2564     ///   private:
2565     ///   protected:
2566     ///   };
2567     /// \endcode
2568     ELAAMS_Never,
2569     /// Keep existing empty lines after access modifiers.
2570     /// MaxEmptyLinesToKeep is applied instead.
2571     ELAAMS_Leave,
2572     /// Always add empty line after access modifiers if there are none.
2573     /// MaxEmptyLinesToKeep is applied also.
2574     /// \code
2575     ///   struct foo {
2576     ///   private:
2577     ///
2578     ///     int i;
2579     ///   protected:
2580     ///
2581     ///     int j;
2582     ///     /* comment */
2583     ///   public:
2584     ///
2585     ///     foo() {}
2586     ///   private:
2587     ///
2588     ///   protected:
2589     ///
2590     ///   };
2591     /// \endcode
2592     ELAAMS_Always,
2593   };
2594 
2595   /// Defines when to put an empty line after access modifiers.
2596   /// ``EmptyLineBeforeAccessModifier`` configuration handles the number of
2597   /// empty lines between two access modifiers.
2598   /// \version 13
2599   EmptyLineAfterAccessModifierStyle EmptyLineAfterAccessModifier;
2600 
2601   /// Different styles for empty line before access modifiers.
2602   enum EmptyLineBeforeAccessModifierStyle : int8_t {
2603     /// Remove all empty lines before access modifiers.
2604     /// \code
2605     ///   struct foo {
2606     ///   private:
2607     ///     int i;
2608     ///   protected:
2609     ///     int j;
2610     ///     /* comment */
2611     ///   public:
2612     ///     foo() {}
2613     ///   private:
2614     ///   protected:
2615     ///   };
2616     /// \endcode
2617     ELBAMS_Never,
2618     /// Keep existing empty lines before access modifiers.
2619     ELBAMS_Leave,
2620     /// Add empty line only when access modifier starts a new logical block.
2621     /// Logical block is a group of one or more member fields or functions.
2622     /// \code
2623     ///   struct foo {
2624     ///   private:
2625     ///     int i;
2626     ///
2627     ///   protected:
2628     ///     int j;
2629     ///     /* comment */
2630     ///   public:
2631     ///     foo() {}
2632     ///
2633     ///   private:
2634     ///   protected:
2635     ///   };
2636     /// \endcode
2637     ELBAMS_LogicalBlock,
2638     /// Always add empty line before access modifiers unless access modifier
2639     /// is at the start of struct or class definition.
2640     /// \code
2641     ///   struct foo {
2642     ///   private:
2643     ///     int i;
2644     ///
2645     ///   protected:
2646     ///     int j;
2647     ///     /* comment */
2648     ///
2649     ///   public:
2650     ///     foo() {}
2651     ///
2652     ///   private:
2653     ///
2654     ///   protected:
2655     ///   };
2656     /// \endcode
2657     ELBAMS_Always,
2658   };
2659 
2660   /// Defines in which cases to put empty line before access modifiers.
2661   /// \version 12
2662   EmptyLineBeforeAccessModifierStyle EmptyLineBeforeAccessModifier;
2663 
2664   /// If ``true``, clang-format detects whether function calls and
2665   /// definitions are formatted with one parameter per line.
2666   ///
2667   /// Each call can be bin-packed, one-per-line or inconclusive. If it is
2668   /// inconclusive, e.g. completely on one line, but a decision needs to be
2669   /// made, clang-format analyzes whether there are other bin-packed cases in
2670   /// the input file and act accordingly.
2671   ///
2672   /// \note
2673   ///  This is an experimental flag, that might go away or be renamed. Do
2674   ///  not use this in config files, etc. Use at your own risk.
2675   /// \endnote
2676   /// \version 3.7
2677   bool ExperimentalAutoDetectBinPacking;
2678 
2679   /// If ``true``, clang-format adds missing namespace end comments for
2680   /// namespaces and fixes invalid existing ones. This doesn't affect short
2681   /// namespaces, which are controlled by ``ShortNamespaceLines``.
2682   /// \code
2683   ///    true:                                  false:
2684   ///    namespace longNamespace {      vs.     namespace longNamespace {
2685   ///    void foo();                            void foo();
2686   ///    void bar();                            void bar();
2687   ///    } // namespace a                       }
2688   ///    namespace shortNamespace {             namespace shortNamespace {
2689   ///    void baz();                            void baz();
2690   ///    }                                      }
2691   /// \endcode
2692   /// \version 5
2693   bool FixNamespaceComments;
2694 
2695   /// A vector of macros that should be interpreted as foreach loops
2696   /// instead of as function calls.
2697   ///
2698   /// These are expected to be macros of the form:
2699   /// \code
2700   ///   FOREACH(<variable-declaration>, ...)
2701   ///     <loop-body>
2702   /// \endcode
2703   ///
2704   /// In the .clang-format configuration file, this can be configured like:
2705   /// \code{.yaml}
2706   ///   ForEachMacros: [RANGES_FOR, FOREACH]
2707   /// \endcode
2708   ///
2709   /// For example: BOOST_FOREACH.
2710   /// \version 3.7
2711   std::vector<std::string> ForEachMacros;
2712 
2713   tooling::IncludeStyle IncludeStyle;
2714 
2715   /// A vector of macros that should be interpreted as conditionals
2716   /// instead of as function calls.
2717   ///
2718   /// These are expected to be macros of the form:
2719   /// \code
2720   ///   IF(...)
2721   ///     <conditional-body>
2722   ///   else IF(...)
2723   ///     <conditional-body>
2724   /// \endcode
2725   ///
2726   /// In the .clang-format configuration file, this can be configured like:
2727   /// \code{.yaml}
2728   ///   IfMacros: [IF]
2729   /// \endcode
2730   ///
2731   /// For example: `KJ_IF_MAYBE
2732   /// <https://github.com/capnproto/capnproto/blob/master/kjdoc/tour.md#maybes>`_
2733   /// \version 13
2734   std::vector<std::string> IfMacros;
2735 
2736   /// Specify whether access modifiers should have their own indentation level.
2737   ///
2738   /// When ``false``, access modifiers are indented (or outdented) relative to
2739   /// the record members, respecting the ``AccessModifierOffset``. Record
2740   /// members are indented one level below the record.
2741   /// When ``true``, access modifiers get their own indentation level. As a
2742   /// consequence, record members are always indented 2 levels below the record,
2743   /// regardless of the access modifier presence. Value of the
2744   /// ``AccessModifierOffset`` is ignored.
2745   /// \code
2746   ///    false:                                 true:
2747   ///    class C {                      vs.     class C {
2748   ///      class D {                                class D {
2749   ///        void bar();                                void bar();
2750   ///      protected:                                 protected:
2751   ///        D();                                       D();
2752   ///      };                                       };
2753   ///    public:                                  public:
2754   ///      C();                                     C();
2755   ///    };                                     };
2756   ///    void foo() {                           void foo() {
2757   ///      return 1;                              return 1;
2758   ///    }                                      }
2759   /// \endcode
2760   /// \version 13
2761   bool IndentAccessModifiers;
2762 
2763   /// Indent case label blocks one level from the case label.
2764   ///
2765   /// When ``false``, the block following the case label uses the same
2766   /// indentation level as for the case label, treating the case label the same
2767   /// as an if-statement.
2768   /// When ``true``, the block gets indented as a scope block.
2769   /// \code
2770   ///    false:                                 true:
2771   ///    switch (fool) {                vs.     switch (fool) {
2772   ///    case 1: {                              case 1:
2773   ///      bar();                                 {
2774   ///    } break;                                   bar();
2775   ///    default: {                               }
2776   ///      plop();                                break;
2777   ///    }                                      default:
2778   ///    }                                        {
2779   ///                                               plop();
2780   ///                                             }
2781   ///                                           }
2782   /// \endcode
2783   /// \version 11
2784   bool IndentCaseBlocks;
2785 
2786   /// Indent case labels one level from the switch statement.
2787   ///
2788   /// When ``false``, use the same indentation level as for the switch
2789   /// statement. Switch statement body is always indented one level more than
2790   /// case labels (except the first block following the case label, which
2791   /// itself indents the code - unless IndentCaseBlocks is enabled).
2792   /// \code
2793   ///    false:                                 true:
2794   ///    switch (fool) {                vs.     switch (fool) {
2795   ///    case 1:                                  case 1:
2796   ///      bar();                                   bar();
2797   ///      break;                                   break;
2798   ///    default:                                 default:
2799   ///      plop();                                  plop();
2800   ///    }                                      }
2801   /// \endcode
2802   /// \version 3.3
2803   bool IndentCaseLabels;
2804 
2805   /// If ``true``, clang-format will indent the body of an ``export { ... }``
2806   /// block. This doesn't affect the formatting of anything else related to
2807   /// exported declarations.
2808   /// \code
2809   ///    true:                     false:
2810   ///    export {          vs.     export {
2811   ///      void foo();             void foo();
2812   ///      void bar();             void bar();
2813   ///    }                         }
2814   /// \endcode
2815   /// \version 20
2816   bool IndentExportBlock;
2817 
2818   /// Indents extern blocks
2819   enum IndentExternBlockStyle : int8_t {
2820     /// Backwards compatible with AfterExternBlock's indenting.
2821     /// \code
2822     ///    IndentExternBlock: AfterExternBlock
2823     ///    BraceWrapping.AfterExternBlock: true
2824     ///    extern "C"
2825     ///    {
2826     ///        void foo();
2827     ///    }
2828     /// \endcode
2829     ///
2830     /// \code
2831     ///    IndentExternBlock: AfterExternBlock
2832     ///    BraceWrapping.AfterExternBlock: false
2833     ///    extern "C" {
2834     ///    void foo();
2835     ///    }
2836     /// \endcode
2837     IEBS_AfterExternBlock,
2838     /// Does not indent extern blocks.
2839     /// \code
2840     ///     extern "C" {
2841     ///     void foo();
2842     ///     }
2843     /// \endcode
2844     IEBS_NoIndent,
2845     /// Indents extern blocks.
2846     /// \code
2847     ///     extern "C" {
2848     ///       void foo();
2849     ///     }
2850     /// \endcode
2851     IEBS_Indent,
2852   };
2853 
2854   /// IndentExternBlockStyle is the type of indenting of extern blocks.
2855   /// \version 11
2856   IndentExternBlockStyle IndentExternBlock;
2857 
2858   /// Indent goto labels.
2859   ///
2860   /// When ``false``, goto labels are flushed left.
2861   /// \code
2862   ///    true:                                  false:
2863   ///    int f() {                      vs.     int f() {
2864   ///      if (foo()) {                           if (foo()) {
2865   ///      label1:                              label1:
2866   ///        bar();                                 bar();
2867   ///      }                                      }
2868   ///    label2:                                label2:
2869   ///      return 1;                              return 1;
2870   ///    }                                      }
2871   /// \endcode
2872   /// \version 10
2873   bool IndentGotoLabels;
2874 
2875   /// Options for indenting preprocessor directives.
2876   enum PPDirectiveIndentStyle : int8_t {
2877     /// Does not indent any directives.
2878     /// \code
2879     ///    #if FOO
2880     ///    #if BAR
2881     ///    #include <foo>
2882     ///    #endif
2883     ///    #endif
2884     /// \endcode
2885     PPDIS_None,
2886     /// Indents directives after the hash.
2887     /// \code
2888     ///    #if FOO
2889     ///    #  if BAR
2890     ///    #    include <foo>
2891     ///    #  endif
2892     ///    #endif
2893     /// \endcode
2894     PPDIS_AfterHash,
2895     /// Indents directives before the hash.
2896     /// \code
2897     ///    #if FOO
2898     ///      #if BAR
2899     ///        #include <foo>
2900     ///      #endif
2901     ///    #endif
2902     /// \endcode
2903     PPDIS_BeforeHash
2904   };
2905 
2906   /// The preprocessor directive indenting style to use.
2907   /// \version 6
2908   PPDirectiveIndentStyle IndentPPDirectives;
2909 
2910   /// Indent the requires clause in a template. This only applies when
2911   /// ``RequiresClausePosition`` is ``OwnLine``, ``OwnLineWithBrace``,
2912   /// or ``WithFollowing``.
2913   ///
2914   /// In clang-format 12, 13 and 14 it was named ``IndentRequires``.
2915   /// \code
2916   ///    true:
2917   ///    template <typename It>
2918   ///      requires Iterator<It>
2919   ///    void sort(It begin, It end) {
2920   ///      //....
2921   ///    }
2922   ///
2923   ///    false:
2924   ///    template <typename It>
2925   ///    requires Iterator<It>
2926   ///    void sort(It begin, It end) {
2927   ///      //....
2928   ///    }
2929   /// \endcode
2930   /// \version 15
2931   bool IndentRequiresClause;
2932 
2933   /// The number of columns to use for indentation.
2934   /// \code
2935   ///    IndentWidth: 3
2936   ///
2937   ///    void f() {
2938   ///       someFunction();
2939   ///       if (true, false) {
2940   ///          f();
2941   ///       }
2942   ///    }
2943   /// \endcode
2944   /// \version 3.7
2945   unsigned IndentWidth;
2946 
2947   /// Indent if a function definition or declaration is wrapped after the
2948   /// type.
2949   /// \code
2950   ///    true:
2951   ///    LoooooooooooooooooooooooooooooooooooooooongReturnType
2952   ///        LoooooooooooooooooooooooooooooooongFunctionDeclaration();
2953   ///
2954   ///    false:
2955   ///    LoooooooooooooooooooooooooooooooooooooooongReturnType
2956   ///    LoooooooooooooooooooooooooooooooongFunctionDeclaration();
2957   /// \endcode
2958   /// \version 3.7
2959   bool IndentWrappedFunctionNames;
2960 
2961   /// Insert braces after control statements (``if``, ``else``, ``for``, ``do``,
2962   /// and ``while``) in C++ unless the control statements are inside macro
2963   /// definitions or the braces would enclose preprocessor directives.
2964   /// \warning
2965   ///  Setting this option to ``true`` could lead to incorrect code formatting
2966   ///  due to clang-format's lack of complete semantic information. As such,
2967   ///  extra care should be taken to review code changes made by this option.
2968   /// \endwarning
2969   /// \code
2970   ///   false:                                    true:
2971   ///
2972   ///   if (isa<FunctionDecl>(D))        vs.      if (isa<FunctionDecl>(D)) {
2973   ///     handleFunctionDecl(D);                    handleFunctionDecl(D);
2974   ///   else if (isa<VarDecl>(D))                 } else if (isa<VarDecl>(D)) {
2975   ///     handleVarDecl(D);                         handleVarDecl(D);
2976   ///   else                                      } else {
2977   ///     return;                                   return;
2978   ///                                             }
2979   ///
2980   ///   while (i--)                      vs.      while (i--) {
2981   ///     for (auto *A : D.attrs())                 for (auto *A : D.attrs()) {
2982   ///       handleAttr(A);                            handleAttr(A);
2983   ///                                               }
2984   ///                                             }
2985   ///
2986   ///   do                               vs.      do {
2987   ///     --i;                                      --i;
2988   ///   while (i);                                } while (i);
2989   /// \endcode
2990   /// \version 15
2991   bool InsertBraces;
2992 
2993   /// Insert a newline at end of file if missing.
2994   /// \version 16
2995   bool InsertNewlineAtEOF;
2996 
2997   /// The style of inserting trailing commas into container literals.
2998   enum TrailingCommaStyle : int8_t {
2999     /// Do not insert trailing commas.
3000     TCS_None,
3001     /// Insert trailing commas in container literals that were wrapped over
3002     /// multiple lines. Note that this is conceptually incompatible with
3003     /// bin-packing, because the trailing comma is used as an indicator
3004     /// that a container should be formatted one-per-line (i.e. not bin-packed).
3005     /// So inserting a trailing comma counteracts bin-packing.
3006     TCS_Wrapped,
3007   };
3008 
3009   /// If set to ``TCS_Wrapped`` will insert trailing commas in container
3010   /// literals (arrays and objects) that wrap across multiple lines.
3011   /// It is currently only available for JavaScript
3012   /// and disabled by default ``TCS_None``.
3013   /// ``InsertTrailingCommas`` cannot be used together with ``BinPackArguments``
3014   /// as inserting the comma disables bin-packing.
3015   /// \code
3016   ///   TSC_Wrapped:
3017   ///   const someArray = [
3018   ///   aaaaaaaaaaaaaaaaaaaaaaaaaa,
3019   ///   aaaaaaaaaaaaaaaaaaaaaaaaaa,
3020   ///   aaaaaaaaaaaaaaaaaaaaaaaaaa,
3021   ///   //                        ^ inserted
3022   ///   ]
3023   /// \endcode
3024   /// \version 11
3025   TrailingCommaStyle InsertTrailingCommas;
3026 
3027   /// Separator format of integer literals of different bases.
3028   ///
3029   /// If negative, remove separators. If  ``0``, leave the literal as is. If
3030   /// positive, insert separators between digits starting from the rightmost
3031   /// digit.
3032   ///
3033   /// For example, the config below will leave separators in binary literals
3034   /// alone, insert separators in decimal literals to separate the digits into
3035   /// groups of 3, and remove separators in hexadecimal literals.
3036   /// \code
3037   ///   IntegerLiteralSeparator:
3038   ///     Binary: 0
3039   ///     Decimal: 3
3040   ///     Hex: -1
3041   /// \endcode
3042   ///
3043   /// You can also specify a minimum number of digits (``BinaryMinDigits``,
3044   /// ``DecimalMinDigits``, and ``HexMinDigits``) the integer literal must
3045   /// have in order for the separators to be inserted.
3046   struct IntegerLiteralSeparatorStyle {
3047     /// Format separators in binary literals.
3048     /// \code{.text}
3049     ///   /* -1: */ b = 0b100111101101;
3050     ///   /*  0: */ b = 0b10011'11'0110'1;
3051     ///   /*  3: */ b = 0b100'111'101'101;
3052     ///   /*  4: */ b = 0b1001'1110'1101;
3053     /// \endcode
3054     int8_t Binary;
3055     /// Format separators in binary literals with a minimum number of digits.
3056     /// \code{.text}
3057     ///   // Binary: 3
3058     ///   // BinaryMinDigits: 7
3059     ///   b1 = 0b101101;
3060     ///   b2 = 0b1'101'101;
3061     /// \endcode
3062     int8_t BinaryMinDigits;
3063     /// Format separators in decimal literals.
3064     /// \code{.text}
3065     ///   /* -1: */ d = 18446744073709550592ull;
3066     ///   /*  0: */ d = 184467'440737'0'95505'92ull;
3067     ///   /*  3: */ d = 18'446'744'073'709'550'592ull;
3068     /// \endcode
3069     int8_t Decimal;
3070     /// Format separators in decimal literals with a minimum number of digits.
3071     /// \code{.text}
3072     ///   // Decimal: 3
3073     ///   // DecimalMinDigits: 5
3074     ///   d1 = 2023;
3075     ///   d2 = 10'000;
3076     /// \endcode
3077     int8_t DecimalMinDigits;
3078     /// Format separators in hexadecimal literals.
3079     /// \code{.text}
3080     ///   /* -1: */ h = 0xDEADBEEFDEADBEEFuz;
3081     ///   /*  0: */ h = 0xDEAD'BEEF'DE'AD'BEE'Fuz;
3082     ///   /*  2: */ h = 0xDE'AD'BE'EF'DE'AD'BE'EFuz;
3083     /// \endcode
3084     int8_t Hex;
3085     /// Format separators in hexadecimal literals with a minimum number of
3086     /// digits.
3087     /// \code{.text}
3088     ///   // Hex: 2
3089     ///   // HexMinDigits: 6
3090     ///   h1 = 0xABCDE;
3091     ///   h2 = 0xAB'CD'EF;
3092     /// \endcode
3093     int8_t HexMinDigits;
3094     bool operator==(const IntegerLiteralSeparatorStyle &R) const {
3095       return Binary == R.Binary && BinaryMinDigits == R.BinaryMinDigits &&
3096              Decimal == R.Decimal && DecimalMinDigits == R.DecimalMinDigits &&
3097              Hex == R.Hex && HexMinDigits == R.HexMinDigits;
3098     }
3099   };
3100 
3101   /// Format integer literal separators (``'`` for C++ and ``_`` for C#, Java,
3102   /// and JavaScript).
3103   /// \version 16
3104   IntegerLiteralSeparatorStyle IntegerLiteralSeparator;
3105 
3106   /// A vector of prefixes ordered by the desired groups for Java imports.
3107   ///
3108   /// One group's prefix can be a subset of another - the longest prefix is
3109   /// always matched. Within a group, the imports are ordered lexicographically.
3110   /// Static imports are grouped separately and follow the same group rules.
3111   /// By default, static imports are placed before non-static imports,
3112   /// but this behavior is changed by another option,
3113   /// ``SortJavaStaticImport``.
3114   ///
3115   /// In the .clang-format configuration file, this can be configured like
3116   /// in the following yaml example. This will result in imports being
3117   /// formatted as in the Java example below.
3118   /// \code{.yaml}
3119   ///   JavaImportGroups: [com.example, com, org]
3120   /// \endcode
3121   ///
3122   /// \code{.java}
3123   ///    import static com.example.function1;
3124   ///
3125   ///    import static com.test.function2;
3126   ///
3127   ///    import static org.example.function3;
3128   ///
3129   ///    import com.example.ClassA;
3130   ///    import com.example.Test;
3131   ///    import com.example.a.ClassB;
3132   ///
3133   ///    import com.test.ClassC;
3134   ///
3135   ///    import org.example.ClassD;
3136   /// \endcode
3137   /// \version 8
3138   std::vector<std::string> JavaImportGroups;
3139 
3140   /// Quotation styles for JavaScript strings. Does not affect template
3141   /// strings.
3142   enum JavaScriptQuoteStyle : int8_t {
3143     /// Leave string quotes as they are.
3144     /// \code{.js}
3145     ///    string1 = "foo";
3146     ///    string2 = 'bar';
3147     /// \endcode
3148     JSQS_Leave,
3149     /// Always use single quotes.
3150     /// \code{.js}
3151     ///    string1 = 'foo';
3152     ///    string2 = 'bar';
3153     /// \endcode
3154     JSQS_Single,
3155     /// Always use double quotes.
3156     /// \code{.js}
3157     ///    string1 = "foo";
3158     ///    string2 = "bar";
3159     /// \endcode
3160     JSQS_Double
3161   };
3162 
3163   /// The JavaScriptQuoteStyle to use for JavaScript strings.
3164   /// \version 3.9
3165   JavaScriptQuoteStyle JavaScriptQuotes;
3166 
3167   // clang-format off
3168   /// Whether to wrap JavaScript import/export statements.
3169   /// \code{.js}
3170   ///    true:
3171   ///    import {
3172   ///        VeryLongImportsAreAnnoying,
3173   ///        VeryLongImportsAreAnnoying,
3174   ///        VeryLongImportsAreAnnoying,
3175   ///    } from "some/module.js"
3176   ///
3177   ///    false:
3178   ///    import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from "some/module.js"
3179   /// \endcode
3180   /// \version 3.9
3181   bool JavaScriptWrapImports;
3182   // clang-format on
3183 
3184   /// Options regarding which empty lines are kept.
3185   ///
3186   /// For example, the config below will remove empty lines at start of the
3187   /// file, end of the file, and start of blocks.
3188   ///
3189   /// \code
3190   ///   KeepEmptyLines:
3191   ///     AtEndOfFile: false
3192   ///     AtStartOfBlock: false
3193   ///     AtStartOfFile: false
3194   /// \endcode
3195   struct KeepEmptyLinesStyle {
3196     /// Keep empty lines at end of file.
3197     bool AtEndOfFile;
3198     /// Keep empty lines at start of a block.
3199     /// \code
3200     ///    true:                                  false:
3201     ///    if (foo) {                     vs.     if (foo) {
3202     ///                                             bar();
3203     ///      bar();                               }
3204     ///    }
3205     /// \endcode
3206     bool AtStartOfBlock;
3207     /// Keep empty lines at start of file.
3208     bool AtStartOfFile;
3209     bool operator==(const KeepEmptyLinesStyle &R) const {
3210       return AtEndOfFile == R.AtEndOfFile &&
3211              AtStartOfBlock == R.AtStartOfBlock &&
3212              AtStartOfFile == R.AtStartOfFile;
3213     }
3214   };
3215   /// Which empty lines are kept.  See ``MaxEmptyLinesToKeep`` for how many
3216   /// consecutive empty lines are kept.
3217   /// \version 19
3218   KeepEmptyLinesStyle KeepEmptyLines;
3219 
3220   /// This option is **deprecated**. See ``AtEndOfFile`` of ``KeepEmptyLines``.
3221   /// \version 17
3222   // bool KeepEmptyLinesAtEOF;
3223 
3224   /// This option is **deprecated**. See ``AtStartOfBlock`` of
3225   /// ``KeepEmptyLines``.
3226   /// \version 3.7
3227   // bool KeepEmptyLinesAtTheStartOfBlocks;
3228 
3229   /// Keep the form feed character if it's immediately preceded and followed by
3230   /// a newline. Multiple form feeds and newlines within a whitespace range are
3231   /// replaced with a single newline and form feed followed by the remaining
3232   /// newlines.
3233   /// \version 20
3234   bool KeepFormFeed;
3235 
3236   /// Indentation logic for lambda bodies.
3237   enum LambdaBodyIndentationKind : int8_t {
3238     /// Align lambda body relative to the lambda signature. This is the default.
3239     /// \code
3240     ///    someMethod(
3241     ///        [](SomeReallyLongLambdaSignatureArgument foo) {
3242     ///          return;
3243     ///        });
3244     /// \endcode
3245     LBI_Signature,
3246     /// For statements within block scope, align lambda body relative to the
3247     /// indentation level of the outer scope the lambda signature resides in.
3248     /// \code
3249     ///    someMethod(
3250     ///        [](SomeReallyLongLambdaSignatureArgument foo) {
3251     ///      return;
3252     ///    });
3253     ///
3254     ///    someMethod(someOtherMethod(
3255     ///        [](SomeReallyLongLambdaSignatureArgument foo) {
3256     ///      return;
3257     ///    }));
3258     /// \endcode
3259     LBI_OuterScope,
3260   };
3261 
3262   /// The indentation style of lambda bodies. ``Signature`` (the default)
3263   /// causes the lambda body to be indented one additional level relative to
3264   /// the indentation level of the signature. ``OuterScope`` forces the lambda
3265   /// body to be indented one additional level relative to the parent scope
3266   /// containing the lambda signature.
3267   /// \version 13
3268   LambdaBodyIndentationKind LambdaBodyIndentation;
3269 
3270   /// Supported languages.
3271   ///
3272   /// When stored in a configuration file, specifies the language, that the
3273   /// configuration targets. When passed to the ``reformat()`` function, enables
3274   /// syntax features specific to the language.
3275   enum LanguageKind : int8_t {
3276     /// Do not use.
3277     LK_None,
3278     /// Should be used for C.
3279     LK_C,
3280     /// Should be used for C++.
3281     LK_Cpp,
3282     /// Should be used for C#.
3283     LK_CSharp,
3284     /// Should be used for Java.
3285     LK_Java,
3286     /// Should be used for JavaScript.
3287     LK_JavaScript,
3288     /// Should be used for JSON.
3289     LK_Json,
3290     /// Should be used for Objective-C, Objective-C++.
3291     LK_ObjC,
3292     /// Should be used for Protocol Buffers
3293     /// (https://developers.google.com/protocol-buffers/).
3294     LK_Proto,
3295     /// Should be used for TableGen code.
3296     LK_TableGen,
3297     /// Should be used for Protocol Buffer messages in text format
3298     /// (https://developers.google.com/protocol-buffers/).
3299     LK_TextProto,
3300     /// Should be used for Verilog and SystemVerilog.
3301     /// https://standards.ieee.org/ieee/1800/6700/
3302     /// https://sci-hub.st/10.1109/IEEESTD.2018.8299595
3303     LK_Verilog
3304   };
3305   bool isCpp() const {
3306     return Language == LK_Cpp || Language == LK_C || Language == LK_ObjC;
3307   }
3308   bool isCSharp() const { return Language == LK_CSharp; }
3309   bool isJson() const { return Language == LK_Json; }
3310   bool isJavaScript() const { return Language == LK_JavaScript; }
3311   bool isVerilog() const { return Language == LK_Verilog; }
3312   bool isProto() const {
3313     return Language == LK_Proto || Language == LK_TextProto;
3314   }
3315   bool isTableGen() const { return Language == LK_TableGen; }
3316 
3317   /// The language that this format style targets.
3318   /// \note
3319   ///  You can specify the language (``C``, ``Cpp``, or ``ObjC``) for ``.h``
3320   ///  files by adding a ``// clang-format Language:`` line before the first
3321   ///  non-comment (and non-empty) line, e.g. ``// clang-format Language: Cpp``.
3322   /// \endnote
3323   /// \version 3.5
3324   LanguageKind Language;
3325 
3326   /// Line ending style.
3327   enum LineEndingStyle : int8_t {
3328     /// Use ``\n``.
3329     LE_LF,
3330     /// Use ``\r\n``.
3331     LE_CRLF,
3332     /// Use ``\n`` unless the input has more lines ending in ``\r\n``.
3333     LE_DeriveLF,
3334     /// Use ``\r\n`` unless the input has more lines ending in ``\n``.
3335     LE_DeriveCRLF,
3336   };
3337 
3338   /// Line ending style (``\n`` or ``\r\n``) to use.
3339   /// \version 16
3340   LineEndingStyle LineEnding;
3341 
3342   /// A regular expression matching macros that start a block.
3343   /// \code
3344   ///    # With:
3345   ///    MacroBlockBegin: "^NS_MAP_BEGIN|\
3346   ///    NS_TABLE_HEAD$"
3347   ///    MacroBlockEnd: "^\
3348   ///    NS_MAP_END|\
3349   ///    NS_TABLE_.*_END$"
3350   ///
3351   ///    NS_MAP_BEGIN
3352   ///      foo();
3353   ///    NS_MAP_END
3354   ///
3355   ///    NS_TABLE_HEAD
3356   ///      bar();
3357   ///    NS_TABLE_FOO_END
3358   ///
3359   ///    # Without:
3360   ///    NS_MAP_BEGIN
3361   ///    foo();
3362   ///    NS_MAP_END
3363   ///
3364   ///    NS_TABLE_HEAD
3365   ///    bar();
3366   ///    NS_TABLE_FOO_END
3367   /// \endcode
3368   /// \version 3.7
3369   std::string MacroBlockBegin;
3370 
3371   /// A regular expression matching macros that end a block.
3372   /// \version 3.7
3373   std::string MacroBlockEnd;
3374 
3375   /// A list of macros of the form \c <definition>=<expansion> .
3376   ///
3377   /// Code will be parsed with macros expanded, in order to determine how to
3378   /// interpret and format the macro arguments.
3379   ///
3380   /// For example, the code:
3381   /// \code
3382   ///   A(a*b);
3383   /// \endcode
3384   ///
3385   /// will usually be interpreted as a call to a function A, and the
3386   /// multiplication expression will be formatted as ``a * b``.
3387   ///
3388   /// If we specify the macro definition:
3389   /// \code{.yaml}
3390   ///   Macros:
3391   ///   - A(x)=x
3392   /// \endcode
3393   ///
3394   /// the code will now be parsed as a declaration of the variable b of type a*,
3395   /// and formatted as ``a* b`` (depending on pointer-binding rules).
3396   ///
3397   /// Features and restrictions:
3398   ///  * Both function-like macros and object-like macros are supported.
3399   ///  * Macro arguments must be used exactly once in the expansion.
3400   ///  * No recursive expansion; macros referencing other macros will be
3401   ///    ignored.
3402   ///  * Overloading by arity is supported: for example, given the macro
3403   ///    definitions A=x, A()=y, A(a)=a
3404   ///
3405   /// \code
3406   ///    A; -> x;
3407   ///    A(); -> y;
3408   ///    A(z); -> z;
3409   ///    A(a, b); // will not be expanded.
3410   /// \endcode
3411   ///
3412   /// \version 17
3413   std::vector<std::string> Macros;
3414 
3415   /// The maximum number of consecutive empty lines to keep.
3416   /// \code
3417   ///    MaxEmptyLinesToKeep: 1         vs.     MaxEmptyLinesToKeep: 0
3418   ///    int f() {                              int f() {
3419   ///      int = 1;                                 int i = 1;
3420   ///                                               i = foo();
3421   ///      i = foo();                               return i;
3422   ///                                           }
3423   ///      return i;
3424   ///    }
3425   /// \endcode
3426   /// \version 3.7
3427   unsigned MaxEmptyLinesToKeep;
3428 
3429   /// Different ways to indent namespace contents.
3430   enum NamespaceIndentationKind : int8_t {
3431     /// Don't indent in namespaces.
3432     /// \code
3433     ///    namespace out {
3434     ///    int i;
3435     ///    namespace in {
3436     ///    int i;
3437     ///    }
3438     ///    }
3439     /// \endcode
3440     NI_None,
3441     /// Indent only in inner namespaces (nested in other namespaces).
3442     /// \code
3443     ///    namespace out {
3444     ///    int i;
3445     ///    namespace in {
3446     ///      int i;
3447     ///    }
3448     ///    }
3449     /// \endcode
3450     NI_Inner,
3451     /// Indent in all namespaces.
3452     /// \code
3453     ///    namespace out {
3454     ///      int i;
3455     ///      namespace in {
3456     ///        int i;
3457     ///      }
3458     ///    }
3459     /// \endcode
3460     NI_All
3461   };
3462 
3463   /// The indentation used for namespaces.
3464   /// \version 3.7
3465   NamespaceIndentationKind NamespaceIndentation;
3466 
3467   /// A vector of macros which are used to open namespace blocks.
3468   ///
3469   /// These are expected to be macros of the form:
3470   /// \code
3471   ///   NAMESPACE(<namespace-name>, ...) {
3472   ///     <namespace-content>
3473   ///   }
3474   /// \endcode
3475   ///
3476   /// For example: TESTSUITE
3477   /// \version 9
3478   std::vector<std::string> NamespaceMacros;
3479 
3480   /// Controls bin-packing Objective-C protocol conformance list
3481   /// items into as few lines as possible when they go over ``ColumnLimit``.
3482   ///
3483   /// If ``Auto`` (the default), delegates to the value in
3484   /// ``BinPackParameters``. If that is ``BinPack``, bin-packs Objective-C
3485   /// protocol conformance list items into as few lines as possible
3486   /// whenever they go over ``ColumnLimit``.
3487   ///
3488   /// If ``Always``, always bin-packs Objective-C protocol conformance
3489   /// list items into as few lines as possible whenever they go over
3490   /// ``ColumnLimit``.
3491   ///
3492   /// If ``Never``, lays out Objective-C protocol conformance list items
3493   /// onto individual lines whenever they go over ``ColumnLimit``.
3494   ///
3495   /// \code{.objc}
3496   ///    Always (or Auto, if BinPackParameters==BinPack):
3497   ///    @interface ccccccccccccc () <
3498   ///        ccccccccccccc, ccccccccccccc,
3499   ///        ccccccccccccc, ccccccccccccc> {
3500   ///    }
3501   ///
3502   ///    Never (or Auto, if BinPackParameters!=BinPack):
3503   ///    @interface ddddddddddddd () <
3504   ///        ddddddddddddd,
3505   ///        ddddddddddddd,
3506   ///        ddddddddddddd,
3507   ///        ddddddddddddd> {
3508   ///    }
3509   /// \endcode
3510   /// \version 7
3511   BinPackStyle ObjCBinPackProtocolList;
3512 
3513   /// The number of characters to use for indentation of ObjC blocks.
3514   /// \code{.objc}
3515   ///    ObjCBlockIndentWidth: 4
3516   ///
3517   ///    [operation setCompletionBlock:^{
3518   ///        [self onOperationDone];
3519   ///    }];
3520   /// \endcode
3521   /// \version 3.7
3522   unsigned ObjCBlockIndentWidth;
3523 
3524   /// Break parameters list into lines when there is nested block
3525   /// parameters in a function call.
3526   /// \code
3527   ///   false:
3528   ///    - (void)_aMethod
3529   ///    {
3530   ///        [self.test1 t:self w:self callback:^(typeof(self) self, NSNumber
3531   ///        *u, NSNumber *v) {
3532   ///            u = c;
3533   ///        }]
3534   ///    }
3535   ///    true:
3536   ///    - (void)_aMethod
3537   ///    {
3538   ///       [self.test1 t:self
3539   ///                    w:self
3540   ///           callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
3541   ///                u = c;
3542   ///            }]
3543   ///    }
3544   /// \endcode
3545   /// \version 11
3546   bool ObjCBreakBeforeNestedBlockParam;
3547 
3548   /// The order in which ObjC property attributes should appear.
3549   ///
3550   /// Attributes in code will be sorted in the order specified. Any attributes
3551   /// encountered that are not mentioned in this array will be sorted last, in
3552   /// stable order. Comments between attributes will leave the attributes
3553   /// untouched.
3554   /// \warning
3555   ///  Using this option could lead to incorrect code formatting due to
3556   ///  clang-format's lack of complete semantic information. As such, extra
3557   ///  care should be taken to review code changes made by this option.
3558   /// \endwarning
3559   /// \code{.yaml}
3560   ///   ObjCPropertyAttributeOrder: [
3561   ///       class, direct,
3562   ///       atomic, nonatomic,
3563   ///       assign, retain, strong, copy, weak, unsafe_unretained,
3564   ///       readonly, readwrite, getter, setter,
3565   ///       nullable, nonnull, null_resettable, null_unspecified
3566   ///   ]
3567   /// \endcode
3568   /// \version 18
3569   std::vector<std::string> ObjCPropertyAttributeOrder;
3570 
3571   /// Add a space after ``@property`` in Objective-C, i.e. use
3572   /// ``@property (readonly)`` instead of ``@property(readonly)``.
3573   /// \version 3.7
3574   bool ObjCSpaceAfterProperty;
3575 
3576   /// Add a space in front of an Objective-C protocol list, i.e. use
3577   /// ``Foo <Protocol>`` instead of ``Foo<Protocol>``.
3578   /// \version 3.7
3579   bool ObjCSpaceBeforeProtocolList;
3580 
3581   /// Different ways to try to fit all constructor initializers on a line.
3582   enum PackConstructorInitializersStyle : int8_t {
3583     /// Always put each constructor initializer on its own line.
3584     /// \code
3585     ///    Constructor()
3586     ///        : a(),
3587     ///          b()
3588     /// \endcode
3589     PCIS_Never,
3590     /// Bin-pack constructor initializers.
3591     /// \code
3592     ///    Constructor()
3593     ///        : aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(),
3594     ///          cccccccccccccccccccc()
3595     /// \endcode
3596     PCIS_BinPack,
3597     /// Put all constructor initializers on the current line if they fit.
3598     /// Otherwise, put each one on its own line.
3599     /// \code
3600     ///    Constructor() : a(), b()
3601     ///
3602     ///    Constructor()
3603     ///        : aaaaaaaaaaaaaaaaaaaa(),
3604     ///          bbbbbbbbbbbbbbbbbbbb(),
3605     ///          ddddddddddddd()
3606     /// \endcode
3607     PCIS_CurrentLine,
3608     /// Same as ``PCIS_CurrentLine`` except that if all constructor initializers
3609     /// do not fit on the current line, try to fit them on the next line.
3610     /// \code
3611     ///    Constructor() : a(), b()
3612     ///
3613     ///    Constructor()
3614     ///        : aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(), ddddddddddddd()
3615     ///
3616     ///    Constructor()
3617     ///        : aaaaaaaaaaaaaaaaaaaa(),
3618     ///          bbbbbbbbbbbbbbbbbbbb(),
3619     ///          cccccccccccccccccccc()
3620     /// \endcode
3621     PCIS_NextLine,
3622     /// Put all constructor initializers on the next line if they fit.
3623     /// Otherwise, put each one on its own line.
3624     /// \code
3625     ///    Constructor()
3626     ///        : a(), b()
3627     ///
3628     ///    Constructor()
3629     ///        : aaaaaaaaaaaaaaaaaaaa(), bbbbbbbbbbbbbbbbbbbb(), ddddddddddddd()
3630     ///
3631     ///    Constructor()
3632     ///        : aaaaaaaaaaaaaaaaaaaa(),
3633     ///          bbbbbbbbbbbbbbbbbbbb(),
3634     ///          cccccccccccccccccccc()
3635     /// \endcode
3636     PCIS_NextLineOnly,
3637   };
3638 
3639   /// The pack constructor initializers style to use.
3640   /// \version 14
3641   PackConstructorInitializersStyle PackConstructorInitializers;
3642 
3643   /// The penalty for breaking around an assignment operator.
3644   /// \version 5
3645   unsigned PenaltyBreakAssignment;
3646 
3647   /// The penalty for breaking a function call after ``call(``.
3648   /// \version 3.7
3649   unsigned PenaltyBreakBeforeFirstCallParameter;
3650 
3651   /// The penalty for breaking before a member access operator (``.``, ``->``).
3652   /// \version 20
3653   unsigned PenaltyBreakBeforeMemberAccess;
3654 
3655   /// The penalty for each line break introduced inside a comment.
3656   /// \version 3.7
3657   unsigned PenaltyBreakComment;
3658 
3659   /// The penalty for breaking before the first ``<<``.
3660   /// \version 3.7
3661   unsigned PenaltyBreakFirstLessLess;
3662 
3663   /// The penalty for breaking after ``(``.
3664   /// \version 14
3665   unsigned PenaltyBreakOpenParenthesis;
3666 
3667   /// The penalty for breaking after ``::``.
3668   /// \version 18
3669   unsigned PenaltyBreakScopeResolution;
3670 
3671   /// The penalty for each line break introduced inside a string literal.
3672   /// \version 3.7
3673   unsigned PenaltyBreakString;
3674 
3675   /// The penalty for breaking after template declaration.
3676   /// \version 7
3677   unsigned PenaltyBreakTemplateDeclaration;
3678 
3679   /// The penalty for each character outside of the column limit.
3680   /// \version 3.7
3681   unsigned PenaltyExcessCharacter;
3682 
3683   /// Penalty for each character of whitespace indentation
3684   /// (counted relative to leading non-whitespace column).
3685   /// \version 12
3686   unsigned PenaltyIndentedWhitespace;
3687 
3688   /// Penalty for putting the return type of a function onto its own line.
3689   /// \version 3.7
3690   unsigned PenaltyReturnTypeOnItsOwnLine;
3691 
3692   /// The ``&``, ``&&`` and ``*`` alignment style.
3693   enum PointerAlignmentStyle : int8_t {
3694     /// Align pointer to the left.
3695     /// \code
3696     ///   int* a;
3697     /// \endcode
3698     PAS_Left,
3699     /// Align pointer to the right.
3700     /// \code
3701     ///   int *a;
3702     /// \endcode
3703     PAS_Right,
3704     /// Align pointer in the middle.
3705     /// \code
3706     ///   int * a;
3707     /// \endcode
3708     PAS_Middle
3709   };
3710 
3711   /// Pointer and reference alignment style.
3712   /// \version 3.7
3713   PointerAlignmentStyle PointerAlignment;
3714 
3715   /// The number of columns to use for indentation of preprocessor statements.
3716   /// When set to -1 (default) ``IndentWidth`` is used also for preprocessor
3717   /// statements.
3718   /// \code
3719   ///    PPIndentWidth: 1
3720   ///
3721   ///    #ifdef __linux__
3722   ///    # define FOO
3723   ///    #else
3724   ///    # define BAR
3725   ///    #endif
3726   /// \endcode
3727   /// \version 13
3728   int PPIndentWidth;
3729 
3730   /// Different specifiers and qualifiers alignment styles.
3731   enum QualifierAlignmentStyle : int8_t {
3732     /// Don't change specifiers/qualifiers to either Left or Right alignment
3733     /// (default).
3734     /// \code
3735     ///    int const a;
3736     ///    const int *a;
3737     /// \endcode
3738     QAS_Leave,
3739     /// Change specifiers/qualifiers to be left-aligned.
3740     /// \code
3741     ///    const int a;
3742     ///    const int *a;
3743     /// \endcode
3744     QAS_Left,
3745     /// Change specifiers/qualifiers to be right-aligned.
3746     /// \code
3747     ///    int const a;
3748     ///    int const *a;
3749     /// \endcode
3750     QAS_Right,
3751     /// Change specifiers/qualifiers to be aligned based on ``QualifierOrder``.
3752     /// With:
3753     /// \code{.yaml}
3754     ///   QualifierOrder: [inline, static, type, const]
3755     /// \endcode
3756     ///
3757     /// \code
3758     ///
3759     ///    int const a;
3760     ///    int const *a;
3761     /// \endcode
3762     QAS_Custom
3763   };
3764 
3765   /// Different ways to arrange specifiers and qualifiers (e.g. const/volatile).
3766   /// \warning
3767   ///  Setting ``QualifierAlignment``  to something other than ``Leave``, COULD
3768   ///  lead to incorrect code formatting due to incorrect decisions made due to
3769   ///  clang-formats lack of complete semantic information.
3770   ///  As such extra care should be taken to review code changes made by the use
3771   ///  of this option.
3772   /// \endwarning
3773   /// \version 14
3774   QualifierAlignmentStyle QualifierAlignment;
3775 
3776   /// The order in which the qualifiers appear.
3777   /// The order is an array that can contain any of the following:
3778   ///
3779   ///   * ``const``
3780   ///   * ``inline``
3781   ///   * ``static``
3782   ///   * ``friend``
3783   ///   * ``constexpr``
3784   ///   * ``volatile``
3785   ///   * ``restrict``
3786   ///   * ``type``
3787   ///
3788   /// \note
3789   ///  It must contain ``type``.
3790   /// \endnote
3791   ///
3792   /// Items to the left of ``type`` will be placed to the left of the type and
3793   /// aligned in the order supplied. Items to the right of ``type`` will be
3794   /// placed to the right of the type and aligned in the order supplied.
3795   ///
3796   /// \code{.yaml}
3797   ///   QualifierOrder: [inline, static, type, const, volatile]
3798   /// \endcode
3799   /// \version 14
3800   std::vector<std::string> QualifierOrder;
3801 
3802   /// See documentation of ``RawStringFormats``.
3803   struct RawStringFormat {
3804     /// The language of this raw string.
3805     LanguageKind Language;
3806     /// A list of raw string delimiters that match this language.
3807     std::vector<std::string> Delimiters;
3808     /// A list of enclosing function names that match this language.
3809     std::vector<std::string> EnclosingFunctions;
3810     /// The canonical delimiter for this language.
3811     std::string CanonicalDelimiter;
3812     /// The style name on which this raw string format is based on.
3813     /// If not specified, the raw string format is based on the style that this
3814     /// format is based on.
3815     std::string BasedOnStyle;
3816     bool operator==(const RawStringFormat &Other) const {
3817       return Language == Other.Language && Delimiters == Other.Delimiters &&
3818              EnclosingFunctions == Other.EnclosingFunctions &&
3819              CanonicalDelimiter == Other.CanonicalDelimiter &&
3820              BasedOnStyle == Other.BasedOnStyle;
3821     }
3822   };
3823 
3824   /// Defines hints for detecting supported languages code blocks in raw
3825   /// strings.
3826   ///
3827   /// A raw string with a matching delimiter or a matching enclosing function
3828   /// name will be reformatted assuming the specified language based on the
3829   /// style for that language defined in the .clang-format file. If no style has
3830   /// been defined in the .clang-format file for the specific language, a
3831   /// predefined style given by ``BasedOnStyle`` is used. If ``BasedOnStyle`` is
3832   /// not found, the formatting is based on ``LLVM`` style. A matching delimiter
3833   /// takes precedence over a matching enclosing function name for determining
3834   /// the language of the raw string contents.
3835   ///
3836   /// If a canonical delimiter is specified, occurrences of other delimiters for
3837   /// the same language will be updated to the canonical if possible.
3838   ///
3839   /// There should be at most one specification per language and each delimiter
3840   /// and enclosing function should not occur in multiple specifications.
3841   ///
3842   /// To configure this in the .clang-format file, use:
3843   /// \code{.yaml}
3844   ///   RawStringFormats:
3845   ///     - Language: TextProto
3846   ///         Delimiters:
3847   ///           - pb
3848   ///           - proto
3849   ///         EnclosingFunctions:
3850   ///           - PARSE_TEXT_PROTO
3851   ///         BasedOnStyle: google
3852   ///     - Language: Cpp
3853   ///         Delimiters:
3854   ///           - cc
3855   ///           - cpp
3856   ///         BasedOnStyle: LLVM
3857   ///         CanonicalDelimiter: cc
3858   /// \endcode
3859   /// \version 6
3860   std::vector<RawStringFormat> RawStringFormats;
3861 
3862   /// \brief The ``&`` and ``&&`` alignment style.
3863   enum ReferenceAlignmentStyle : int8_t {
3864     /// Align reference like ``PointerAlignment``.
3865     RAS_Pointer,
3866     /// Align reference to the left.
3867     /// \code
3868     ///   int& a;
3869     /// \endcode
3870     RAS_Left,
3871     /// Align reference to the right.
3872     /// \code
3873     ///   int &a;
3874     /// \endcode
3875     RAS_Right,
3876     /// Align reference in the middle.
3877     /// \code
3878     ///   int & a;
3879     /// \endcode
3880     RAS_Middle
3881   };
3882 
3883   /// \brief Reference alignment style (overrides ``PointerAlignment`` for
3884   /// references).
3885   /// \version 13
3886   ReferenceAlignmentStyle ReferenceAlignment;
3887 
3888   // clang-format off
3889   /// \brief Types of comment reflow style.
3890   enum ReflowCommentsStyle : int8_t {
3891     /// Leave comments untouched.
3892     /// \code
3893     ///    // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3894     ///    /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
3895     ///    /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3896     ///         * and a misaligned second line */
3897     /// \endcode
3898     RCS_Never,
3899     /// Only apply indentation rules, moving comments left or right, without
3900     /// changing formatting inside the comments.
3901     /// \code
3902     ///    // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3903     ///    /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
3904     ///    /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3905     ///     * and a misaligned second line */
3906     /// \endcode
3907     RCS_IndentOnly,
3908     /// Apply indentation rules and reflow long comments into new lines, trying
3909     /// to obey the ``ColumnLimit``.
3910     /// \code
3911     ///    // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3912     ///    // information
3913     ///    /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3914     ///     * information */
3915     ///    /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3916     ///     * information and a misaligned second line */
3917     /// \endcode
3918     RCS_Always
3919   };
3920   // clang-format on
3921 
3922   /// \brief Comment reformatting style.
3923   /// \version 3.8
3924   ReflowCommentsStyle ReflowComments;
3925 
3926   /// Remove optional braces of control statements (``if``, ``else``, ``for``,
3927   /// and ``while``) in C++ according to the LLVM coding style.
3928   /// \warning
3929   ///  This option will be renamed and expanded to support other styles.
3930   /// \endwarning
3931   /// \warning
3932   ///  Setting this option to ``true`` could lead to incorrect code formatting
3933   ///  due to clang-format's lack of complete semantic information. As such,
3934   ///  extra care should be taken to review code changes made by this option.
3935   /// \endwarning
3936   /// \code
3937   ///   false:                                     true:
3938   ///
3939   ///   if (isa<FunctionDecl>(D)) {        vs.     if (isa<FunctionDecl>(D))
3940   ///     handleFunctionDecl(D);                     handleFunctionDecl(D);
3941   ///   } else if (isa<VarDecl>(D)) {              else if (isa<VarDecl>(D))
3942   ///     handleVarDecl(D);                          handleVarDecl(D);
3943   ///   }
3944   ///
3945   ///   if (isa<VarDecl>(D)) {             vs.     if (isa<VarDecl>(D)) {
3946   ///     for (auto *A : D.attrs()) {                for (auto *A : D.attrs())
3947   ///       if (shouldProcessAttr(A)) {                if (shouldProcessAttr(A))
3948   ///         handleAttr(A);                             handleAttr(A);
3949   ///       }                                      }
3950   ///     }
3951   ///   }
3952   ///
3953   ///   if (isa<FunctionDecl>(D)) {        vs.     if (isa<FunctionDecl>(D))
3954   ///     for (auto *A : D.attrs()) {                for (auto *A : D.attrs())
3955   ///       handleAttr(A);                             handleAttr(A);
3956   ///     }
3957   ///   }
3958   ///
3959   ///   if (auto *D = (T)(D)) {            vs.     if (auto *D = (T)(D)) {
3960   ///     if (shouldProcess(D)) {                    if (shouldProcess(D))
3961   ///       handleVarDecl(D);                          handleVarDecl(D);
3962   ///     } else {                                   else
3963   ///       markAsIgnored(D);                          markAsIgnored(D);
3964   ///     }                                        }
3965   ///   }
3966   ///
3967   ///   if (a) {                           vs.     if (a)
3968   ///     b();                                       b();
3969   ///   } else {                                   else if (c)
3970   ///     if (c) {                                   d();
3971   ///       d();                                   else
3972   ///     } else {                                   e();
3973   ///       e();
3974   ///     }
3975   ///   }
3976   /// \endcode
3977   /// \version 14
3978   bool RemoveBracesLLVM;
3979 
3980   /// Remove empty lines within unwrapped lines.
3981   /// \code
3982   ///   false:                            true:
3983   ///
3984   ///   int c                  vs.        int c = a + b;
3985   ///
3986   ///       = a + b;
3987   ///
3988   ///   enum : unsigned        vs.        enum : unsigned {
3989   ///                                       AA = 0,
3990   ///   {                                   BB
3991   ///     AA = 0,                         } myEnum;
3992   ///     BB
3993   ///   } myEnum;
3994   ///
3995   ///   while (                vs.        while (true) {
3996   ///                                     }
3997   ///       true) {
3998   ///   }
3999   /// \endcode
4000   /// \version 20
4001   bool RemoveEmptyLinesInUnwrappedLines;
4002 
4003   /// Types of redundant parentheses to remove.
4004   enum RemoveParenthesesStyle : int8_t {
4005     /// Do not remove parentheses.
4006     /// \code
4007     ///   class __declspec((dllimport)) X {};
4008     ///   co_return (((0)));
4009     ///   return ((a + b) - ((c + d)));
4010     /// \endcode
4011     RPS_Leave,
4012     /// Replace multiple parentheses with single parentheses.
4013     /// \code
4014     ///   class __declspec(dllimport) X {};
4015     ///   co_return (0);
4016     ///   return ((a + b) - (c + d));
4017     /// \endcode
4018     RPS_MultipleParentheses,
4019     /// Also remove parentheses enclosing the expression in a
4020     /// ``return``/``co_return`` statement.
4021     /// \code
4022     ///   class __declspec(dllimport) X {};
4023     ///   co_return 0;
4024     ///   return (a + b) - (c + d);
4025     /// \endcode
4026     RPS_ReturnStatement,
4027   };
4028 
4029   /// Remove redundant parentheses.
4030   /// \warning
4031   ///  Setting this option to any value other than ``Leave`` could lead to
4032   ///  incorrect code formatting due to clang-format's lack of complete semantic
4033   ///  information. As such, extra care should be taken to review code changes
4034   ///  made by this option.
4035   /// \endwarning
4036   /// \version 17
4037   RemoveParenthesesStyle RemoveParentheses;
4038 
4039   /// Remove semicolons after the closing braces of functions and
4040   /// constructors/destructors.
4041   /// \warning
4042   ///  Setting this option to ``true`` could lead to incorrect code formatting
4043   ///  due to clang-format's lack of complete semantic information. As such,
4044   ///  extra care should be taken to review code changes made by this option.
4045   /// \endwarning
4046   /// \code
4047   ///   false:                                     true:
4048   ///
4049   ///   int max(int a, int b) {                    int max(int a, int b) {
4050   ///     return a > b ? a : b;                      return a > b ? a : b;
4051   ///   };                                         }
4052   ///
4053   /// \endcode
4054   /// \version 16
4055   bool RemoveSemicolon;
4056 
4057   /// \brief The possible positions for the requires clause. The
4058   /// ``IndentRequires`` option is only used if the ``requires`` is put on the
4059   /// start of a line.
4060   enum RequiresClausePositionStyle : int8_t {
4061     /// Always put the ``requires`` clause on its own line (possibly followed by
4062     /// a semicolon).
4063     /// \code
4064     ///   template <typename T>
4065     ///     requires C<T>
4066     ///   struct Foo {...
4067     ///
4068     ///   template <typename T>
4069     ///   void bar(T t)
4070     ///     requires C<T>;
4071     ///
4072     ///   template <typename T>
4073     ///     requires C<T>
4074     ///   void bar(T t) {...
4075     ///
4076     ///   template <typename T>
4077     ///   void baz(T t)
4078     ///     requires C<T>
4079     ///   {...
4080     /// \endcode
4081     RCPS_OwnLine,
4082     /// As with ``OwnLine``, except, unless otherwise prohibited, place a
4083     /// following open brace (of a function definition) to follow on the same
4084     /// line.
4085     /// \code
4086     ///   void bar(T t)
4087     ///     requires C<T> {
4088     ///     return;
4089     ///   }
4090     ///
4091     ///   void bar(T t)
4092     ///     requires C<T> {}
4093     ///
4094     ///   template <typename T>
4095     ///     requires C<T>
4096     ///   void baz(T t) {
4097     ///     ...
4098     /// \endcode
4099     RCPS_OwnLineWithBrace,
4100     /// Try to put the clause together with the preceding part of a declaration.
4101     /// For class templates: stick to the template declaration.
4102     /// For function templates: stick to the template declaration.
4103     /// For function declaration followed by a requires clause: stick to the
4104     /// parameter list.
4105     /// \code
4106     ///   template <typename T> requires C<T>
4107     ///   struct Foo {...
4108     ///
4109     ///   template <typename T> requires C<T>
4110     ///   void bar(T t) {...
4111     ///
4112     ///   template <typename T>
4113     ///   void baz(T t) requires C<T>
4114     ///   {...
4115     /// \endcode
4116     RCPS_WithPreceding,
4117     /// Try to put the ``requires`` clause together with the class or function
4118     /// declaration.
4119     /// \code
4120     ///   template <typename T>
4121     ///   requires C<T> struct Foo {...
4122     ///
4123     ///   template <typename T>
4124     ///   requires C<T> void bar(T t) {...
4125     ///
4126     ///   template <typename T>
4127     ///   void baz(T t)
4128     ///   requires C<T> {...
4129     /// \endcode
4130     RCPS_WithFollowing,
4131     /// Try to put everything in the same line if possible. Otherwise normal
4132     /// line breaking rules take over.
4133     /// \code
4134     ///   // Fitting:
4135     ///   template <typename T> requires C<T> struct Foo {...
4136     ///
4137     ///   template <typename T> requires C<T> void bar(T t) {...
4138     ///
4139     ///   template <typename T> void bar(T t) requires C<T> {...
4140     ///
4141     ///   // Not fitting, one possible example:
4142     ///   template <typename LongName>
4143     ///   requires C<LongName>
4144     ///   struct Foo {...
4145     ///
4146     ///   template <typename LongName>
4147     ///   requires C<LongName>
4148     ///   void bar(LongName ln) {
4149     ///
4150     ///   template <typename LongName>
4151     ///   void bar(LongName ln)
4152     ///       requires C<LongName> {
4153     /// \endcode
4154     RCPS_SingleLine,
4155   };
4156 
4157   /// \brief The position of the ``requires`` clause.
4158   /// \version 15
4159   RequiresClausePositionStyle RequiresClausePosition;
4160 
4161   /// Indentation logic for requires expression bodies.
4162   enum RequiresExpressionIndentationKind : int8_t {
4163     /// Align requires expression body relative to the indentation level of the
4164     /// outer scope the requires expression resides in.
4165     /// This is the default.
4166     /// \code
4167     ///    template <typename T>
4168     ///    concept C = requires(T t) {
4169     ///      ...
4170     ///    }
4171     /// \endcode
4172     REI_OuterScope,
4173     /// Align requires expression body relative to the ``requires`` keyword.
4174     /// \code
4175     ///    template <typename T>
4176     ///    concept C = requires(T t) {
4177     ///                  ...
4178     ///                }
4179     /// \endcode
4180     REI_Keyword,
4181   };
4182 
4183   /// The indentation used for requires expression bodies.
4184   /// \version 16
4185   RequiresExpressionIndentationKind RequiresExpressionIndentation;
4186 
4187   /// \brief The style if definition blocks should be separated.
4188   enum SeparateDefinitionStyle : int8_t {
4189     /// Leave definition blocks as they are.
4190     SDS_Leave,
4191     /// Insert an empty line between definition blocks.
4192     SDS_Always,
4193     /// Remove any empty line between definition blocks.
4194     SDS_Never
4195   };
4196 
4197   /// Specifies the use of empty lines to separate definition blocks, including
4198   /// classes, structs, enums, and functions.
4199   /// \code
4200   ///    Never                  v.s.     Always
4201   ///    #include <cstring>              #include <cstring>
4202   ///    struct Foo {
4203   ///      int a, b, c;                  struct Foo {
4204   ///    };                                int a, b, c;
4205   ///    namespace Ns {                  };
4206   ///    class Bar {
4207   ///    public:                         namespace Ns {
4208   ///      struct Foobar {               class Bar {
4209   ///        int a;                      public:
4210   ///        int b;                        struct Foobar {
4211   ///      };                                int a;
4212   ///    private:                            int b;
4213   ///      int t;                          };
4214   ///      int method1() {
4215   ///        // ...                      private:
4216   ///      }                               int t;
4217   ///      enum List {
4218   ///        ITEM1,                        int method1() {
4219   ///        ITEM2                           // ...
4220   ///      };                              }
4221   ///      template<typename T>
4222   ///      int method2(T x) {              enum List {
4223   ///        // ...                          ITEM1,
4224   ///      }                                 ITEM2
4225   ///      int i, j, k;                    };
4226   ///      int method3(int par) {
4227   ///        // ...                        template<typename T>
4228   ///      }                               int method2(T x) {
4229   ///    };                                  // ...
4230   ///    class C {};                       }
4231   ///    }
4232   ///                                      int i, j, k;
4233   ///
4234   ///                                      int method3(int par) {
4235   ///                                        // ...
4236   ///                                      }
4237   ///                                    };
4238   ///
4239   ///                                    class C {};
4240   ///                                    }
4241   /// \endcode
4242   /// \version 14
4243   SeparateDefinitionStyle SeparateDefinitionBlocks;
4244 
4245   /// The maximal number of unwrapped lines that a short namespace spans.
4246   /// Defaults to 1.
4247   ///
4248   /// This determines the maximum length of short namespaces by counting
4249   /// unwrapped lines (i.e. containing neither opening nor closing
4250   /// namespace brace) and makes ``FixNamespaceComments`` omit adding
4251   /// end comments for those.
4252   /// \code
4253   ///    ShortNamespaceLines: 1     vs.     ShortNamespaceLines: 0
4254   ///    namespace a {                      namespace a {
4255   ///      int foo;                           int foo;
4256   ///    }                                  } // namespace a
4257   ///
4258   ///    ShortNamespaceLines: 1     vs.     ShortNamespaceLines: 0
4259   ///    namespace b {                      namespace b {
4260   ///      int foo;                           int foo;
4261   ///      int bar;                           int bar;
4262   ///    } // namespace b                   } // namespace b
4263   /// \endcode
4264   /// \version 13
4265   unsigned ShortNamespaceLines;
4266 
4267   /// Do not format macro definition body.
4268   /// \version 18
4269   bool SkipMacroDefinitionBody;
4270 
4271   /// Include sorting options.
4272   enum SortIncludesOptions : int8_t {
4273     /// Includes are never sorted.
4274     /// \code
4275     ///    #include "B/A.h"
4276     ///    #include "A/B.h"
4277     ///    #include "a/b.h"
4278     ///    #include "A/b.h"
4279     ///    #include "B/a.h"
4280     /// \endcode
4281     SI_Never,
4282     /// Includes are sorted in an ASCIIbetical or case sensitive fashion.
4283     /// \code
4284     ///    #include "A/B.h"
4285     ///    #include "A/b.h"
4286     ///    #include "B/A.h"
4287     ///    #include "B/a.h"
4288     ///    #include "a/b.h"
4289     /// \endcode
4290     SI_CaseSensitive,
4291     /// Includes are sorted in an alphabetical or case insensitive fashion.
4292     /// \code
4293     ///    #include "A/B.h"
4294     ///    #include "A/b.h"
4295     ///    #include "a/b.h"
4296     ///    #include "B/A.h"
4297     ///    #include "B/a.h"
4298     /// \endcode
4299     SI_CaseInsensitive,
4300   };
4301 
4302   /// Controls if and how clang-format will sort ``#includes``.
4303   /// \version 3.8
4304   SortIncludesOptions SortIncludes;
4305 
4306   /// Position for Java Static imports.
4307   enum SortJavaStaticImportOptions : int8_t {
4308     /// Static imports are placed before non-static imports.
4309     /// \code{.java}
4310     ///   import static org.example.function1;
4311     ///
4312     ///   import org.example.ClassA;
4313     /// \endcode
4314     SJSIO_Before,
4315     /// Static imports are placed after non-static imports.
4316     /// \code{.java}
4317     ///   import org.example.ClassA;
4318     ///
4319     ///   import static org.example.function1;
4320     /// \endcode
4321     SJSIO_After,
4322   };
4323 
4324   /// When sorting Java imports, by default static imports are placed before
4325   /// non-static imports. If ``JavaStaticImportAfterImport`` is ``After``,
4326   /// static imports are placed after non-static imports.
4327   /// \version 12
4328   SortJavaStaticImportOptions SortJavaStaticImport;
4329 
4330   /// Using declaration sorting options.
4331   enum SortUsingDeclarationsOptions : int8_t {
4332     /// Using declarations are never sorted.
4333     /// \code
4334     ///    using std::chrono::duration_cast;
4335     ///    using std::move;
4336     ///    using boost::regex;
4337     ///    using boost::regex_constants::icase;
4338     ///    using std::string;
4339     /// \endcode
4340     SUD_Never,
4341     /// Using declarations are sorted in the order defined as follows:
4342     /// Split the strings by ``::`` and discard any initial empty strings. Sort
4343     /// the lists of names lexicographically, and within those groups, names are
4344     /// in case-insensitive lexicographic order.
4345     /// \code
4346     ///    using boost::regex;
4347     ///    using boost::regex_constants::icase;
4348     ///    using std::chrono::duration_cast;
4349     ///    using std::move;
4350     ///    using std::string;
4351     /// \endcode
4352     SUD_Lexicographic,
4353     /// Using declarations are sorted in the order defined as follows:
4354     /// Split the strings by ``::`` and discard any initial empty strings. The
4355     /// last element of each list is a non-namespace name; all others are
4356     /// namespace names. Sort the lists of names lexicographically, where the
4357     /// sort order of individual names is that all non-namespace names come
4358     /// before all namespace names, and within those groups, names are in
4359     /// case-insensitive lexicographic order.
4360     /// \code
4361     ///    using boost::regex;
4362     ///    using boost::regex_constants::icase;
4363     ///    using std::move;
4364     ///    using std::string;
4365     ///    using std::chrono::duration_cast;
4366     /// \endcode
4367     SUD_LexicographicNumeric,
4368   };
4369 
4370   /// Controls if and how clang-format will sort using declarations.
4371   /// \version 5
4372   SortUsingDeclarationsOptions SortUsingDeclarations;
4373 
4374   /// If ``true``, a space is inserted after C style casts.
4375   /// \code
4376   ///    true:                                  false:
4377   ///    (int) i;                       vs.     (int)i;
4378   /// \endcode
4379   /// \version 3.5
4380   bool SpaceAfterCStyleCast;
4381 
4382   /// If ``true``, a space is inserted after the logical not operator (``!``).
4383   /// \code
4384   ///    true:                                  false:
4385   ///    ! someExpression();            vs.     !someExpression();
4386   /// \endcode
4387   /// \version 9
4388   bool SpaceAfterLogicalNot;
4389 
4390   /// If \c true, a space will be inserted after the ``template`` keyword.
4391   /// \code
4392   ///    true:                                  false:
4393   ///    template <int> void foo();     vs.     template<int> void foo();
4394   /// \endcode
4395   /// \version 4
4396   bool SpaceAfterTemplateKeyword;
4397 
4398   /// Different ways to put a space before opening parentheses.
4399   enum SpaceAroundPointerQualifiersStyle : int8_t {
4400     /// Don't ensure spaces around pointer qualifiers and use PointerAlignment
4401     /// instead.
4402     /// \code
4403     ///    PointerAlignment: Left                 PointerAlignment: Right
4404     ///    void* const* x = NULL;         vs.     void *const *x = NULL;
4405     /// \endcode
4406     SAPQ_Default,
4407     /// Ensure that there is a space before pointer qualifiers.
4408     /// \code
4409     ///    PointerAlignment: Left                 PointerAlignment: Right
4410     ///    void* const* x = NULL;         vs.     void * const *x = NULL;
4411     /// \endcode
4412     SAPQ_Before,
4413     /// Ensure that there is a space after pointer qualifiers.
4414     /// \code
4415     ///    PointerAlignment: Left                 PointerAlignment: Right
4416     ///    void* const * x = NULL;         vs.     void *const *x = NULL;
4417     /// \endcode
4418     SAPQ_After,
4419     /// Ensure that there is a space both before and after pointer qualifiers.
4420     /// \code
4421     ///    PointerAlignment: Left                 PointerAlignment: Right
4422     ///    void* const * x = NULL;         vs.     void * const *x = NULL;
4423     /// \endcode
4424     SAPQ_Both,
4425   };
4426 
4427   ///  Defines in which cases to put a space before or after pointer qualifiers
4428   /// \version 12
4429   SpaceAroundPointerQualifiersStyle SpaceAroundPointerQualifiers;
4430 
4431   /// If ``false``, spaces will be removed before assignment operators.
4432   /// \code
4433   ///    true:                                  false:
4434   ///    int a = 5;                     vs.     int a= 5;
4435   ///    a += 42;                               a+= 42;
4436   /// \endcode
4437   /// \version 3.7
4438   bool SpaceBeforeAssignmentOperators;
4439 
4440   /// If ``false``, spaces will be removed before case colon.
4441   /// \code
4442   ///   true:                                   false
4443   ///   switch (x) {                    vs.     switch (x) {
4444   ///     case 1 : break;                         case 1: break;
4445   ///   }                                       }
4446   /// \endcode
4447   /// \version 12
4448   bool SpaceBeforeCaseColon;
4449 
4450   /// If ``true``, a space will be inserted before a C++11 braced list
4451   /// used to initialize an object (after the preceding identifier or type).
4452   /// \code
4453   ///    true:                                  false:
4454   ///    Foo foo { bar };               vs.     Foo foo{ bar };
4455   ///    Foo {};                                Foo{};
4456   ///    vector<int> { 1, 2, 3 };               vector<int>{ 1, 2, 3 };
4457   ///    new int[3] { 1, 2, 3 };                new int[3]{ 1, 2, 3 };
4458   /// \endcode
4459   /// \version 7
4460   bool SpaceBeforeCpp11BracedList;
4461 
4462   /// If ``false``, spaces will be removed before constructor initializer
4463   /// colon.
4464   /// \code
4465   ///    true:                                  false:
4466   ///    Foo::Foo() : a(a) {}                   Foo::Foo(): a(a) {}
4467   /// \endcode
4468   /// \version 7
4469   bool SpaceBeforeCtorInitializerColon;
4470 
4471   /// If ``false``, spaces will be removed before inheritance colon.
4472   /// \code
4473   ///    true:                                  false:
4474   ///    class Foo : Bar {}             vs.     class Foo: Bar {}
4475   /// \endcode
4476   /// \version 7
4477   bool SpaceBeforeInheritanceColon;
4478 
4479   /// If ``true``, a space will be added before a JSON colon. For other
4480   /// languages, e.g. JavaScript, use ``SpacesInContainerLiterals`` instead.
4481   /// \code
4482   ///    true:                                  false:
4483   ///    {                                      {
4484   ///      "key" : "value"              vs.       "key": "value"
4485   ///    }                                      }
4486   /// \endcode
4487   /// \version 17
4488   bool SpaceBeforeJsonColon;
4489 
4490   /// Different ways to put a space before opening parentheses.
4491   enum SpaceBeforeParensStyle : int8_t {
4492     /// This is **deprecated** and replaced by ``Custom`` below, with all
4493     /// ``SpaceBeforeParensOptions`` but ``AfterPlacementOperator`` set to
4494     /// ``false``.
4495     SBPO_Never,
4496     /// Put a space before opening parentheses only after control statement
4497     /// keywords (``for/if/while...``).
4498     /// \code
4499     ///    void f() {
4500     ///      if (true) {
4501     ///        f();
4502     ///      }
4503     ///    }
4504     /// \endcode
4505     SBPO_ControlStatements,
4506     /// Same as ``SBPO_ControlStatements`` except this option doesn't apply to
4507     /// ForEach and If macros. This is useful in projects where ForEach/If
4508     /// macros are treated as function calls instead of control statements.
4509     /// ``SBPO_ControlStatementsExceptForEachMacros`` remains an alias for
4510     /// backward compatibility.
4511     /// \code
4512     ///    void f() {
4513     ///      Q_FOREACH(...) {
4514     ///        f();
4515     ///      }
4516     ///    }
4517     /// \endcode
4518     SBPO_ControlStatementsExceptControlMacros,
4519     /// Put a space before opening parentheses only if the parentheses are not
4520     /// empty.
4521     /// \code
4522     ///   void() {
4523     ///     if (true) {
4524     ///       f();
4525     ///       g (x, y, z);
4526     ///     }
4527     ///   }
4528     /// \endcode
4529     SBPO_NonEmptyParentheses,
4530     /// Always put a space before opening parentheses, except when it's
4531     /// prohibited by the syntax rules (in function-like macro definitions) or
4532     /// when determined by other style rules (after unary operators, opening
4533     /// parentheses, etc.)
4534     /// \code
4535     ///    void f () {
4536     ///      if (true) {
4537     ///        f ();
4538     ///      }
4539     ///    }
4540     /// \endcode
4541     SBPO_Always,
4542     /// Configure each individual space before parentheses in
4543     /// ``SpaceBeforeParensOptions``.
4544     SBPO_Custom,
4545   };
4546 
4547   /// Defines in which cases to put a space before opening parentheses.
4548   /// \version 3.5
4549   SpaceBeforeParensStyle SpaceBeforeParens;
4550 
4551   /// Precise control over the spacing before parentheses.
4552   /// \code
4553   ///   # Should be declared this way:
4554   ///   SpaceBeforeParens: Custom
4555   ///   SpaceBeforeParensOptions:
4556   ///     AfterControlStatements: true
4557   ///     AfterFunctionDefinitionName: true
4558   /// \endcode
4559   struct SpaceBeforeParensCustom {
4560     /// If ``true``, put space between control statement keywords
4561     /// (for/if/while...) and opening parentheses.
4562     /// \code
4563     ///    true:                                  false:
4564     ///    if (...) {}                     vs.    if(...) {}
4565     /// \endcode
4566     bool AfterControlStatements;
4567     /// If ``true``, put space between foreach macros and opening parentheses.
4568     /// \code
4569     ///    true:                                  false:
4570     ///    FOREACH (...)                   vs.    FOREACH(...)
4571     ///      <loop-body>                            <loop-body>
4572     /// \endcode
4573     bool AfterForeachMacros;
4574     /// If ``true``, put a space between function declaration name and opening
4575     /// parentheses.
4576     /// \code
4577     ///    true:                                  false:
4578     ///    void f ();                      vs.    void f();
4579     /// \endcode
4580     bool AfterFunctionDeclarationName;
4581     /// If ``true``, put a space between function definition name and opening
4582     /// parentheses.
4583     /// \code
4584     ///    true:                                  false:
4585     ///    void f () {}                    vs.    void f() {}
4586     /// \endcode
4587     bool AfterFunctionDefinitionName;
4588     /// If ``true``, put space between if macros and opening parentheses.
4589     /// \code
4590     ///    true:                                  false:
4591     ///    IF (...)                        vs.    IF(...)
4592     ///      <conditional-body>                     <conditional-body>
4593     /// \endcode
4594     bool AfterIfMacros;
4595     /// If ``true``, put a space between operator overloading and opening
4596     /// parentheses.
4597     /// \code
4598     ///    true:                                  false:
4599     ///    void operator++ (int a);        vs.    void operator++(int a);
4600     ///    object.operator++ (10);                object.operator++(10);
4601     /// \endcode
4602     bool AfterOverloadedOperator;
4603     /// If ``true``, put a space between operator ``new``/``delete`` and opening
4604     /// parenthesis.
4605     /// \code
4606     ///    true:                                  false:
4607     ///    new (buf) T;                    vs.    new(buf) T;
4608     ///    delete (buf) T;                        delete(buf) T;
4609     /// \endcode
4610     bool AfterPlacementOperator;
4611     /// If ``true``, put space between requires keyword in a requires clause and
4612     /// opening parentheses, if there is one.
4613     /// \code
4614     ///    true:                                  false:
4615     ///    template<typename T>            vs.    template<typename T>
4616     ///    requires (A<T> && B<T>)                requires(A<T> && B<T>)
4617     ///    ...                                    ...
4618     /// \endcode
4619     bool AfterRequiresInClause;
4620     /// If ``true``, put space between requires keyword in a requires expression
4621     /// and opening parentheses.
4622     /// \code
4623     ///    true:                                  false:
4624     ///    template<typename T>            vs.    template<typename T>
4625     ///    concept C = requires (T t) {           concept C = requires(T t) {
4626     ///                  ...                                    ...
4627     ///                }                                      }
4628     /// \endcode
4629     bool AfterRequiresInExpression;
4630     /// If ``true``, put a space before opening parentheses only if the
4631     /// parentheses are not empty.
4632     /// \code
4633     ///    true:                                  false:
4634     ///    void f (int a);                 vs.    void f();
4635     ///    f (a);                                 f();
4636     /// \endcode
4637     bool BeforeNonEmptyParentheses;
4638 
4639     SpaceBeforeParensCustom()
4640         : AfterControlStatements(false), AfterForeachMacros(false),
4641           AfterFunctionDeclarationName(false),
4642           AfterFunctionDefinitionName(false), AfterIfMacros(false),
4643           AfterOverloadedOperator(false), AfterPlacementOperator(true),
4644           AfterRequiresInClause(false), AfterRequiresInExpression(false),
4645           BeforeNonEmptyParentheses(false) {}
4646 
4647     bool operator==(const SpaceBeforeParensCustom &Other) const {
4648       return AfterControlStatements == Other.AfterControlStatements &&
4649              AfterForeachMacros == Other.AfterForeachMacros &&
4650              AfterFunctionDeclarationName ==
4651                  Other.AfterFunctionDeclarationName &&
4652              AfterFunctionDefinitionName == Other.AfterFunctionDefinitionName &&
4653              AfterIfMacros == Other.AfterIfMacros &&
4654              AfterOverloadedOperator == Other.AfterOverloadedOperator &&
4655              AfterPlacementOperator == Other.AfterPlacementOperator &&
4656              AfterRequiresInClause == Other.AfterRequiresInClause &&
4657              AfterRequiresInExpression == Other.AfterRequiresInExpression &&
4658              BeforeNonEmptyParentheses == Other.BeforeNonEmptyParentheses;
4659     }
4660   };
4661 
4662   /// Control of individual space before parentheses.
4663   ///
4664   /// If ``SpaceBeforeParens`` is set to ``Custom``, use this to specify
4665   /// how each individual space before parentheses case should be handled.
4666   /// Otherwise, this is ignored.
4667   /// \code{.yaml}
4668   ///   # Example of usage:
4669   ///   SpaceBeforeParens: Custom
4670   ///   SpaceBeforeParensOptions:
4671   ///     AfterControlStatements: true
4672   ///     AfterFunctionDefinitionName: true
4673   /// \endcode
4674   /// \version 14
4675   SpaceBeforeParensCustom SpaceBeforeParensOptions;
4676 
4677   /// If ``true``, spaces will be before  ``[``.
4678   /// Lambdas will not be affected. Only the first ``[`` will get a space added.
4679   /// \code
4680   ///    true:                                  false:
4681   ///    int a [5];                    vs.      int a[5];
4682   ///    int a [5][5];                 vs.      int a[5][5];
4683   /// \endcode
4684   /// \version 10
4685   bool SpaceBeforeSquareBrackets;
4686 
4687   /// If ``false``, spaces will be removed before range-based for loop
4688   /// colon.
4689   /// \code
4690   ///    true:                                  false:
4691   ///    for (auto v : values) {}       vs.     for(auto v: values) {}
4692   /// \endcode
4693   /// \version 7
4694   bool SpaceBeforeRangeBasedForLoopColon;
4695 
4696   /// If ``true``, spaces will be inserted into ``{}``.
4697   /// \code
4698   ///    true:                                false:
4699   ///    void f() { }                   vs.   void f() {}
4700   ///    while (true) { }                     while (true) {}
4701   /// \endcode
4702   /// \version 10
4703   bool SpaceInEmptyBlock;
4704 
4705   /// If ``true``, spaces may be inserted into ``()``.
4706   /// This option is **deprecated**. See ``InEmptyParentheses`` of
4707   /// ``SpacesInParensOptions``.
4708   /// \version 3.7
4709   // bool SpaceInEmptyParentheses;
4710 
4711   /// The number of spaces before trailing line comments
4712   /// (``//`` - comments).
4713   ///
4714   /// This does not affect trailing block comments (``/*`` - comments) as those
4715   /// commonly have different usage patterns and a number of special cases.  In
4716   /// the case of Verilog, it doesn't affect a comment right after the opening
4717   /// parenthesis in the port or parameter list in a module header, because it
4718   /// is probably for the port on the following line instead of the parenthesis
4719   /// it follows.
4720   /// \code
4721   ///    SpacesBeforeTrailingComments: 3
4722   ///    void f() {
4723   ///      if (true) {   // foo1
4724   ///        f();        // bar
4725   ///      }             // foo
4726   ///    }
4727   /// \endcode
4728   /// \version 3.7
4729   unsigned SpacesBeforeTrailingComments;
4730 
4731   /// Styles for adding spacing after ``<`` and before ``>``
4732   ///  in template argument lists.
4733   enum SpacesInAnglesStyle : int8_t {
4734     /// Remove spaces after ``<`` and before ``>``.
4735     /// \code
4736     ///    static_cast<int>(arg);
4737     ///    std::function<void(int)> fct;
4738     /// \endcode
4739     SIAS_Never,
4740     /// Add spaces after ``<`` and before ``>``.
4741     /// \code
4742     ///    static_cast< int >(arg);
4743     ///    std::function< void(int) > fct;
4744     /// \endcode
4745     SIAS_Always,
4746     /// Keep a single space after ``<`` and before ``>`` if any spaces were
4747     /// present. Option ``Standard: Cpp03`` takes precedence.
4748     SIAS_Leave
4749   };
4750   /// The SpacesInAnglesStyle to use for template argument lists.
4751   /// \version 3.4
4752   SpacesInAnglesStyle SpacesInAngles;
4753 
4754   /// If ``true``, spaces will be inserted around if/for/switch/while
4755   /// conditions.
4756   /// This option is **deprecated**. See ``InConditionalStatements`` of
4757   /// ``SpacesInParensOptions``.
4758   /// \version 10
4759   // bool SpacesInConditionalStatement;
4760 
4761   /// If ``true``, spaces are inserted inside container literals (e.g.  ObjC and
4762   /// Javascript array and dict literals). For JSON, use
4763   /// ``SpaceBeforeJsonColon`` instead.
4764   /// \code{.js}
4765   ///    true:                                  false:
4766   ///    var arr = [ 1, 2, 3 ];         vs.     var arr = [1, 2, 3];
4767   ///    f({a : 1, b : 2, c : 3});              f({a: 1, b: 2, c: 3});
4768   /// \endcode
4769   /// \version 3.7
4770   bool SpacesInContainerLiterals;
4771 
4772   /// If ``true``, spaces may be inserted into C style casts.
4773   /// This option is **deprecated**. See ``InCStyleCasts`` of
4774   /// ``SpacesInParensOptions``.
4775   /// \version 3.7
4776   // bool SpacesInCStyleCastParentheses;
4777 
4778   /// Control of spaces within a single line comment.
4779   struct SpacesInLineComment {
4780     /// The minimum number of spaces at the start of the comment.
4781     unsigned Minimum;
4782     /// The maximum number of spaces at the start of the comment.
4783     unsigned Maximum;
4784   };
4785 
4786   /// How many spaces are allowed at the start of a line comment. To disable the
4787   /// maximum set it to ``-1``, apart from that the maximum takes precedence
4788   /// over the minimum.
4789   /// \code
4790   ///   Minimum = 1
4791   ///   Maximum = -1
4792   ///   // One space is forced
4793   ///
4794   ///   //  but more spaces are possible
4795   ///
4796   ///   Minimum = 0
4797   ///   Maximum = 0
4798   ///   //Forces to start every comment directly after the slashes
4799   /// \endcode
4800   ///
4801   /// Note that in line comment sections the relative indent of the subsequent
4802   /// lines is kept, that means the following:
4803   /// \code
4804   ///   before:                                   after:
4805   ///   Minimum: 1
4806   ///   //if (b) {                                // if (b) {
4807   ///   //  return true;                          //   return true;
4808   ///   //}                                       // }
4809   ///
4810   ///   Maximum: 0
4811   ///   /// List:                                 ///List:
4812   ///   ///  - Foo                                /// - Foo
4813   ///   ///    - Bar                              ///   - Bar
4814   /// \endcode
4815   ///
4816   /// This option has only effect if ``ReflowComments`` is set to ``true``.
4817   /// \version 13
4818   SpacesInLineComment SpacesInLineCommentPrefix;
4819 
4820   /// Different ways to put a space before opening and closing parentheses.
4821   enum SpacesInParensStyle : int8_t {
4822     /// Never put a space in parentheses.
4823     /// \code
4824     ///    void f() {
4825     ///      if(true) {
4826     ///        f();
4827     ///      }
4828     ///    }
4829     /// \endcode
4830     SIPO_Never,
4831     /// Configure each individual space in parentheses in
4832     /// `SpacesInParensOptions`.
4833     SIPO_Custom,
4834   };
4835 
4836   /// If ``true``, spaces will be inserted after ``(`` and before ``)``.
4837   /// This option is **deprecated**. The previous behavior is preserved by using
4838   /// ``SpacesInParens`` with ``Custom`` and by setting all
4839   /// ``SpacesInParensOptions`` to ``true`` except for ``InCStyleCasts`` and
4840   /// ``InEmptyParentheses``.
4841   /// \version 3.7
4842   // bool SpacesInParentheses;
4843 
4844   /// Defines in which cases spaces will be inserted after ``(`` and before
4845   /// ``)``.
4846   /// \version 17
4847   SpacesInParensStyle SpacesInParens;
4848 
4849   /// Precise control over the spacing in parentheses.
4850   /// \code
4851   ///   # Should be declared this way:
4852   ///   SpacesInParens: Custom
4853   ///   SpacesInParensOptions:
4854   ///     ExceptDoubleParentheses: false
4855   ///     InConditionalStatements: true
4856   ///     Other: true
4857   /// \endcode
4858   struct SpacesInParensCustom {
4859     /// Override any of the following options to prevent addition of space
4860     /// when both opening and closing parentheses use multiple parentheses.
4861     /// \code
4862     ///   true:
4863     ///   __attribute__(( noreturn ))
4864     ///   __decltype__(( x ))
4865     ///   if (( a = b ))
4866     /// \endcode
4867     ///  false:
4868     ///    Uses the applicable option.
4869     bool ExceptDoubleParentheses;
4870     /// Put a space in parentheses only inside conditional statements
4871     /// (``for/if/while/switch...``).
4872     /// \code
4873     ///    true:                                  false:
4874     ///    if ( a )  { ... }              vs.     if (a) { ... }
4875     ///    while ( i < 5 )  { ... }               while (i < 5) { ... }
4876     /// \endcode
4877     bool InConditionalStatements;
4878     /// Put a space in C style casts.
4879     /// \code
4880     ///   true:                                  false:
4881     ///   x = ( int32 )y                  vs.    x = (int32)y
4882     ///   y = (( int (*)(int) )foo)(x);          y = ((int (*)(int))foo)(x);
4883     /// \endcode
4884     bool InCStyleCasts;
4885     /// Insert a space in empty parentheses, i.e. ``()``.
4886     /// \code
4887     ///    true:                                false:
4888     ///    void f( ) {                    vs.   void f() {
4889     ///      int x[] = {foo( ), bar( )};          int x[] = {foo(), bar()};
4890     ///      if (true) {                          if (true) {
4891     ///        f( );                                f();
4892     ///      }                                    }
4893     ///    }                                    }
4894     /// \endcode
4895     bool InEmptyParentheses;
4896     /// Put a space in parentheses not covered by preceding options.
4897     /// \code
4898     ///   true:                                 false:
4899     ///   t f( Deleted & ) & = delete;    vs.   t f(Deleted &) & = delete;
4900     /// \endcode
4901     bool Other;
4902 
4903     SpacesInParensCustom()
4904         : ExceptDoubleParentheses(false), InConditionalStatements(false),
4905           InCStyleCasts(false), InEmptyParentheses(false), Other(false) {}
4906 
4907     SpacesInParensCustom(bool ExceptDoubleParentheses,
4908                          bool InConditionalStatements, bool InCStyleCasts,
4909                          bool InEmptyParentheses, bool Other)
4910         : ExceptDoubleParentheses(ExceptDoubleParentheses),
4911           InConditionalStatements(InConditionalStatements),
4912           InCStyleCasts(InCStyleCasts), InEmptyParentheses(InEmptyParentheses),
4913           Other(Other) {}
4914 
4915     bool operator==(const SpacesInParensCustom &R) const {
4916       return ExceptDoubleParentheses == R.ExceptDoubleParentheses &&
4917              InConditionalStatements == R.InConditionalStatements &&
4918              InCStyleCasts == R.InCStyleCasts &&
4919              InEmptyParentheses == R.InEmptyParentheses && Other == R.Other;
4920     }
4921     bool operator!=(const SpacesInParensCustom &R) const {
4922       return !(*this == R);
4923     }
4924   };
4925 
4926   /// Control of individual spaces in parentheses.
4927   ///
4928   /// If ``SpacesInParens`` is set to ``Custom``, use this to specify
4929   /// how each individual space in parentheses case should be handled.
4930   /// Otherwise, this is ignored.
4931   /// \code{.yaml}
4932   ///   # Example of usage:
4933   ///   SpacesInParens: Custom
4934   ///   SpacesInParensOptions:
4935   ///     ExceptDoubleParentheses: false
4936   ///     InConditionalStatements: true
4937   ///     InEmptyParentheses: true
4938   /// \endcode
4939   /// \version 17
4940   SpacesInParensCustom SpacesInParensOptions;
4941 
4942   /// If ``true``, spaces will be inserted after ``[`` and before ``]``.
4943   /// Lambdas without arguments or unspecified size array declarations will not
4944   /// be affected.
4945   /// \code
4946   ///    true:                                  false:
4947   ///    int a[ 5 ];                    vs.     int a[5];
4948   ///    std::unique_ptr<int[]> foo() {} // Won't be affected
4949   /// \endcode
4950   /// \version 3.7
4951   bool SpacesInSquareBrackets;
4952 
4953   /// Supported language standards for parsing and formatting C++ constructs.
4954   /// \code
4955   ///    Latest:                                vector<set<int>>
4956   ///    c++03                          vs.     vector<set<int> >
4957   /// \endcode
4958   ///
4959   /// The correct way to spell a specific language version is e.g. ``c++11``.
4960   /// The historical aliases ``Cpp03`` and ``Cpp11`` are deprecated.
4961   enum LanguageStandard : int8_t {
4962     /// Parse and format as C++03.
4963     /// ``Cpp03`` is a deprecated alias for ``c++03``
4964     LS_Cpp03, // c++03
4965     /// Parse and format as C++11.
4966     LS_Cpp11, // c++11
4967     /// Parse and format as C++14.
4968     LS_Cpp14, // c++14
4969     /// Parse and format as C++17.
4970     LS_Cpp17, // c++17
4971     /// Parse and format as C++20.
4972     LS_Cpp20, // c++20
4973     /// Parse and format using the latest supported language version.
4974     /// ``Cpp11`` is a deprecated alias for ``Latest``
4975     LS_Latest,
4976     /// Automatic detection based on the input.
4977     LS_Auto,
4978   };
4979 
4980   /// Parse and format C++ constructs compatible with this standard.
4981   /// \code
4982   ///    c++03:                                 latest:
4983   ///    vector<set<int> > x;           vs.     vector<set<int>> x;
4984   /// \endcode
4985   /// \version 3.7
4986   LanguageStandard Standard;
4987 
4988   /// Macros which are ignored in front of a statement, as if they were an
4989   /// attribute. So that they are not parsed as identifier, for example for Qts
4990   /// emit.
4991   /// \code
4992   ///   AlignConsecutiveDeclarations: true
4993   ///   StatementAttributeLikeMacros: []
4994   ///   unsigned char data = 'x';
4995   ///   emit          signal(data); // This is parsed as variable declaration.
4996   ///
4997   ///   AlignConsecutiveDeclarations: true
4998   ///   StatementAttributeLikeMacros: [emit]
4999   ///   unsigned char data = 'x';
5000   ///   emit signal(data); // Now it's fine again.
5001   /// \endcode
5002   /// \version 12
5003   std::vector<std::string> StatementAttributeLikeMacros;
5004 
5005   /// A vector of macros that should be interpreted as complete statements.
5006   ///
5007   /// Typical macros are expressions and require a semicolon to be added.
5008   /// Sometimes this is not the case, and this allows to make clang-format aware
5009   /// of such cases.
5010   ///
5011   /// For example: Q_UNUSED
5012   /// \version 8
5013   std::vector<std::string> StatementMacros;
5014 
5015   /// Works only when TableGenBreakInsideDAGArg is not DontBreak.
5016   /// The string list needs to consist of identifiers in TableGen.
5017   /// If any identifier is specified, this limits the line breaks by
5018   /// TableGenBreakInsideDAGArg option only on DAGArg values beginning with
5019   /// the specified identifiers.
5020   ///
5021   /// For example the configuration,
5022   /// \code{.yaml}
5023   ///   TableGenBreakInsideDAGArg: BreakAll
5024   ///   TableGenBreakingDAGArgOperators: [ins, outs]
5025   /// \endcode
5026   ///
5027   /// makes the line break only occurs inside DAGArgs beginning with the
5028   /// specified identifiers ``ins`` and ``outs``.
5029   ///
5030   /// \code
5031   ///   let DAGArgIns = (ins
5032   ///       i32:$src1,
5033   ///       i32:$src2
5034   ///   );
5035   ///   let DAGArgOtherID = (other i32:$other1, i32:$other2);
5036   ///   let DAGArgBang = (!cast<SomeType>("Some") i32:$src1, i32:$src2)
5037   /// \endcode
5038   /// \version 19
5039   std::vector<std::string> TableGenBreakingDAGArgOperators;
5040 
5041   /// Different ways to control the format inside TableGen DAGArg.
5042   enum DAGArgStyle : int8_t {
5043     /// Never break inside DAGArg.
5044     /// \code
5045     ///   let DAGArgIns = (ins i32:$src1, i32:$src2);
5046     /// \endcode
5047     DAS_DontBreak,
5048     /// Break inside DAGArg after each list element but for the last.
5049     /// This aligns to the first element.
5050     /// \code
5051     ///   let DAGArgIns = (ins i32:$src1,
5052     ///                        i32:$src2);
5053     /// \endcode
5054     DAS_BreakElements,
5055     /// Break inside DAGArg after the operator and the all elements.
5056     /// \code
5057     ///   let DAGArgIns = (ins
5058     ///       i32:$src1,
5059     ///       i32:$src2
5060     ///   );
5061     /// \endcode
5062     DAS_BreakAll,
5063   };
5064 
5065   /// The styles of the line break inside the DAGArg in TableGen.
5066   /// \version 19
5067   DAGArgStyle TableGenBreakInsideDAGArg;
5068 
5069   /// The number of columns used for tab stops.
5070   /// \version 3.7
5071   unsigned TabWidth;
5072 
5073   /// A vector of non-keyword identifiers that should be interpreted as template
5074   /// names.
5075   ///
5076   /// A ``<`` after a template name is annotated as a template opener instead of
5077   /// a binary operator.
5078   ///
5079   /// \version 20
5080   std::vector<std::string> TemplateNames;
5081 
5082   /// A vector of non-keyword identifiers that should be interpreted as type
5083   /// names.
5084   ///
5085   /// A ``*``, ``&``, or ``&&`` between a type name and another non-keyword
5086   /// identifier is annotated as a pointer or reference token instead of a
5087   /// binary operator.
5088   ///
5089   /// \version 17
5090   std::vector<std::string> TypeNames;
5091 
5092   /// \brief A vector of macros that should be interpreted as type declarations
5093   /// instead of as function calls.
5094   ///
5095   /// These are expected to be macros of the form:
5096   /// \code
5097   ///   STACK_OF(...)
5098   /// \endcode
5099   ///
5100   /// In the .clang-format configuration file, this can be configured like:
5101   /// \code{.yaml}
5102   ///   TypenameMacros: [STACK_OF, LIST]
5103   /// \endcode
5104   ///
5105   /// For example: OpenSSL STACK_OF, BSD LIST_ENTRY.
5106   /// \version 9
5107   std::vector<std::string> TypenameMacros;
5108 
5109   /// This option is **deprecated**. See ``LF`` and ``CRLF`` of ``LineEnding``.
5110   /// \version 10
5111   // bool UseCRLF;
5112 
5113   /// Different ways to use tab in formatting.
5114   enum UseTabStyle : int8_t {
5115     /// Never use tab.
5116     UT_Never,
5117     /// Use tabs only for indentation.
5118     UT_ForIndentation,
5119     /// Fill all leading whitespace with tabs, and use spaces for alignment that
5120     /// appears within a line (e.g. consecutive assignments and declarations).
5121     UT_ForContinuationAndIndentation,
5122     /// Use tabs for line continuation and indentation, and spaces for
5123     /// alignment.
5124     UT_AlignWithSpaces,
5125     /// Use tabs whenever we need to fill whitespace that spans at least from
5126     /// one tab stop to the next one.
5127     UT_Always
5128   };
5129 
5130   /// The way to use tab characters in the resulting file.
5131   /// \version 3.7
5132   UseTabStyle UseTab;
5133 
5134   /// A vector of non-keyword identifiers that should be interpreted as variable
5135   /// template names.
5136   ///
5137   /// A ``)`` after a variable template instantiation is **not** annotated as
5138   /// the closing parenthesis of C-style cast operator.
5139   ///
5140   /// \version 20
5141   std::vector<std::string> VariableTemplates;
5142 
5143   /// For Verilog, put each port on its own line in module instantiations.
5144   /// \code
5145   ///    true:
5146   ///    ffnand ff1(.q(),
5147   ///               .qbar(out1),
5148   ///               .clear(in1),
5149   ///               .preset(in2));
5150   ///
5151   ///    false:
5152   ///    ffnand ff1(.q(), .qbar(out1), .clear(in1), .preset(in2));
5153   /// \endcode
5154   /// \version 17
5155   bool VerilogBreakBetweenInstancePorts;
5156 
5157   /// A vector of macros which are whitespace-sensitive and should not
5158   /// be touched.
5159   ///
5160   /// These are expected to be macros of the form:
5161   /// \code
5162   ///   STRINGIZE(...)
5163   /// \endcode
5164   ///
5165   /// In the .clang-format configuration file, this can be configured like:
5166   /// \code{.yaml}
5167   ///   WhitespaceSensitiveMacros: [STRINGIZE, PP_STRINGIZE]
5168   /// \endcode
5169   ///
5170   /// For example: BOOST_PP_STRINGIZE
5171   /// \version 11
5172   std::vector<std::string> WhitespaceSensitiveMacros;
5173 
5174   /// Different styles for wrapping namespace body with empty lines.
5175   enum WrapNamespaceBodyWithEmptyLinesStyle : int8_t {
5176     /// Remove all empty lines at the beginning and the end of namespace body.
5177     /// \code
5178     ///   namespace N1 {
5179     ///   namespace N2
5180     ///   function();
5181     ///   }
5182     ///   }
5183     /// \endcode
5184     WNBWELS_Never,
5185     /// Always have at least one empty line at the beginning and the end of
5186     /// namespace body except that the number of empty lines between consecutive
5187     /// nested namespace definitions is not increased.
5188     /// \code
5189     ///   namespace N1 {
5190     ///   namespace N2 {
5191     ///
5192     ///   function();
5193     ///
5194     ///   }
5195     ///   }
5196     /// \endcode
5197     WNBWELS_Always,
5198     /// Keep existing newlines at the beginning and the end of namespace body.
5199     /// ``MaxEmptyLinesToKeep`` still applies.
5200     WNBWELS_Leave
5201   };
5202 
5203   /// Wrap namespace body with empty lines.
5204   /// \version 20
5205   WrapNamespaceBodyWithEmptyLinesStyle WrapNamespaceBodyWithEmptyLines;
5206 
5207   bool operator==(const FormatStyle &R) const {
5208     return AccessModifierOffset == R.AccessModifierOffset &&
5209            AlignAfterOpenBracket == R.AlignAfterOpenBracket &&
5210            AlignArrayOfStructures == R.AlignArrayOfStructures &&
5211            AlignConsecutiveAssignments == R.AlignConsecutiveAssignments &&
5212            AlignConsecutiveBitFields == R.AlignConsecutiveBitFields &&
5213            AlignConsecutiveDeclarations == R.AlignConsecutiveDeclarations &&
5214            AlignConsecutiveMacros == R.AlignConsecutiveMacros &&
5215            AlignConsecutiveShortCaseStatements ==
5216                R.AlignConsecutiveShortCaseStatements &&
5217            AlignConsecutiveTableGenBreakingDAGArgColons ==
5218                R.AlignConsecutiveTableGenBreakingDAGArgColons &&
5219            AlignConsecutiveTableGenCondOperatorColons ==
5220                R.AlignConsecutiveTableGenCondOperatorColons &&
5221            AlignConsecutiveTableGenDefinitionColons ==
5222                R.AlignConsecutiveTableGenDefinitionColons &&
5223            AlignEscapedNewlines == R.AlignEscapedNewlines &&
5224            AlignOperands == R.AlignOperands &&
5225            AlignTrailingComments == R.AlignTrailingComments &&
5226            AllowAllArgumentsOnNextLine == R.AllowAllArgumentsOnNextLine &&
5227            AllowAllParametersOfDeclarationOnNextLine ==
5228                R.AllowAllParametersOfDeclarationOnNextLine &&
5229            AllowBreakBeforeNoexceptSpecifier ==
5230                R.AllowBreakBeforeNoexceptSpecifier &&
5231            AllowShortBlocksOnASingleLine == R.AllowShortBlocksOnASingleLine &&
5232            AllowShortCaseExpressionOnASingleLine ==
5233                R.AllowShortCaseExpressionOnASingleLine &&
5234            AllowShortCaseLabelsOnASingleLine ==
5235                R.AllowShortCaseLabelsOnASingleLine &&
5236            AllowShortCompoundRequirementOnASingleLine ==
5237                R.AllowShortCompoundRequirementOnASingleLine &&
5238            AllowShortEnumsOnASingleLine == R.AllowShortEnumsOnASingleLine &&
5239            AllowShortFunctionsOnASingleLine ==
5240                R.AllowShortFunctionsOnASingleLine &&
5241            AllowShortIfStatementsOnASingleLine ==
5242                R.AllowShortIfStatementsOnASingleLine &&
5243            AllowShortLambdasOnASingleLine == R.AllowShortLambdasOnASingleLine &&
5244            AllowShortLoopsOnASingleLine == R.AllowShortLoopsOnASingleLine &&
5245            AllowShortNamespacesOnASingleLine ==
5246                R.AllowShortNamespacesOnASingleLine &&
5247            AlwaysBreakBeforeMultilineStrings ==
5248                R.AlwaysBreakBeforeMultilineStrings &&
5249            AttributeMacros == R.AttributeMacros &&
5250            BinPackArguments == R.BinPackArguments &&
5251            BinPackParameters == R.BinPackParameters &&
5252            BitFieldColonSpacing == R.BitFieldColonSpacing &&
5253            BracedInitializerIndentWidth == R.BracedInitializerIndentWidth &&
5254            BreakAdjacentStringLiterals == R.BreakAdjacentStringLiterals &&
5255            BreakAfterAttributes == R.BreakAfterAttributes &&
5256            BreakAfterJavaFieldAnnotations == R.BreakAfterJavaFieldAnnotations &&
5257            BreakAfterReturnType == R.BreakAfterReturnType &&
5258            BreakArrays == R.BreakArrays &&
5259            BreakBeforeBinaryOperators == R.BreakBeforeBinaryOperators &&
5260            BreakBeforeBraces == R.BreakBeforeBraces &&
5261            BreakBeforeConceptDeclarations == R.BreakBeforeConceptDeclarations &&
5262            BreakBeforeInlineASMColon == R.BreakBeforeInlineASMColon &&
5263            BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators &&
5264            BreakBinaryOperations == R.BreakBinaryOperations &&
5265            BreakConstructorInitializers == R.BreakConstructorInitializers &&
5266            BreakFunctionDefinitionParameters ==
5267                R.BreakFunctionDefinitionParameters &&
5268            BreakInheritanceList == R.BreakInheritanceList &&
5269            BreakStringLiterals == R.BreakStringLiterals &&
5270            BreakTemplateDeclarations == R.BreakTemplateDeclarations &&
5271            ColumnLimit == R.ColumnLimit && CommentPragmas == R.CommentPragmas &&
5272            CompactNamespaces == R.CompactNamespaces &&
5273            ConstructorInitializerIndentWidth ==
5274                R.ConstructorInitializerIndentWidth &&
5275            ContinuationIndentWidth == R.ContinuationIndentWidth &&
5276            Cpp11BracedListStyle == R.Cpp11BracedListStyle &&
5277            DerivePointerAlignment == R.DerivePointerAlignment &&
5278            DisableFormat == R.DisableFormat &&
5279            EmptyLineAfterAccessModifier == R.EmptyLineAfterAccessModifier &&
5280            EmptyLineBeforeAccessModifier == R.EmptyLineBeforeAccessModifier &&
5281            ExperimentalAutoDetectBinPacking ==
5282                R.ExperimentalAutoDetectBinPacking &&
5283            FixNamespaceComments == R.FixNamespaceComments &&
5284            ForEachMacros == R.ForEachMacros &&
5285            IncludeStyle.IncludeBlocks == R.IncludeStyle.IncludeBlocks &&
5286            IncludeStyle.IncludeCategories == R.IncludeStyle.IncludeCategories &&
5287            IncludeStyle.IncludeIsMainRegex ==
5288                R.IncludeStyle.IncludeIsMainRegex &&
5289            IncludeStyle.IncludeIsMainSourceRegex ==
5290                R.IncludeStyle.IncludeIsMainSourceRegex &&
5291            IncludeStyle.MainIncludeChar == R.IncludeStyle.MainIncludeChar &&
5292            IndentAccessModifiers == R.IndentAccessModifiers &&
5293            IndentCaseBlocks == R.IndentCaseBlocks &&
5294            IndentCaseLabels == R.IndentCaseLabels &&
5295            IndentExportBlock == R.IndentExportBlock &&
5296            IndentExternBlock == R.IndentExternBlock &&
5297            IndentGotoLabels == R.IndentGotoLabels &&
5298            IndentPPDirectives == R.IndentPPDirectives &&
5299            IndentRequiresClause == R.IndentRequiresClause &&
5300            IndentWidth == R.IndentWidth &&
5301            IndentWrappedFunctionNames == R.IndentWrappedFunctionNames &&
5302            InsertBraces == R.InsertBraces &&
5303            InsertNewlineAtEOF == R.InsertNewlineAtEOF &&
5304            IntegerLiteralSeparator == R.IntegerLiteralSeparator &&
5305            JavaImportGroups == R.JavaImportGroups &&
5306            JavaScriptQuotes == R.JavaScriptQuotes &&
5307            JavaScriptWrapImports == R.JavaScriptWrapImports &&
5308            KeepEmptyLines == R.KeepEmptyLines &&
5309            KeepFormFeed == R.KeepFormFeed && Language == R.Language &&
5310            LambdaBodyIndentation == R.LambdaBodyIndentation &&
5311            LineEnding == R.LineEnding && MacroBlockBegin == R.MacroBlockBegin &&
5312            MacroBlockEnd == R.MacroBlockEnd && Macros == R.Macros &&
5313            MaxEmptyLinesToKeep == R.MaxEmptyLinesToKeep &&
5314            NamespaceIndentation == R.NamespaceIndentation &&
5315            NamespaceMacros == R.NamespaceMacros &&
5316            ObjCBinPackProtocolList == R.ObjCBinPackProtocolList &&
5317            ObjCBlockIndentWidth == R.ObjCBlockIndentWidth &&
5318            ObjCBreakBeforeNestedBlockParam ==
5319                R.ObjCBreakBeforeNestedBlockParam &&
5320            ObjCPropertyAttributeOrder == R.ObjCPropertyAttributeOrder &&
5321            ObjCSpaceAfterProperty == R.ObjCSpaceAfterProperty &&
5322            ObjCSpaceBeforeProtocolList == R.ObjCSpaceBeforeProtocolList &&
5323            PackConstructorInitializers == R.PackConstructorInitializers &&
5324            PenaltyBreakAssignment == R.PenaltyBreakAssignment &&
5325            PenaltyBreakBeforeFirstCallParameter ==
5326                R.PenaltyBreakBeforeFirstCallParameter &&
5327            PenaltyBreakBeforeMemberAccess == R.PenaltyBreakBeforeMemberAccess &&
5328            PenaltyBreakComment == R.PenaltyBreakComment &&
5329            PenaltyBreakFirstLessLess == R.PenaltyBreakFirstLessLess &&
5330            PenaltyBreakOpenParenthesis == R.PenaltyBreakOpenParenthesis &&
5331            PenaltyBreakScopeResolution == R.PenaltyBreakScopeResolution &&
5332            PenaltyBreakString == R.PenaltyBreakString &&
5333            PenaltyBreakTemplateDeclaration ==
5334                R.PenaltyBreakTemplateDeclaration &&
5335            PenaltyExcessCharacter == R.PenaltyExcessCharacter &&
5336            PenaltyReturnTypeOnItsOwnLine == R.PenaltyReturnTypeOnItsOwnLine &&
5337            PointerAlignment == R.PointerAlignment &&
5338            QualifierAlignment == R.QualifierAlignment &&
5339            QualifierOrder == R.QualifierOrder &&
5340            RawStringFormats == R.RawStringFormats &&
5341            ReferenceAlignment == R.ReferenceAlignment &&
5342            RemoveBracesLLVM == R.RemoveBracesLLVM &&
5343            RemoveEmptyLinesInUnwrappedLines ==
5344                R.RemoveEmptyLinesInUnwrappedLines &&
5345            RemoveParentheses == R.RemoveParentheses &&
5346            RemoveSemicolon == R.RemoveSemicolon &&
5347            RequiresClausePosition == R.RequiresClausePosition &&
5348            RequiresExpressionIndentation == R.RequiresExpressionIndentation &&
5349            SeparateDefinitionBlocks == R.SeparateDefinitionBlocks &&
5350            ShortNamespaceLines == R.ShortNamespaceLines &&
5351            SkipMacroDefinitionBody == R.SkipMacroDefinitionBody &&
5352            SortIncludes == R.SortIncludes &&
5353            SortJavaStaticImport == R.SortJavaStaticImport &&
5354            SpaceAfterCStyleCast == R.SpaceAfterCStyleCast &&
5355            SpaceAfterLogicalNot == R.SpaceAfterLogicalNot &&
5356            SpaceAfterTemplateKeyword == R.SpaceAfterTemplateKeyword &&
5357            SpaceBeforeAssignmentOperators == R.SpaceBeforeAssignmentOperators &&
5358            SpaceBeforeCaseColon == R.SpaceBeforeCaseColon &&
5359            SpaceBeforeCpp11BracedList == R.SpaceBeforeCpp11BracedList &&
5360            SpaceBeforeCtorInitializerColon ==
5361                R.SpaceBeforeCtorInitializerColon &&
5362            SpaceBeforeInheritanceColon == R.SpaceBeforeInheritanceColon &&
5363            SpaceBeforeJsonColon == R.SpaceBeforeJsonColon &&
5364            SpaceBeforeParens == R.SpaceBeforeParens &&
5365            SpaceBeforeParensOptions == R.SpaceBeforeParensOptions &&
5366            SpaceAroundPointerQualifiers == R.SpaceAroundPointerQualifiers &&
5367            SpaceBeforeRangeBasedForLoopColon ==
5368                R.SpaceBeforeRangeBasedForLoopColon &&
5369            SpaceBeforeSquareBrackets == R.SpaceBeforeSquareBrackets &&
5370            SpaceInEmptyBlock == R.SpaceInEmptyBlock &&
5371            SpacesBeforeTrailingComments == R.SpacesBeforeTrailingComments &&
5372            SpacesInAngles == R.SpacesInAngles &&
5373            SpacesInContainerLiterals == R.SpacesInContainerLiterals &&
5374            SpacesInLineCommentPrefix.Minimum ==
5375                R.SpacesInLineCommentPrefix.Minimum &&
5376            SpacesInLineCommentPrefix.Maximum ==
5377                R.SpacesInLineCommentPrefix.Maximum &&
5378            SpacesInParens == R.SpacesInParens &&
5379            SpacesInParensOptions == R.SpacesInParensOptions &&
5380            SpacesInSquareBrackets == R.SpacesInSquareBrackets &&
5381            Standard == R.Standard &&
5382            StatementAttributeLikeMacros == R.StatementAttributeLikeMacros &&
5383            StatementMacros == R.StatementMacros &&
5384            TableGenBreakingDAGArgOperators ==
5385                R.TableGenBreakingDAGArgOperators &&
5386            TableGenBreakInsideDAGArg == R.TableGenBreakInsideDAGArg &&
5387            TabWidth == R.TabWidth && TemplateNames == R.TemplateNames &&
5388            TypeNames == R.TypeNames && TypenameMacros == R.TypenameMacros &&
5389            UseTab == R.UseTab && VariableTemplates == R.VariableTemplates &&
5390            VerilogBreakBetweenInstancePorts ==
5391                R.VerilogBreakBetweenInstancePorts &&
5392            WhitespaceSensitiveMacros == R.WhitespaceSensitiveMacros &&
5393            WrapNamespaceBodyWithEmptyLines == R.WrapNamespaceBodyWithEmptyLines;
5394   }
5395 
5396   std::optional<FormatStyle> GetLanguageStyle(LanguageKind Language) const;
5397 
5398   // Stores per-language styles. A FormatStyle instance inside has an empty
5399   // StyleSet. A FormatStyle instance returned by the Get method has its
5400   // StyleSet set to a copy of the originating StyleSet, effectively keeping the
5401   // internal representation of that StyleSet alive.
5402   //
5403   // The memory management and ownership reminds of a birds nest: chicks
5404   // leaving the nest take photos of the nest with them.
5405   struct FormatStyleSet {
5406     typedef std::map<FormatStyle::LanguageKind, FormatStyle> MapType;
5407 
5408     std::optional<FormatStyle> Get(FormatStyle::LanguageKind Language) const;
5409 
5410     // Adds \p Style to this FormatStyleSet. Style must not have an associated
5411     // FormatStyleSet.
5412     // Style.Language should be different than LK_None. If this FormatStyleSet
5413     // already contains an entry for Style.Language, that gets replaced with the
5414     // passed Style.
5415     void Add(FormatStyle Style);
5416 
5417     // Clears this FormatStyleSet.
5418     void Clear();
5419 
5420   private:
5421     std::shared_ptr<MapType> Styles;
5422   };
5423 
5424   static FormatStyleSet BuildStyleSetFromConfiguration(
5425       const FormatStyle &MainStyle,
5426       const std::vector<FormatStyle> &ConfigurationStyles);
5427 
5428 private:
5429   FormatStyleSet StyleSet;
5430 
5431   friend std::error_code
5432   parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style,
5433                      bool AllowUnknownOptions,
5434                      llvm::SourceMgr::DiagHandlerTy DiagHandler,
5435                      void *DiagHandlerCtxt);
5436 };
5437 
5438 /// Returns a format style complying with the LLVM coding standards:
5439 /// http://llvm.org/docs/CodingStandards.html.
5440 FormatStyle getLLVMStyle(
5441     FormatStyle::LanguageKind Language = FormatStyle::LanguageKind::LK_Cpp);
5442 
5443 /// Returns a format style complying with one of Google's style guides:
5444 /// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml.
5445 /// http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml.
5446 /// https://developers.google.com/protocol-buffers/docs/style.
5447 FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language);
5448 
5449 /// Returns a format style complying with Chromium's style guide:
5450 /// http://www.chromium.org/developers/coding-style.
5451 FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language);
5452 
5453 /// Returns a format style complying with Mozilla's style guide:
5454 /// https://firefox-source-docs.mozilla.org/code-quality/coding-style/index.html.
5455 FormatStyle getMozillaStyle();
5456 
5457 /// Returns a format style complying with Webkit's style guide:
5458 /// http://www.webkit.org/coding/coding-style.html
5459 FormatStyle getWebKitStyle();
5460 
5461 /// Returns a format style complying with GNU Coding Standards:
5462 /// http://www.gnu.org/prep/standards/standards.html
5463 FormatStyle getGNUStyle();
5464 
5465 /// Returns a format style complying with Microsoft style guide:
5466 /// https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017
5467 FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language);
5468 
5469 FormatStyle getClangFormatStyle();
5470 
5471 /// Returns style indicating formatting should be not applied at all.
5472 FormatStyle getNoStyle();
5473 
5474 /// Gets a predefined style for the specified language by name.
5475 ///
5476 /// Currently supported names: LLVM, Google, Chromium, Mozilla. Names are
5477 /// compared case-insensitively.
5478 ///
5479 /// Returns ``true`` if the Style has been set.
5480 bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language,
5481                         FormatStyle *Style);
5482 
5483 /// Parse configuration from YAML-formatted text.
5484 ///
5485 /// Style->Language is used to get the base style, if the ``BasedOnStyle``
5486 /// option is present.
5487 ///
5488 /// The FormatStyleSet of Style is reset.
5489 ///
5490 /// When ``BasedOnStyle`` is not present, options not present in the YAML
5491 /// document, are retained in \p Style.
5492 ///
5493 /// If AllowUnknownOptions is true, no errors are emitted if unknown
5494 /// format options are occurred.
5495 ///
5496 /// If set all diagnostics are emitted through the DiagHandler.
5497 std::error_code
5498 parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style,
5499                    bool AllowUnknownOptions = false,
5500                    llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr,
5501                    void *DiagHandlerCtx = nullptr);
5502 
5503 /// Like above but accepts an unnamed buffer.
5504 inline std::error_code parseConfiguration(StringRef Config, FormatStyle *Style,
5505                                           bool AllowUnknownOptions = false) {
5506   return parseConfiguration(llvm::MemoryBufferRef(Config, "YAML"), Style,
5507                             AllowUnknownOptions);
5508 }
5509 
5510 /// Gets configuration in a YAML string.
5511 std::string configurationAsText(const FormatStyle &Style);
5512 
5513 /// Returns the replacements necessary to sort all ``#include`` blocks
5514 /// that are affected by ``Ranges``.
5515 tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
5516                                    ArrayRef<tooling::Range> Ranges,
5517                                    StringRef FileName,
5518                                    unsigned *Cursor = nullptr);
5519 
5520 /// Returns the replacements corresponding to applying and formatting
5521 /// \p Replaces on success; otheriwse, return an llvm::Error carrying
5522 /// llvm::StringError.
5523 Expected<tooling::Replacements>
5524 formatReplacements(StringRef Code, const tooling::Replacements &Replaces,
5525                    const FormatStyle &Style);
5526 
5527 /// Returns the replacements corresponding to applying \p Replaces and
5528 /// cleaning up the code after that on success; otherwise, return an llvm::Error
5529 /// carrying llvm::StringError.
5530 /// This also supports inserting/deleting C++ #include directives:
5531 /// * If a replacement has offset UINT_MAX, length 0, and a replacement text
5532 ///   that is an #include directive, this will insert the #include into the
5533 ///   correct block in the \p Code.
5534 /// * If a replacement has offset UINT_MAX, length 1, and a replacement text
5535 ///   that is the name of the header to be removed, the header will be removed
5536 ///   from \p Code if it exists.
5537 /// The include manipulation is done via ``tooling::HeaderInclude``, see its
5538 /// documentation for more details on how include insertion points are found and
5539 /// what edits are produced.
5540 Expected<tooling::Replacements>
5541 cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces,
5542                           const FormatStyle &Style);
5543 
5544 /// Represents the status of a formatting attempt.
5545 struct FormattingAttemptStatus {
5546   /// A value of ``false`` means that any of the affected ranges were not
5547   /// formatted due to a non-recoverable syntax error.
5548   bool FormatComplete = true;
5549 
5550   /// If ``FormatComplete`` is false, ``Line`` records a one-based
5551   /// original line number at which a syntax error might have occurred. This is
5552   /// based on a best-effort analysis and could be imprecise.
5553   unsigned Line = 0;
5554 };
5555 
5556 /// Reformats the given \p Ranges in \p Code.
5557 ///
5558 /// Each range is extended on either end to its next bigger logic unit, i.e.
5559 /// everything that might influence its formatting or might be influenced by its
5560 /// formatting.
5561 ///
5562 /// Returns the ``Replacements`` necessary to make all \p Ranges comply with
5563 /// \p Style.
5564 ///
5565 /// If ``Status`` is non-null, its value will be populated with the status of
5566 /// this formatting attempt. See \c FormattingAttemptStatus.
5567 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
5568                                ArrayRef<tooling::Range> Ranges,
5569                                StringRef FileName = "<stdin>",
5570                                FormattingAttemptStatus *Status = nullptr);
5571 
5572 /// Same as above, except if ``IncompleteFormat`` is non-null, its value
5573 /// will be set to true if any of the affected ranges were not formatted due to
5574 /// a non-recoverable syntax error.
5575 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
5576                                ArrayRef<tooling::Range> Ranges,
5577                                StringRef FileName, bool *IncompleteFormat);
5578 
5579 /// Clean up any erroneous/redundant code in the given \p Ranges in \p
5580 /// Code.
5581 ///
5582 /// Returns the ``Replacements`` that clean up all \p Ranges in \p Code.
5583 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code,
5584                               ArrayRef<tooling::Range> Ranges,
5585                               StringRef FileName = "<stdin>");
5586 
5587 /// Fix namespace end comments in the given \p Ranges in \p Code.
5588 ///
5589 /// Returns the ``Replacements`` that fix the namespace comments in all
5590 /// \p Ranges in \p Code.
5591 tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style,
5592                                               StringRef Code,
5593                                               ArrayRef<tooling::Range> Ranges,
5594                                               StringRef FileName = "<stdin>");
5595 
5596 /// Inserts or removes empty lines separating definition blocks including
5597 /// classes, structs, functions, namespaces, and enums in the given \p Ranges in
5598 /// \p Code.
5599 ///
5600 /// Returns the ``Replacements`` that inserts or removes empty lines separating
5601 /// definition blocks in all \p Ranges in \p Code.
5602 tooling::Replacements separateDefinitionBlocks(const FormatStyle &Style,
5603                                                StringRef Code,
5604                                                ArrayRef<tooling::Range> Ranges,
5605                                                StringRef FileName = "<stdin>");
5606 
5607 /// Sort consecutive using declarations in the given \p Ranges in
5608 /// \p Code.
5609 ///
5610 /// Returns the ``Replacements`` that sort the using declarations in all
5611 /// \p Ranges in \p Code.
5612 tooling::Replacements sortUsingDeclarations(const FormatStyle &Style,
5613                                             StringRef Code,
5614                                             ArrayRef<tooling::Range> Ranges,
5615                                             StringRef FileName = "<stdin>");
5616 
5617 /// Returns the ``LangOpts`` that the formatter expects you to set.
5618 ///
5619 /// \param Style determines specific settings for lexing mode.
5620 LangOptions getFormattingLangOpts(const FormatStyle &Style = getLLVMStyle());
5621 
5622 /// Description to be used for help text for a ``llvm::cl`` option for
5623 /// specifying format style. The description is closely related to the operation
5624 /// of ``getStyle()``.
5625 extern const char *StyleOptionHelpDescription;
5626 
5627 /// The suggested format style to use by default. This allows tools using
5628 /// ``getStyle`` to have a consistent default style.
5629 /// Different builds can modify the value to the preferred styles.
5630 extern const char *DefaultFormatStyle;
5631 
5632 /// The suggested predefined style to use as the fallback style in ``getStyle``.
5633 /// Different builds can modify the value to the preferred styles.
5634 extern const char *DefaultFallbackStyle;
5635 
5636 /// Construct a FormatStyle based on ``StyleName``.
5637 ///
5638 /// ``StyleName`` can take several forms:
5639 /// * "{<key>: <value>, ...}" - Set specic style parameters.
5640 /// * "<style name>" - One of the style names supported by getPredefinedStyle().
5641 /// * "file" - Load style configuration from a file called ``.clang-format``
5642 ///   located in one of the parent directories of ``FileName`` or the current
5643 ///   directory if ``FileName`` is empty.
5644 /// * "file:<format_file_path>" to explicitly specify the configuration file to
5645 ///   use.
5646 ///
5647 /// \param[in] StyleName Style name to interpret according to the description
5648 /// above.
5649 /// \param[in] FileName Path to start search for .clang-format if ``StyleName``
5650 /// == "file".
5651 /// \param[in] FallbackStyle The name of a predefined style used to fallback to
5652 /// in case \p StyleName is "file" and no file can be found.
5653 /// \param[in] Code The actual code to be formatted. Used to determine the
5654 /// language if the filename isn't sufficient.
5655 /// \param[in] FS The underlying file system, in which the file resides. By
5656 /// default, the file system is the real file system.
5657 /// \param[in] AllowUnknownOptions If true, unknown format options only
5658 ///             emit a warning. If false, errors are emitted on unknown format
5659 ///             options.
5660 ///
5661 /// \returns FormatStyle as specified by ``StyleName``. If ``StyleName`` is
5662 /// "file" and no file is found, returns ``FallbackStyle``. If no style could be
5663 /// determined, returns an Error.
5664 Expected<FormatStyle>
5665 getStyle(StringRef StyleName, StringRef FileName, StringRef FallbackStyle,
5666          StringRef Code = "", llvm::vfs::FileSystem *FS = nullptr,
5667          bool AllowUnknownOptions = false,
5668          llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr);
5669 
5670 // Guesses the language from the ``FileName`` and ``Code`` to be formatted.
5671 // Defaults to FormatStyle::LK_Cpp.
5672 FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code);
5673 
5674 // Returns a string representation of ``Language``.
5675 inline StringRef getLanguageName(FormatStyle::LanguageKind Language) {
5676   switch (Language) {
5677   case FormatStyle::LK_C:
5678     return "C";
5679   case FormatStyle::LK_Cpp:
5680     return "C++";
5681   case FormatStyle::LK_CSharp:
5682     return "CSharp";
5683   case FormatStyle::LK_ObjC:
5684     return "Objective-C";
5685   case FormatStyle::LK_Java:
5686     return "Java";
5687   case FormatStyle::LK_JavaScript:
5688     return "JavaScript";
5689   case FormatStyle::LK_Json:
5690     return "Json";
5691   case FormatStyle::LK_Proto:
5692     return "Proto";
5693   case FormatStyle::LK_TableGen:
5694     return "TableGen";
5695   case FormatStyle::LK_TextProto:
5696     return "TextProto";
5697   case FormatStyle::LK_Verilog:
5698     return "Verilog";
5699   default:
5700     return "Unknown";
5701   }
5702 }
5703 
5704 bool isClangFormatOn(StringRef Comment);
5705 bool isClangFormatOff(StringRef Comment);
5706 
5707 } // end namespace format
5708 } // end namespace clang
5709 
5710 template <>
5711 struct std::is_error_code_enum<clang::format::ParseError> : std::true_type {};
5712 
5713 #endif // LLVM_CLANG_FORMAT_FORMAT_H