diff --git a/.clang-format b/.clang-format index f061c33433..e8581995c4 100644 --- a/.clang-format +++ b/.clang-format @@ -3,8 +3,8 @@ Language: Cpp # BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: AlwaysBreak -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true AlignEscapedNewlines: Right AlignOperands: true AlignTrailingComments: true @@ -13,15 +13,15 @@ AllowAllParametersOfDeclarationOnNextLine: true # AllowAllConstructorInitializersOnNextLine: true AllowShortBlocksOnASingleLine: true AllowShortCaseLabelsOnASingleLine: true -AllowShortFunctionsOnASingleLine: None -AllowShortIfStatementsOnASingleLine: false +AllowShortFunctionsOnASingleLine: InlineOnly +AllowShortIfStatementsOnASingleLine: true AllowShortLoopsOnASingleLine: false # AllowShortLambdasOnASingleLine: true -AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterDefinitionReturnType: TopLevel AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: MultiLine -BinPackArguments: true +BinPackArguments: false BinPackParameters: false BraceWrapping: AfterClass: true @@ -57,7 +57,6 @@ ContinuationIndentWidth: 4 Cpp11BracedListStyle: false DerivePointerAlignment: false DisableFormat: false -ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - foreach @@ -87,19 +86,19 @@ ObjCBinPackProtocolList: Auto ObjCBlockIndentWidth: 4 ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true -PenaltyBreakAssignment: 4 +PenaltyBreakAssignment: 8 PenaltyBreakBeforeFirstCallParameter: 8 -PenaltyBreakComment: 300 +PenaltyBreakComment: 1000 PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 20 -PointerAlignment: Right +PointerAlignment: Left ReflowComments: false SortIncludes: true SortUsingDeclarations: true -SpaceAfterCStyleCast: false +SpaceAfterCStyleCast: true SpaceAfterTemplateKeyword: true SpaceBeforeAssignmentOperators: true SpaceBeforeCpp11BracedList: false @@ -109,12 +108,13 @@ SpaceBeforeParens: Always SpaceBeforeRangeBasedForLoopColon: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: true +SpacesInAngles: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false -SpacesInParentheses: true +SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Cpp11 TabWidth: 8 +#UseTab: ForIndentation UseTab: Never ... diff --git a/util/reformat.sh b/util/reformat.sh new file mode 100755 index 0000000000..611f86c858 --- /dev/null +++ b/util/reformat.sh @@ -0,0 +1,15 @@ +#! /bin/sh + +cformat=`which clang-format` +if [[ "${cformat}" == "" ]]; then + echo "ERROR: clang-format not found" + exit 1 +fi + +scriptpath=`realpath $0` +scriptdir=`dirname $scriptpath` +basedir=`dirname $scriptdir` +echo "Processing files in: ${basedir}" +cd ${basedir} +find . \( -name '*.cpp' -o -name '*.h' \) -exec ${cformat} -style=file -verbose -i {} \; +