diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -136,8 +136,9 @@ enumeration member (with a prefix, e.g. ``LS_Auto``), and as a value usable in the configuration (without a prefix: ``Auto``). +.. _BasedOnStyle: -**BasedOnStyle** (``String``) +**BasedOnStyle** (``String``) :ref:`¶ ` The style used for all options not specifically set in the configuration. This option is supported only in the :program:`clang-format` configuration @@ -178,10 +179,14 @@ .. START_FORMAT_STYLE_OPTIONS -**AccessModifierOffset** (``Integer``) :versionbadge:`clang-format 3.3` +.. _AccessModifierOffset: + +**AccessModifierOffset** (``Integer``) :versionbadge:`clang-format 3.3` :ref:`¶ ` The extra indent or outdent of access modifiers, e.g. ``public:``. -**AlignAfterOpenBracket** (``BracketAlignmentStyle``) :versionbadge:`clang-format 3.8` +.. _AlignAfterOpenBracket: + +**AlignAfterOpenBracket** (``BracketAlignmentStyle``) :versionbadge:`clang-format 3.8` :ref:`¶ ` If ``true``, horizontally aligns arguments after an open bracket. This applies to round brackets (parentheses), angle brackets and square @@ -232,7 +237,9 @@ -**AlignArrayOfStructures** (``ArrayInitializerAlignmentStyle``) :versionbadge:`clang-format 13` +.. _AlignArrayOfStructures: + +**AlignArrayOfStructures** (``ArrayInitializerAlignmentStyle``) :versionbadge:`clang-format 13` :ref:`¶ ` if not ``None``, when using initialization for an array of structs aligns the fields into columns. @@ -270,7 +277,9 @@ -**AlignConsecutiveAssignments** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 3.8` +.. _AlignConsecutiveAssignments: + +**AlignConsecutiveAssignments** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 3.8` :ref:`¶ ` Style of aligning consecutive assignments. ``Consecutive`` will result in formattings like: @@ -392,7 +401,9 @@ bbb >>= 2; -**AlignConsecutiveBitFields** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 11` +.. _AlignConsecutiveBitFields: + +**AlignConsecutiveBitFields** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 11` :ref:`¶ ` Style of aligning consecutive bit fields. ``Consecutive`` will align the bitfield separators of consecutive lines. @@ -515,7 +526,9 @@ bbb >>= 2; -**AlignConsecutiveDeclarations** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 3.8` +.. _AlignConsecutiveDeclarations: + +**AlignConsecutiveDeclarations** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 3.8` :ref:`¶ ` Style of aligning consecutive declarations. ``Consecutive`` will align the declaration names of consecutive lines. @@ -638,7 +651,9 @@ bbb >>= 2; -**AlignConsecutiveMacros** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 9` +.. _AlignConsecutiveMacros: + +**AlignConsecutiveMacros** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 9` :ref:`¶ ` Style of aligning consecutive macro definitions. ``Consecutive`` will result in formattings like: @@ -762,7 +777,9 @@ bbb >>= 2; -**AlignEscapedNewlines** (``EscapedNewlineAlignmentStyle``) :versionbadge:`clang-format 5` +.. _AlignEscapedNewlines: + +**AlignEscapedNewlines** (``EscapedNewlineAlignmentStyle``) :versionbadge:`clang-format 5` :ref:`¶ ` Options for aligning backslashes in escaped newlines. Possible values: @@ -802,7 +819,9 @@ -**AlignOperands** (``OperandAlignmentStyle``) :versionbadge:`clang-format 3.5` +.. _AlignOperands: + +**AlignOperands** (``OperandAlignmentStyle``) :versionbadge:`clang-format 3.5` :ref:`¶ ` If ``true``, horizontally align operands of binary and ternary expressions. @@ -846,7 +865,9 @@ -**AlignTrailingComments** (``TrailingCommentsAlignmentStyle``) :versionbadge:`clang-format 3.7` +.. _AlignTrailingComments: + +**AlignTrailingComments** (``TrailingCommentsAlignmentStyle``) :versionbadge:`clang-format 3.7` :ref:`¶ ` Control of trailing comments. NOTE: As of clang-format 16 this option is not a bool but can be set @@ -929,7 +950,9 @@ int abcdef; // but this isn't -**AllowAllArgumentsOnNextLine** (``Boolean``) :versionbadge:`clang-format 9` +.. _AllowAllArgumentsOnNextLine: + +**AllowAllArgumentsOnNextLine** (``Boolean``) :versionbadge:`clang-format 9` :ref:`¶ ` If a function call or braced initializer list doesn't fit on a line, allow putting all arguments onto the next line, even if ``BinPackArguments`` is ``false``. @@ -946,11 +969,15 @@ c, d); -**AllowAllConstructorInitializersOnNextLine** (``Boolean``) :versionbadge:`clang-format 9` +.. _AllowAllConstructorInitializersOnNextLine: + +**AllowAllConstructorInitializersOnNextLine** (``Boolean``) :versionbadge:`clang-format 9` :ref:`¶ ` This option is **deprecated**. See ``NextLine`` of ``PackConstructorInitializers``. -**AllowAllParametersOfDeclarationOnNextLine** (``Boolean``) :versionbadge:`clang-format 3.3` +.. _AllowAllParametersOfDeclarationOnNextLine: + +**AllowAllParametersOfDeclarationOnNextLine** (``Boolean``) :versionbadge:`clang-format 3.3` :ref:`¶ ` If the function declaration doesn't fit on a line, allow putting all parameters of a function declaration onto the next line even if ``BinPackParameters`` is ``false``. @@ -968,7 +995,9 @@ int d, int e); -**AllowShortBlocksOnASingleLine** (``ShortBlockStyle``) :versionbadge:`clang-format 3.5` +.. _AllowShortBlocksOnASingleLine: + +**AllowShortBlocksOnASingleLine** (``ShortBlockStyle``) :versionbadge:`clang-format 3.5` :ref:`¶ ` Dependent on the value, ``while (true) { continue; }`` can be put on a single line. @@ -1005,7 +1034,9 @@ -**AllowShortCaseLabelsOnASingleLine** (``Boolean``) :versionbadge:`clang-format 3.6` +.. _AllowShortCaseLabelsOnASingleLine: + +**AllowShortCaseLabelsOnASingleLine** (``Boolean``) :versionbadge:`clang-format 3.6` :ref:`¶ ` If ``true``, short case labels will be contracted to a single line. .. code-block:: c++ @@ -1019,7 +1050,9 @@ return; } -**AllowShortEnumsOnASingleLine** (``Boolean``) :versionbadge:`clang-format 11` +.. _AllowShortEnumsOnASingleLine: + +**AllowShortEnumsOnASingleLine** (``Boolean``) :versionbadge:`clang-format 11` :ref:`¶ ` Allow short enums on a single line. .. code-block:: c++ @@ -1033,7 +1066,9 @@ B } myEnum; -**AllowShortFunctionsOnASingleLine** (``ShortFunctionStyle``) :versionbadge:`clang-format 3.5` +.. _AllowShortFunctionsOnASingleLine: + +**AllowShortFunctionsOnASingleLine** (``ShortFunctionStyle``) :versionbadge:`clang-format 3.5` :ref:`¶ ` Dependent on the value, ``int f() { return 0; }`` can be put on a single line. @@ -1093,7 +1128,9 @@ -**AllowShortIfStatementsOnASingleLine** (``ShortIfStyle``) :versionbadge:`clang-format 3.3` +.. _AllowShortIfStatementsOnASingleLine: + +**AllowShortIfStatementsOnASingleLine** (``ShortIfStyle``) :versionbadge:`clang-format 3.3` :ref:`¶ ` Dependent on the value, ``if (a) return;`` can be put on a single line. Possible values: @@ -1171,7 +1208,9 @@ -**AllowShortLambdasOnASingleLine** (``ShortLambdaStyle``) :versionbadge:`clang-format 9` +.. _AllowShortLambdasOnASingleLine: + +**AllowShortLambdasOnASingleLine** (``ShortLambdaStyle``) :versionbadge:`clang-format 9` :ref:`¶ ` Dependent on the value, ``auto lambda []() { return 0; }`` can be put on a single line. @@ -1210,11 +1249,15 @@ -**AllowShortLoopsOnASingleLine** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _AllowShortLoopsOnASingleLine: + +**AllowShortLoopsOnASingleLine** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``true``, ``while (true) continue;`` can be put on a single line. -**AlwaysBreakAfterDefinitionReturnType** (``DefinitionReturnTypeBreakingStyle``) :versionbadge:`clang-format 3.7` +.. _AlwaysBreakAfterDefinitionReturnType: + +**AlwaysBreakAfterDefinitionReturnType** (``DefinitionReturnTypeBreakingStyle``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The function definition return type breaking style to use. This option is **deprecated** and is retained for backwards compatibility. @@ -1232,7 +1275,9 @@ -**AlwaysBreakAfterReturnType** (``ReturnTypeBreakingStyle``) :versionbadge:`clang-format 3.8` +.. _AlwaysBreakAfterReturnType: + +**AlwaysBreakAfterReturnType** (``ReturnTypeBreakingStyle``) :versionbadge:`clang-format 3.8` :ref:`¶ ` The function declaration return type breaking style to use. Possible values: @@ -1315,7 +1360,9 @@ -**AlwaysBreakBeforeMultilineStrings** (``Boolean``) :versionbadge:`clang-format 3.4` +.. _AlwaysBreakBeforeMultilineStrings: + +**AlwaysBreakBeforeMultilineStrings** (``Boolean``) :versionbadge:`clang-format 3.4` :ref:`¶ ` If ``true``, always break before multiline string literals. This flag is mean to make cases where there are multiple multiline strings @@ -1330,7 +1377,9 @@ "bbbb" "cccc"; "cccc"; -**AlwaysBreakTemplateDeclarations** (``BreakTemplateDeclarationsStyle``) :versionbadge:`clang-format 3.4` +.. _AlwaysBreakTemplateDeclarations: + +**AlwaysBreakTemplateDeclarations** (``BreakTemplateDeclarationsStyle``) :versionbadge:`clang-format 3.4` :ref:`¶ ` The template declaration breaking style to use. Possible values: @@ -1375,7 +1424,9 @@ -**AttributeMacros** (``List of Strings``) :versionbadge:`clang-format 12` +.. _AttributeMacros: + +**AttributeMacros** (``List of Strings``) :versionbadge:`clang-format 12` :ref:`¶ ` A vector of strings that should be interpreted as attributes/qualifiers instead of identifiers. This can be useful for language extensions or static analyzer annotations. @@ -1394,7 +1445,9 @@ AttributeMacros: ['__capability', '__output', '__ununsed'] -**BinPackArguments** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _BinPackArguments: + +**BinPackArguments** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``false``, a function call's arguments will either be all on the same line or will have one line each. @@ -1413,7 +1466,9 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); } -**BinPackParameters** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _BinPackParameters: + +**BinPackParameters** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``false``, a function declaration's or function definition's parameters will either all be on the same line or will have one line each. @@ -1428,7 +1483,9 @@ int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} -**BitFieldColonSpacing** (``BitFieldColonSpacingStyle``) :versionbadge:`clang-format 12` +.. _BitFieldColonSpacing: + +**BitFieldColonSpacing** (``BitFieldColonSpacingStyle``) :versionbadge:`clang-format 12` :ref:`¶ ` The BitFieldColonSpacingStyle to use for bitfields. Possible values: @@ -1465,7 +1522,9 @@ -**BraceWrapping** (``BraceWrappingFlags``) :versionbadge:`clang-format 3.8` +.. _BraceWrapping: + +**BraceWrapping** (``BraceWrappingFlags``) :versionbadge:`clang-format 3.8` :ref:`¶ ` Control of individual brace wrapping cases. If ``BreakBeforeBraces`` is set to ``BS_Custom``, use this to specify how @@ -1762,7 +1821,9 @@ } -**BreakAfterJavaFieldAnnotations** (``Boolean``) :versionbadge:`clang-format 3.8` +.. _BreakAfterJavaFieldAnnotations: + +**BreakAfterJavaFieldAnnotations** (``Boolean``) :versionbadge:`clang-format 3.8` :ref:`¶ ` Break after each annotation on a field in Java files. .. code-block:: java @@ -1772,7 +1833,9 @@ @Mock DataLoad loader; -**BreakArrays** (``Boolean``) :versionbadge:`clang-format 16` +.. _BreakArrays: + +**BreakArrays** (``Boolean``) :versionbadge:`clang-format 16` :ref:`¶ ` If ``true``, clang-format will always break after a Json array `[` otherwise it will scan until the closing `]` to determine if it should add newlines between elements (prettier compatible). @@ -1789,7 +1852,9 @@ 4 ] -**BreakBeforeBinaryOperators** (``BinaryOperatorStyle``) :versionbadge:`clang-format 3.6` +.. _BreakBeforeBinaryOperators: + +**BreakBeforeBinaryOperators** (``BinaryOperatorStyle``) :versionbadge:`clang-format 3.6` :ref:`¶ ` The way to wrap binary operators. Possible values: @@ -1838,7 +1903,9 @@ -**BreakBeforeBraces** (``BraceBreakingStyle``) :versionbadge:`clang-format 3.7` +.. _BreakBeforeBraces: + +**BreakBeforeBraces** (``BraceBreakingStyle``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The brace breaking style to use. Possible values: @@ -2289,7 +2356,9 @@ -**BreakBeforeConceptDeclarations** (``BreakBeforeConceptDeclarationsStyle``) :versionbadge:`clang-format 12` +.. _BreakBeforeConceptDeclarations: + +**BreakBeforeConceptDeclarations** (``BreakBeforeConceptDeclarationsStyle``) :versionbadge:`clang-format 12` :ref:`¶ ` The concept declaration style to use. Possible values: @@ -2317,7 +2386,9 @@ -**BreakBeforeInlineASMColon** (``BreakBeforeInlineASMColonStyle``) :versionbadge:`clang-format 16` +.. _BreakBeforeInlineASMColon: + +**BreakBeforeInlineASMColon** (``BreakBeforeInlineASMColonStyle``) :versionbadge:`clang-format 16` :ref:`¶ ` The inline ASM colon style to use. Possible values: @@ -2351,7 +2422,9 @@ -**BreakBeforeTernaryOperators** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _BreakBeforeTernaryOperators: + +**BreakBeforeTernaryOperators** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``true``, ternary operators will be placed after line breaks. .. code-block:: c++ @@ -2366,7 +2439,9 @@ firstValue : SecondValueVeryVeryVeryVeryLong; -**BreakConstructorInitializers** (``BreakConstructorInitializersStyle``) :versionbadge:`clang-format 5` +.. _BreakConstructorInitializers: + +**BreakConstructorInitializers** (``BreakConstructorInitializersStyle``) :versionbadge:`clang-format 5` :ref:`¶ ` The break constructor initializers style to use. Possible values: @@ -2401,7 +2476,9 @@ -**BreakInheritanceList** (``BreakInheritanceListStyle``) :versionbadge:`clang-format 7` +.. _BreakInheritanceList: + +**BreakInheritanceList** (``BreakInheritanceListStyle``) :versionbadge:`clang-format 7` :ref:`¶ ` The inheritance list style to use. Possible values: @@ -2448,7 +2525,9 @@ -**BreakStringLiterals** (``Boolean``) :versionbadge:`clang-format 3.9` +.. _BreakStringLiterals: + +**BreakStringLiterals** (``Boolean``) :versionbadge:`clang-format 3.9` :ref:`¶ ` Allow breaking string literals when formatting. .. code-block:: c++ @@ -2462,14 +2541,18 @@ const char* x = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; -**ColumnLimit** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _ColumnLimit: + +**ColumnLimit** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The column limit. A column limit of ``0`` means that there is no column limit. In this case, clang-format will respect the input's line breaking decisions within statements unless they contradict other rules. -**CommentPragmas** (``String``) :versionbadge:`clang-format 3.7` +.. _CommentPragmas: + +**CommentPragmas** (``String``) :versionbadge:`clang-format 3.7` :ref:`¶ ` A regular expression that describes comments with special meaning, which should not be split into lines or otherwise changed. @@ -2479,7 +2562,9 @@ // Will leave the following line unaffected #include // FOOBAR pragma: keep -**CompactNamespaces** (``Boolean``) :versionbadge:`clang-format 5` +.. _CompactNamespaces: + +**CompactNamespaces** (``Boolean``) :versionbadge:`clang-format 5` :ref:`¶ ` If ``true``, consecutive namespace declarations will be on the same line. If ``false``, each namespace is declared on a new line. @@ -2504,15 +2589,21 @@ namespace Extra { }}} -**ConstructorInitializerAllOnOneLineOrOnePerLine** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _ConstructorInitializerAllOnOneLineOrOnePerLine: + +**ConstructorInitializerAllOnOneLineOrOnePerLine** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` This option is **deprecated**. See ``CurrentLine`` of ``PackConstructorInitializers``. -**ConstructorInitializerIndentWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _ConstructorInitializerIndentWidth: + +**ConstructorInitializerIndentWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The number of characters to use for indentation of constructor initializer lists as well as inheritance lists. -**ContinuationIndentWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _ContinuationIndentWidth: + +**ContinuationIndentWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` Indent width for line continuations. .. code-block:: c++ @@ -2523,7 +2614,9 @@ longFunction( // Again a long comment arg); -**Cpp11BracedListStyle** (``Boolean``) :versionbadge:`clang-format 3.4` +.. _Cpp11BracedListStyle: + +**Cpp11BracedListStyle** (``Boolean``) :versionbadge:`clang-format 3.4` :ref:`¶ ` If ``true``, format braced lists as best suited for C++11 braced lists. @@ -2546,21 +2639,29 @@ f(MyMap[{composite, key}]); f(MyMap[{ composite, key }]); new int[3]{1, 2, 3}; new int[3]{ 1, 2, 3 }; -**DeriveLineEnding** (``Boolean``) :versionbadge:`clang-format 10` +.. _DeriveLineEnding: + +**DeriveLineEnding** (``Boolean``) :versionbadge:`clang-format 10` :ref:`¶ ` Analyze the formatted file for the most used line ending (``\r\n`` or ``\n``). ``UseCRLF`` is only used as a fallback if none can be derived. -**DerivePointerAlignment** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _DerivePointerAlignment: + +**DerivePointerAlignment** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``true``, analyze the formatted file for the most common alignment of ``&`` and ``*``. Pointer and reference alignment styles are going to be updated according to the preferences found in the file. ``PointerAlignment`` is then used only as fallback. -**DisableFormat** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _DisableFormat: + +**DisableFormat** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` Disables formatting completely. -**EmptyLineAfterAccessModifier** (``EmptyLineAfterAccessModifierStyle``) :versionbadge:`clang-format 13` +.. _EmptyLineAfterAccessModifier: + +**EmptyLineAfterAccessModifier** (``EmptyLineAfterAccessModifierStyle``) :versionbadge:`clang-format 13` :ref:`¶ ` Defines when to put an empty line after access modifiers. ``EmptyLineBeforeAccessModifier`` configuration handles the number of empty lines between two access modifiers. @@ -2613,7 +2714,9 @@ -**EmptyLineBeforeAccessModifier** (``EmptyLineBeforeAccessModifierStyle``) :versionbadge:`clang-format 12` +.. _EmptyLineBeforeAccessModifier: + +**EmptyLineBeforeAccessModifier** (``EmptyLineBeforeAccessModifierStyle``) :versionbadge:`clang-format 12` :ref:`¶ ` Defines in which cases to put empty line before access modifiers. Possible values: @@ -2682,7 +2785,9 @@ -**ExperimentalAutoDetectBinPacking** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _ExperimentalAutoDetectBinPacking: + +**ExperimentalAutoDetectBinPacking** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``true``, clang-format detects whether function calls and definitions are formatted with one parameter per line. @@ -2694,7 +2799,9 @@ NOTE: This is an experimental flag, that might go away or be renamed. Do not use this in config files, etc. Use at your own risk. -**FixNamespaceComments** (``Boolean``) :versionbadge:`clang-format 5` +.. _FixNamespaceComments: + +**FixNamespaceComments** (``Boolean``) :versionbadge:`clang-format 5` :ref:`¶ ` If ``true``, clang-format adds missing namespace end comments for namespaces and fixes invalid existing ones. This doesn't affect short namespaces, which are controlled by ``ShortNamespaceLines``. @@ -2710,7 +2817,9 @@ void baz(); void baz(); } } -**ForEachMacros** (``List of Strings``) :versionbadge:`clang-format 3.7` +.. _ForEachMacros: + +**ForEachMacros** (``List of Strings``) :versionbadge:`clang-format 3.7` :ref:`¶ ` A vector of macros that should be interpreted as foreach loops instead of as function calls. @@ -2729,7 +2838,9 @@ For example: BOOST_FOREACH. -**IfMacros** (``List of Strings``) :versionbadge:`clang-format 13` +.. _IfMacros: + +**IfMacros** (``List of Strings``) :versionbadge:`clang-format 13` :ref:`¶ ` A vector of macros that should be interpreted as conditionals instead of as function calls. @@ -2751,7 +2862,9 @@ For example: `KJ_IF_MAYBE `_ -**IncludeBlocks** (``IncludeBlocksStyle``) :versionbadge:`clang-format 6` +.. _IncludeBlocks: + +**IncludeBlocks** (``IncludeBlocksStyle``) :versionbadge:`clang-format 6` :ref:`¶ ` Dependent on the value, multiple ``#include`` blocks can be sorted as one and divided based on category. @@ -2791,7 +2904,9 @@ -**IncludeCategories** (``List of IncludeCategories``) :versionbadge:`clang-format 3.8` +.. _IncludeCategories: + +**IncludeCategories** (``List of IncludeCategories``) :versionbadge:`clang-format 3.8` :ref:`¶ ` Regular expressions denoting the different ``#include`` categories used for ordering ``#includes``. @@ -2839,7 +2954,9 @@ Priority: 1 SortPriority: 0 -**IncludeIsMainRegex** (``String``) :versionbadge:`clang-format 3.9` +.. _IncludeIsMainRegex: + +**IncludeIsMainRegex** (``String``) :versionbadge:`clang-format 3.9` :ref:`¶ ` Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping. @@ -2852,7 +2969,9 @@ For example, if configured to "(_test)?$", then a header a.h would be seen as the "main" include in both a.cc and a_test.cc. -**IncludeIsMainSourceRegex** (``String``) :versionbadge:`clang-format 10` +.. _IncludeIsMainSourceRegex: + +**IncludeIsMainSourceRegex** (``String``) :versionbadge:`clang-format 10` :ref:`¶ ` Specify a regular expression for files being formatted that are allowed to be considered "main" in the file-to-main-include mapping. @@ -2872,7 +2991,9 @@ ``ClassImpl.hpp`` would not have the main include file put on top before any other include. -**IndentAccessModifiers** (``Boolean``) :versionbadge:`clang-format 13` +.. _IndentAccessModifiers: + +**IndentAccessModifiers** (``Boolean``) :versionbadge:`clang-format 13` :ref:`¶ ` Specify whether access modifiers should have their own indentation level. When ``false``, access modifiers are indented (or outdented) relative to @@ -2899,7 +3020,9 @@ return 1; return 1; } } -**IndentCaseBlocks** (``Boolean``) :versionbadge:`clang-format 11` +.. _IndentCaseBlocks: + +**IndentCaseBlocks** (``Boolean``) :versionbadge:`clang-format 11` :ref:`¶ ` Indent case label blocks one level from the case label. When ``false``, the block following the case label uses the same @@ -2922,7 +3045,9 @@ } } -**IndentCaseLabels** (``Boolean``) :versionbadge:`clang-format 3.3` +.. _IndentCaseLabels: + +**IndentCaseLabels** (``Boolean``) :versionbadge:`clang-format 3.3` :ref:`¶ ` Indent case labels one level from the switch statement. When ``false``, use the same indentation level as for the switch @@ -2941,7 +3066,9 @@ plop(); plop(); } } -**IndentExternBlock** (``IndentExternBlockStyle``) :versionbadge:`clang-format 11` +.. _IndentExternBlock: + +**IndentExternBlock** (``IndentExternBlockStyle``) :versionbadge:`clang-format 11` :ref:`¶ ` IndentExternBlockStyle is the type of indenting of extern blocks. Possible values: @@ -2987,7 +3114,9 @@ -**IndentGotoLabels** (``Boolean``) :versionbadge:`clang-format 10` +.. _IndentGotoLabels: + +**IndentGotoLabels** (``Boolean``) :versionbadge:`clang-format 10` :ref:`¶ ` Indent goto labels. When ``false``, goto labels are flushed left. @@ -3004,7 +3133,9 @@ return 1; return 1; } } -**IndentPPDirectives** (``PPDirectiveIndentStyle``) :versionbadge:`clang-format 6` +.. _IndentPPDirectives: + +**IndentPPDirectives** (``PPDirectiveIndentStyle``) :versionbadge:`clang-format 6` :ref:`¶ ` The preprocessor directive indenting style to use. Possible values: @@ -3044,7 +3175,9 @@ -**IndentRequiresClause** (``Boolean``) :versionbadge:`clang-format 15` +.. _IndentRequiresClause: + +**IndentRequiresClause** (``Boolean``) :versionbadge:`clang-format 15` :ref:`¶ ` Indent the requires clause in a template. This only applies when ``RequiresClausePosition`` is ``OwnLine``, or ``WithFollowing``. @@ -3066,7 +3199,9 @@ //.... } -**IndentWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _IndentWidth: + +**IndentWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The number of columns to use for indentation. .. code-block:: c++ @@ -3080,7 +3215,9 @@ } } -**IndentWrappedFunctionNames** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _IndentWrappedFunctionNames: + +**IndentWrappedFunctionNames** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` Indent if a function definition or declaration is wrapped after the type. @@ -3094,7 +3231,9 @@ LoooooooooooooooooooooooooooooooooooooooongReturnType LoooooooooooooooooooooooooooooooongFunctionDeclaration(); -**InsertBraces** (``Boolean``) :versionbadge:`clang-format 15` +.. _InsertBraces: + +**InsertBraces** (``Boolean``) :versionbadge:`clang-format 15` :ref:`¶ ` Insert braces after control statements (``if``, ``else``, ``for``, ``do``, and ``while``) in C++ unless the control statements are inside macro definitions or the braces would enclose preprocessor directives. @@ -3127,7 +3266,9 @@ --i; --i; while (i); } while (i); -**InsertTrailingCommas** (``TrailingCommaStyle``) :versionbadge:`clang-format 11` +.. _InsertTrailingCommas: + +**InsertTrailingCommas** (``TrailingCommaStyle``) :versionbadge:`clang-format 11` :ref:`¶ ` If set to ``TCS_Wrapped`` will insert trailing commas in container literals (arrays and objects) that wrap across multiple lines. It is currently only available for JavaScript @@ -3159,7 +3300,9 @@ -**JavaImportGroups** (``List of Strings``) :versionbadge:`clang-format 8` +.. _JavaImportGroups: + +**JavaImportGroups** (``List of Strings``) :versionbadge:`clang-format 8` :ref:`¶ ` A vector of prefixes ordered by the desired groups for Java imports. One group's prefix can be a subset of another - the longest prefix is @@ -3194,7 +3337,9 @@ import org.example.ClassD; -**JavaScriptQuotes** (``JavaScriptQuoteStyle``) :versionbadge:`clang-format 3.9` +.. _JavaScriptQuotes: + +**JavaScriptQuotes** (``JavaScriptQuoteStyle``) :versionbadge:`clang-format 3.9` :ref:`¶ ` The JavaScriptQuoteStyle to use for JavaScript strings. Possible values: @@ -3225,7 +3370,9 @@ -**JavaScriptWrapImports** (``Boolean``) :versionbadge:`clang-format 3.9` +.. _JavaScriptWrapImports: + +**JavaScriptWrapImports** (``Boolean``) :versionbadge:`clang-format 3.9` :ref:`¶ ` Whether to wrap JavaScript import/export statements. .. code-block:: js @@ -3240,7 +3387,9 @@ false: import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from "some/module.js" -**KeepEmptyLinesAtTheStartOfBlocks** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _KeepEmptyLinesAtTheStartOfBlocks: + +**KeepEmptyLinesAtTheStartOfBlocks** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If true, the empty line at the start of blocks is kept. .. code-block:: c++ @@ -3251,7 +3400,9 @@ bar(); } } -**LambdaBodyIndentation** (``LambdaBodyIndentationKind``) :versionbadge:`clang-format 13` +.. _LambdaBodyIndentation: + +**LambdaBodyIndentation** (``LambdaBodyIndentationKind``) :versionbadge:`clang-format 13` :ref:`¶ ` The indentation style of lambda bodies. ``Signature`` (the default) causes the lambda body to be indented one additional level relative to the indentation level of the signature. ``OuterScope`` forces the lambda @@ -3287,7 +3438,9 @@ -**Language** (``LanguageKind``) :versionbadge:`clang-format 3.5` +.. _Language: + +**Language** (``LanguageKind``) :versionbadge:`clang-format 3.5` :ref:`¶ ` Language, this format style is targeted at. Possible values: @@ -3331,7 +3484,9 @@ -**MacroBlockBegin** (``String``) :versionbadge:`clang-format 3.7` +.. _MacroBlockBegin: + +**MacroBlockBegin** (``String``) :versionbadge:`clang-format 3.7` :ref:`¶ ` A regular expression matching macros that start a block. .. code-block:: c++ @@ -3360,10 +3515,14 @@ bar(); NS_TABLE_FOO_END -**MacroBlockEnd** (``String``) :versionbadge:`clang-format 3.7` +.. _MacroBlockEnd: + +**MacroBlockEnd** (``String``) :versionbadge:`clang-format 3.7` :ref:`¶ ` A regular expression matching macros that end a block. -**MaxEmptyLinesToKeep** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _MaxEmptyLinesToKeep: + +**MaxEmptyLinesToKeep** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The maximum number of consecutive empty lines to keep. .. code-block:: c++ @@ -3377,7 +3536,9 @@ return i; } -**NamespaceIndentation** (``NamespaceIndentationKind``) :versionbadge:`clang-format 3.7` +.. _NamespaceIndentation: + +**NamespaceIndentation** (``NamespaceIndentationKind``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The indentation used for namespaces. Possible values: @@ -3420,7 +3581,9 @@ -**NamespaceMacros** (``List of Strings``) :versionbadge:`clang-format 9` +.. _NamespaceMacros: + +**NamespaceMacros** (``List of Strings``) :versionbadge:`clang-format 9` :ref:`¶ ` A vector of macros which are used to open namespace blocks. These are expected to be macros of the form: @@ -3433,7 +3596,9 @@ For example: TESTSUITE -**ObjCBinPackProtocolList** (``BinPackStyle``) :versionbadge:`clang-format 7` +.. _ObjCBinPackProtocolList: + +**ObjCBinPackProtocolList** (``BinPackStyle``) :versionbadge:`clang-format 7` :ref:`¶ ` Controls bin-packing Objective-C protocol conformance list items into as few lines as possible when they go over ``ColumnLimit``. @@ -3479,7 +3644,9 @@ -**ObjCBlockIndentWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _ObjCBlockIndentWidth: + +**ObjCBlockIndentWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The number of characters to use for indentation of ObjC blocks. .. code-block:: objc @@ -3490,7 +3657,9 @@ [self onOperationDone]; }]; -**ObjCBreakBeforeNestedBlockParam** (``Boolean``) :versionbadge:`clang-format 11` +.. _ObjCBreakBeforeNestedBlockParam: + +**ObjCBreakBeforeNestedBlockParam** (``Boolean``) :versionbadge:`clang-format 11` :ref:`¶ ` Break parameters list into lines when there is nested block parameters in a function call. @@ -3514,15 +3683,21 @@ }] } -**ObjCSpaceAfterProperty** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _ObjCSpaceAfterProperty: + +**ObjCSpaceAfterProperty** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` Add a space after ``@property`` in Objective-C, i.e. use ``@property (readonly)`` instead of ``@property(readonly)``. -**ObjCSpaceBeforeProtocolList** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _ObjCSpaceBeforeProtocolList: + +**ObjCSpaceBeforeProtocolList** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` Add a space in front of an Objective-C protocol list, i.e. use ``Foo `` instead of ``Foo``. -**PPIndentWidth** (``Integer``) :versionbadge:`clang-format 13` +.. _PPIndentWidth: + +**PPIndentWidth** (``Integer``) :versionbadge:`clang-format 13` :ref:`¶ ` The number of columns to use for indentation of preprocessor statements. When set to -1 (default) ``IndentWidth`` is used also for preprocessor statements. @@ -3537,7 +3712,9 @@ # define BAR #endif -**PackConstructorInitializers** (``PackConstructorInitializersStyle``) :versionbadge:`clang-format 14` +.. _PackConstructorInitializers: + +**PackConstructorInitializers** (``PackConstructorInitializersStyle``) :versionbadge:`clang-format 14` :ref:`¶ ` The pack constructor initializers style to use. Possible values: @@ -3591,38 +3768,60 @@ -**PenaltyBreakAssignment** (``Unsigned``) :versionbadge:`clang-format 5` +.. _PenaltyBreakAssignment: + +**PenaltyBreakAssignment** (``Unsigned``) :versionbadge:`clang-format 5` :ref:`¶ ` The penalty for breaking around an assignment operator. -**PenaltyBreakBeforeFirstCallParameter** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _PenaltyBreakBeforeFirstCallParameter: + +**PenaltyBreakBeforeFirstCallParameter** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The penalty for breaking a function call after ``call(``. -**PenaltyBreakComment** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _PenaltyBreakComment: + +**PenaltyBreakComment** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The penalty for each line break introduced inside a comment. -**PenaltyBreakFirstLessLess** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _PenaltyBreakFirstLessLess: + +**PenaltyBreakFirstLessLess** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The penalty for breaking before the first ``<<``. -**PenaltyBreakOpenParenthesis** (``Unsigned``) :versionbadge:`clang-format 14` +.. _PenaltyBreakOpenParenthesis: + +**PenaltyBreakOpenParenthesis** (``Unsigned``) :versionbadge:`clang-format 14` :ref:`¶ ` The penalty for breaking after ``(``. -**PenaltyBreakString** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _PenaltyBreakString: + +**PenaltyBreakString** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The penalty for each line break introduced inside a string literal. -**PenaltyBreakTemplateDeclaration** (``Unsigned``) :versionbadge:`clang-format 7` +.. _PenaltyBreakTemplateDeclaration: + +**PenaltyBreakTemplateDeclaration** (``Unsigned``) :versionbadge:`clang-format 7` :ref:`¶ ` The penalty for breaking after template declaration. -**PenaltyExcessCharacter** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _PenaltyExcessCharacter: + +**PenaltyExcessCharacter** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The penalty for each character outside of the column limit. -**PenaltyIndentedWhitespace** (``Unsigned``) :versionbadge:`clang-format 12` +.. _PenaltyIndentedWhitespace: + +**PenaltyIndentedWhitespace** (``Unsigned``) :versionbadge:`clang-format 12` :ref:`¶ ` Penalty for each character of whitespace indentation (counted relative to leading non-whitespace column). -**PenaltyReturnTypeOnItsOwnLine** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _PenaltyReturnTypeOnItsOwnLine: + +**PenaltyReturnTypeOnItsOwnLine** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` Penalty for putting the return type of a function onto its own line. -**PointerAlignment** (``PointerAlignmentStyle``) :versionbadge:`clang-format 3.7` +.. _PointerAlignment: + +**PointerAlignment** (``PointerAlignmentStyle``) :versionbadge:`clang-format 3.7` :ref:`¶ ` Pointer and reference alignment style. Possible values: @@ -3650,7 +3849,9 @@ -**QualifierAlignment** (``QualifierAlignmentStyle``) :versionbadge:`clang-format 14` +.. _QualifierAlignment: + +**QualifierAlignment** (``QualifierAlignmentStyle``) :versionbadge:`clang-format 14` :ref:`¶ ` Different ways to arrange specifiers and qualifiers (e.g. const/volatile). .. warning:: @@ -3705,7 +3906,9 @@ -**QualifierOrder** (``List of Strings``) :versionbadge:`clang-format 14` +.. _QualifierOrder: + +**QualifierOrder** (``List of Strings``) :versionbadge:`clang-format 14` :ref:`¶ ` The order in which the qualifiers appear. Order is an array that can contain any of the following: @@ -3727,7 +3930,9 @@ QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ] -**RawStringFormats** (``List of RawStringFormats``) :versionbadge:`clang-format 6` +.. _RawStringFormats: + +**RawStringFormats** (``List of RawStringFormats``) :versionbadge:`clang-format 6` :ref:`¶ ` Defines hints for detecting supported languages code blocks in raw strings. @@ -3765,7 +3970,9 @@ BasedOnStyle: llvm CanonicalDelimiter: 'cc' -**ReferenceAlignment** (``ReferenceAlignmentStyle``) :versionbadge:`clang-format 13` +.. _ReferenceAlignment: + +**ReferenceAlignment** (``ReferenceAlignmentStyle``) :versionbadge:`clang-format 13` :ref:`¶ ` Reference alignment style (overrides ``PointerAlignment`` for references). @@ -3797,7 +4004,9 @@ -**ReflowComments** (``Boolean``) :versionbadge:`clang-format 3.8` +.. _ReflowComments: + +**ReflowComments** (``Boolean``) :versionbadge:`clang-format 3.8` :ref:`¶ ` If ``true``, clang-format will attempt to re-flow comments. That is it will touch a comment and *reflow* long comments into new lines, trying to obey the ``ColumnLimit``. @@ -3814,7 +4023,9 @@ /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of * information */ -**RemoveBracesLLVM** (``Boolean``) :versionbadge:`clang-format 14` +.. _RemoveBracesLLVM: + +**RemoveBracesLLVM** (``Boolean``) :versionbadge:`clang-format 14` :ref:`¶ ` Remove optional braces of control statements (``if``, ``else``, ``for``, and ``while``) in C++ according to the LLVM coding style. @@ -3870,7 +4081,9 @@ } } -**RemoveSemicolon** (``Boolean``) :versionbadge:`clang-format 16` +.. _RemoveSemicolon: + +**RemoveSemicolon** (``Boolean``) :versionbadge:`clang-format 16` :ref:`¶ ` Remove semicolons after the closing brace of a non-empty function. .. warning:: @@ -3887,7 +4100,9 @@ return a > b ? a : b; return a > b ? a : b; }; } -**RequiresClausePosition** (``RequiresClausePositionStyle``) :versionbadge:`clang-format 15` +.. _RequiresClausePosition: + +**RequiresClausePosition** (``RequiresClausePositionStyle``) :versionbadge:`clang-format 15` :ref:`¶ ` The position of the ``requires`` clause. Possible values: @@ -3973,7 +4188,9 @@ -**RequiresExpressionIndentation** (``RequiresExpressionIndentationKind``) :versionbadge:`clang-format 16` +.. _RequiresExpressionIndentation: + +**RequiresExpressionIndentation** (``RequiresExpressionIndentationKind``) :versionbadge:`clang-format 16` :ref:`¶ ` The indentation used for requires expression bodies. Possible values: @@ -4002,7 +4219,9 @@ -**SeparateDefinitionBlocks** (``SeparateDefinitionStyle``) :versionbadge:`clang-format 14` +.. _SeparateDefinitionBlocks: + +**SeparateDefinitionBlocks** (``SeparateDefinitionStyle``) :versionbadge:`clang-format 14` :ref:`¶ ` Specifies the use of empty lines to separate definition blocks, including classes, structs, enums, and functions. @@ -4063,7 +4282,9 @@ -**ShortNamespaceLines** (``Unsigned``) :versionbadge:`clang-format 13` +.. _ShortNamespaceLines: + +**ShortNamespaceLines** (``Unsigned``) :versionbadge:`clang-format 13` :ref:`¶ ` The maximal number of unwrapped lines that a short namespace spans. Defaults to 1. @@ -4085,7 +4306,9 @@ int bar; int bar; } // namespace b } // namespace b -**SortIncludes** (``SortIncludesOptions``) :versionbadge:`clang-format 3.8` +.. _SortIncludes: + +**SortIncludes** (``SortIncludesOptions``) :versionbadge:`clang-format 3.8` :ref:`¶ ` Controls if and how clang-format will sort ``#includes``. If ``Never``, includes are never sorted. If ``CaseInsensitive``, includes are sorted in an ASCIIbetical or case @@ -4130,7 +4353,9 @@ -**SortJavaStaticImport** (``SortJavaStaticImportOptions``) :versionbadge:`clang-format 12` +.. _SortJavaStaticImport: + +**SortJavaStaticImport** (``SortJavaStaticImportOptions``) :versionbadge:`clang-format 12` :ref:`¶ ` When sorting Java imports, by default static imports are placed before non-static imports. If ``JavaStaticImportAfterImport`` is ``After``, static imports are placed after non-static imports. @@ -4157,7 +4382,9 @@ -**SortUsingDeclarations** (``Boolean``) :versionbadge:`clang-format 5` +.. _SortUsingDeclarations: + +**SortUsingDeclarations** (``Boolean``) :versionbadge:`clang-format 5` :ref:`¶ ` If ``true``, clang-format will sort using declarations. The order of using declarations is defined as follows: @@ -4174,7 +4401,9 @@ using std::cout; vs. using std::cin; using std::cin; using std::cout; -**SpaceAfterCStyleCast** (``Boolean``) :versionbadge:`clang-format 3.5` +.. _SpaceAfterCStyleCast: + +**SpaceAfterCStyleCast** (``Boolean``) :versionbadge:`clang-format 3.5` :ref:`¶ ` If ``true``, a space is inserted after C style casts. .. code-block:: c++ @@ -4182,7 +4411,9 @@ true: false: (int) i; vs. (int)i; -**SpaceAfterLogicalNot** (``Boolean``) :versionbadge:`clang-format 9` +.. _SpaceAfterLogicalNot: + +**SpaceAfterLogicalNot** (``Boolean``) :versionbadge:`clang-format 9` :ref:`¶ ` If ``true``, a space is inserted after the logical not operator (``!``). .. code-block:: c++ @@ -4190,7 +4421,9 @@ true: false: ! someExpression(); vs. !someExpression(); -**SpaceAfterTemplateKeyword** (``Boolean``) :versionbadge:`clang-format 4` +.. _SpaceAfterTemplateKeyword: + +**SpaceAfterTemplateKeyword** (``Boolean``) :versionbadge:`clang-format 4` :ref:`¶ ` If ``true``, a space will be inserted after the 'template' keyword. .. code-block:: c++ @@ -4198,7 +4431,9 @@ true: false: template void foo(); vs. template void foo(); -**SpaceAroundPointerQualifiers** (``SpaceAroundPointerQualifiersStyle``) :versionbadge:`clang-format 12` +.. _SpaceAroundPointerQualifiers: + +**SpaceAroundPointerQualifiers** (``SpaceAroundPointerQualifiersStyle``) :versionbadge:`clang-format 12` :ref:`¶ ` Defines in which cases to put a space before or after pointer qualifiers Possible values: @@ -4238,7 +4473,9 @@ -**SpaceBeforeAssignmentOperators** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _SpaceBeforeAssignmentOperators: + +**SpaceBeforeAssignmentOperators** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``false``, spaces will be removed before assignment operators. .. code-block:: c++ @@ -4247,7 +4484,9 @@ int a = 5; vs. int a= 5; a += 42; a+= 42; -**SpaceBeforeCaseColon** (``Boolean``) :versionbadge:`clang-format 12` +.. _SpaceBeforeCaseColon: + +**SpaceBeforeCaseColon** (``Boolean``) :versionbadge:`clang-format 12` :ref:`¶ ` If ``false``, spaces will be removed before case colon. .. code-block:: c++ @@ -4257,7 +4496,9 @@ case 1 : break; case 1: break; } } -**SpaceBeforeCpp11BracedList** (``Boolean``) :versionbadge:`clang-format 7` +.. _SpaceBeforeCpp11BracedList: + +**SpaceBeforeCpp11BracedList** (``Boolean``) :versionbadge:`clang-format 7` :ref:`¶ ` If ``true``, a space will be inserted before a C++11 braced list used to initialize an object (after the preceding identifier or type). @@ -4269,7 +4510,9 @@ vector { 1, 2, 3 }; vector{ 1, 2, 3 }; new int[3] { 1, 2, 3 }; new int[3]{ 1, 2, 3 }; -**SpaceBeforeCtorInitializerColon** (``Boolean``) :versionbadge:`clang-format 7` +.. _SpaceBeforeCtorInitializerColon: + +**SpaceBeforeCtorInitializerColon** (``Boolean``) :versionbadge:`clang-format 7` :ref:`¶ ` If ``false``, spaces will be removed before constructor initializer colon. @@ -4278,7 +4521,9 @@ true: false: Foo::Foo() : a(a) {} Foo::Foo(): a(a) {} -**SpaceBeforeInheritanceColon** (``Boolean``) :versionbadge:`clang-format 7` +.. _SpaceBeforeInheritanceColon: + +**SpaceBeforeInheritanceColon** (``Boolean``) :versionbadge:`clang-format 7` :ref:`¶ ` If ``false``, spaces will be removed before inheritance colon. .. code-block:: c++ @@ -4286,7 +4531,9 @@ true: false: class Foo : Bar {} vs. class Foo: Bar {} -**SpaceBeforeParens** (``SpaceBeforeParensStyle``) :versionbadge:`clang-format 3.5` +.. _SpaceBeforeParens: + +**SpaceBeforeParens** (``SpaceBeforeParensStyle``) :versionbadge:`clang-format 3.5` :ref:`¶ ` Defines in which cases to put a space before opening parentheses. Possible values: @@ -4362,7 +4609,9 @@ -**SpaceBeforeParensOptions** (``SpaceBeforeParensCustom``) :versionbadge:`clang-format 14` +.. _SpaceBeforeParensOptions: + +**SpaceBeforeParensOptions** (``SpaceBeforeParensCustom``) :versionbadge:`clang-format 14` :ref:`¶ ` Control of individual space before parentheses. If ``SpaceBeforeParens`` is set to ``Custom``, use this to specify @@ -4469,7 +4718,9 @@ f (a); f(); -**SpaceBeforeRangeBasedForLoopColon** (``Boolean``) :versionbadge:`clang-format 7` +.. _SpaceBeforeRangeBasedForLoopColon: + +**SpaceBeforeRangeBasedForLoopColon** (``Boolean``) :versionbadge:`clang-format 7` :ref:`¶ ` If ``false``, spaces will be removed before range-based for loop colon. @@ -4478,7 +4729,9 @@ true: false: for (auto v : values) {} vs. for(auto v: values) {} -**SpaceBeforeSquareBrackets** (``Boolean``) :versionbadge:`clang-format 10` +.. _SpaceBeforeSquareBrackets: + +**SpaceBeforeSquareBrackets** (``Boolean``) :versionbadge:`clang-format 10` :ref:`¶ ` If ``true``, spaces will be before ``[``. Lambdas will not be affected. Only the first ``[`` will get a space added. @@ -4488,7 +4741,9 @@ int a [5]; vs. int a[5]; int a [5][5]; vs. int a[5][5]; -**SpaceInEmptyBlock** (``Boolean``) :versionbadge:`clang-format 10` +.. _SpaceInEmptyBlock: + +**SpaceInEmptyBlock** (``Boolean``) :versionbadge:`clang-format 10` :ref:`¶ ` If ``true``, spaces will be inserted into ``{}``. .. code-block:: c++ @@ -4497,7 +4752,9 @@ void f() { } vs. void f() {} while (true) { } while (true) {} -**SpaceInEmptyParentheses** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _SpaceInEmptyParentheses: + +**SpaceInEmptyParentheses** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``true``, spaces may be inserted into ``()``. .. code-block:: c++ @@ -4510,7 +4767,9 @@ } } } } -**SpacesBeforeTrailingComments** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _SpacesBeforeTrailingComments: + +**SpacesBeforeTrailingComments** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The number of spaces before trailing line comments (``//`` - comments). @@ -4527,7 +4786,9 @@ } // foo } -**SpacesInAngles** (``SpacesInAnglesStyle``) :versionbadge:`clang-format 3.4` +.. _SpacesInAngles: + +**SpacesInAngles** (``SpacesInAnglesStyle``) :versionbadge:`clang-format 3.4` :ref:`¶ ` The SpacesInAnglesStyle to use for template argument lists. Possible values: @@ -4554,7 +4815,9 @@ -**SpacesInCStyleCastParentheses** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _SpacesInCStyleCastParentheses: + +**SpacesInCStyleCastParentheses** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``true``, spaces may be inserted into C style casts. .. code-block:: c++ @@ -4562,7 +4825,9 @@ true: false: x = ( int32 )y vs. x = (int32)y -**SpacesInConditionalStatement** (``Boolean``) :versionbadge:`clang-format 10` +.. _SpacesInConditionalStatement: + +**SpacesInConditionalStatement** (``Boolean``) :versionbadge:`clang-format 10` :ref:`¶ ` If ``true``, spaces will be inserted around if/for/switch/while conditions. @@ -4572,7 +4837,9 @@ if ( a ) { ... } vs. if (a) { ... } while ( i < 5 ) { ... } while (i < 5) { ... } -**SpacesInContainerLiterals** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _SpacesInContainerLiterals: + +**SpacesInContainerLiterals** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``true``, spaces are inserted inside container literals (e.g. ObjC and Javascript array and dict literals). @@ -4582,7 +4849,9 @@ var arr = [ 1, 2, 3 ]; vs. var arr = [1, 2, 3]; f({a : 1, b : 2, c : 3}); f({a: 1, b: 2, c: 3}); -**SpacesInLineCommentPrefix** (``SpacesInLineComment``) :versionbadge:`clang-format 13` +.. _SpacesInLineCommentPrefix: + +**SpacesInLineCommentPrefix** (``SpacesInLineComment``) :versionbadge:`clang-format 13` :ref:`¶ ` How many spaces are allowed at the start of a line comment. To disable the maximum set it to ``-1``, apart from that the maximum takes precedence over the minimum. @@ -4626,7 +4895,9 @@ * ``unsigned Maximum`` The maximum number of spaces at the start of the comment. -**SpacesInParentheses** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _SpacesInParentheses: + +**SpacesInParentheses** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``true``, spaces will be inserted after ``(`` and before ``)``. .. code-block:: c++ @@ -4634,7 +4905,9 @@ true: false: t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete; -**SpacesInSquareBrackets** (``Boolean``) :versionbadge:`clang-format 3.7` +.. _SpacesInSquareBrackets: + +**SpacesInSquareBrackets** (``Boolean``) :versionbadge:`clang-format 3.7` :ref:`¶ ` If ``true``, spaces will be inserted after ``[`` and before ``]``. Lambdas without arguments or unspecified size array declarations will not be affected. @@ -4645,7 +4918,9 @@ int a[ 5 ]; vs. int a[5]; std::unique_ptr foo() {} // Won't be affected -**Standard** (``LanguageStandard``) :versionbadge:`clang-format 3.7` +.. _Standard: + +**Standard** (``LanguageStandard``) :versionbadge:`clang-format 3.7` :ref:`¶ ` Parse and format C++ constructs compatible with this standard. .. code-block:: c++ @@ -4680,7 +4955,9 @@ -**StatementAttributeLikeMacros** (``List of Strings``) :versionbadge:`clang-format 12` +.. _StatementAttributeLikeMacros: + +**StatementAttributeLikeMacros** (``List of Strings``) :versionbadge:`clang-format 12` :ref:`¶ ` Macros which are ignored in front of a statement, as if they were an attribute. So that they are not parsed as identifier, for example for Qts emit. @@ -4697,7 +4974,9 @@ unsigned char data = 'x'; emit signal(data); // Now it's fine again. -**StatementMacros** (``List of Strings``) :versionbadge:`clang-format 8` +.. _StatementMacros: + +**StatementMacros** (``List of Strings``) :versionbadge:`clang-format 8` :ref:`¶ ` A vector of macros that should be interpreted as complete statements. @@ -4707,10 +4986,14 @@ For example: Q_UNUSED -**TabWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` +.. _TabWidth: + +**TabWidth** (``Unsigned``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The number of columns used for tab stops. -**TypenameMacros** (``List of Strings``) :versionbadge:`clang-format 9` +.. _TypenameMacros: + +**TypenameMacros** (``List of Strings``) :versionbadge:`clang-format 9` :ref:`¶ ` A vector of macros that should be interpreted as type declarations instead of as function calls. @@ -4728,11 +5011,15 @@ For example: OpenSSL STACK_OF, BSD LIST_ENTRY. -**UseCRLF** (``Boolean``) :versionbadge:`clang-format 10` +.. _UseCRLF: + +**UseCRLF** (``Boolean``) :versionbadge:`clang-format 10` :ref:`¶ ` Use ``\r\n`` instead of ``\n`` for line breaks. Also used as fallback if ``DeriveLineEnding`` is true. -**UseTab** (``UseTabStyle``) :versionbadge:`clang-format 3.7` +.. _UseTab: + +**UseTab** (``UseTabStyle``) :versionbadge:`clang-format 3.7` :ref:`¶ ` The way to use tab characters in the resulting file. Possible values: @@ -4757,7 +5044,9 @@ -**WhitespaceSensitiveMacros** (``List of Strings``) :versionbadge:`clang-format 11` +.. _WhitespaceSensitiveMacros: + +**WhitespaceSensitiveMacros** (``List of Strings``) :versionbadge:`clang-format 11` :ref:`¶ ` A vector of macros which are whitespace-sensitive and should not be touched. diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py --- a/clang/docs/tools/dump_format_style.py +++ b/clang/docs/tools/dump_format_style.py @@ -98,12 +98,10 @@ self.version = version def __str__(self): + s = ".. _%s:\n\n**%s** (``%s``) " % (self.name, self.name, to_yaml_type(self.type)) if self.version: - s = '**%s** (``%s``) :versionbadge:`clang-format %s`\n%s' % (self.name, to_yaml_type(self.type), self.version, - doxygen2rst(indent(self.comment, 2))) - else: - s = '**%s** (``%s``)\n%s' % (self.name, to_yaml_type(self.type), - doxygen2rst(indent(self.comment, 2))) + s += ':versionbadge:`clang-format %s` ' % self.version + s += ':ref:`¶ <%s>`\n%s' % (self.name, doxygen2rst(indent(self.comment, 2))) if self.enum and self.enum.values: s += indent('\n\nPossible values:\n\n%s\n' % self.enum, 2) if self.nested_struct: