From 6e4810bfd6794b7fd03803a6de12b8f896cc4654 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 8 Jul 2022 09:29:32 +0200 Subject: Use clang-format 12; update CONTRIBUTING.md wrt code formatting [skip ci] --- .clang-format | 89 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 25 deletions(-) (limited to '.clang-format') diff --git a/.clang-format b/.clang-format index 8375204a..f07bad67 100644 --- a/.clang-format +++ b/.clang-format @@ -14,23 +14,26 @@ # to borrow from the WebKit style. The values for such settings try to but # are not guaranteed to coincide with the latest version of the WebKit style. +# This file assumes ClangFormat 12 or newer + --- Language: Cpp BasedOnStyle: WebKit #AccessModifierOffset: -4 AlignAfterOpenBracket: Align -#AlignConsecutiveMacros: false -#AlignConsecutiveAssignments: false -#AlignConsecutiveDeclarations: false +#AlignArrayOfStructures: None # ClangFormat 13 +#AlignConsecutiveMacros: None +#AlignConsecutiveAssignments: None +#AlignConsecutiveDeclarations: None AlignEscapedNewlines: Left -AlignOperands: true # 'Align' since ClangFormat 11 +AlignOperands: Align #AlignTrailingComments: false #AllowAllArgumentsOnNextLine: true -#AllowAllConstructorInitializersOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true #AllowAllParametersOfDeclarationOnNextLine: true #AllowShortEnumsOnASingleLine: true #AllowShortBlocksOnASingleLine: Empty -#AllowShortCaseLabelsOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: true #AllowShortFunctionsOnASingleLine: All #AllowShortLambdasOnASingleLine: All #AllowShortIfStatementsOnASingleLine: Never @@ -39,41 +42,49 @@ AlignOperands: true # 'Align' since ClangFormat 11 #AlwaysBreakAfterReturnType: None #AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: Yes +#AttributeMacros: +# - __capability #BinPackArguments: true #BinPackParameters: true BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: Never # Switch to MultiLine, once https://bugs.llvm.org/show_bug.cgi?id=47936 is fixed - AfterEnum: false +# AfterCaseLabel: false +# AfterClass: false + AfterControlStatement: Never # Switch to MultiLine with ClangFormat 14 (https://bugs.llvm.org/show_bug.cgi?id=47936) +# AfterEnum: false AfterFunction: true - AfterNamespace: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false - IndentBraces: false +# AfterNamespace: false +# AfterStruct: false +# AfterUnion: false +# AfterExternBlock: false +# BeforeCatch: false +# BeforeElse: false + BeforeLambdaBody: true +# BeforeWhile: false +# IndentBraces: false SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false BreakBeforeBinaryOperators: NonAssignment +#BreakBeforeConceptDeclarations: true BreakBeforeBraces: Custom -#BreakBeforeInheritanceComma: false +#BreakBeforeInheritanceComma: false # deprecated? #BreakInheritanceList: BeforeColon #BreakBeforeTernaryOperators: true #BreakConstructorInitializersBeforeComma: false # deprecated? #BreakConstructorInitializers: BeforeComma #BreakStringLiterals: true ColumnLimit: 80 +#QualifierAlignment: Leave # ClangFormat 14? #CompactNamespaces: false -#ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true #ConstructorInitializerIndentWidth: 4 #ContinuationIndentWidth: 4 -Cpp11BracedListStyle: false +#Cpp11BracedListStyle: true #DeriveLineEnding: true #DerivePointerAlignment: false -FixNamespaceComments: true +#EmptyLineAfterAccessModifier: Never # ClangFormat 14 +EmptyLineBeforeAccessModifier: Always +#FixNamespaceComments: false # See ShortNamespaces below IncludeBlocks: Regroup IncludeCategories: - Regex: '^