From c1b7b114b63facaccd835b602cbd13e7869835a9 Mon Sep 17 00:00:00 2001 From: David Steele Date: Mon, 7 Sep 2020 17:08:01 +0100 Subject: [PATCH] Adding clang format Closely follows new dali-style Change-Id: I285743bf054dfbb04809ec995e47f00426134889 --- .clang-format | 96 ++++++++++++++++++++++++++++++++++ dali-toolkit/third-party/.clang-format | 5 ++ format | 1 + 3 files changed, 102 insertions(+) create mode 100644 .clang-format create mode 100644 dali-toolkit/third-party/.clang-format create mode 100755 format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..d314ca1 --- /dev/null +++ b/.clang-format @@ -0,0 +1,96 @@ +--- +Language: Cpp +BasedOnStyle: Google +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignEscapedNewlinesLeft: true +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: true + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +ConstructorInitializerAllOnOneLineOrOnePerLine: true +AllowAllConstructorInitializersOnNextLine : false +ConstructorInitializerIndentWidth: 0 +ColumnLimit: 0 +CommentPragmas: '^ IWYU pragma:' +ContinuationIndentWidth: 2 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +SpaceBeforeCtorInitializerColon: false +IndentCaseLabels: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '^DALI_ENUM_TO_STRING_TABLE_BEGIN' +MacroBlockEnd: 'DALI_ENUM_TO_STRING_TABLE_END' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: Never +SpaceInEmptyParentheses: false +SpacesInConditionalStatement : false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceAfterTemplateKeyword: false +Standard: Auto +TabWidth: 2 +UseTab: Never +... diff --git a/dali-toolkit/third-party/.clang-format b/dali-toolkit/third-party/.clang-format new file mode 100644 index 0000000..297ddc2 --- /dev/null +++ b/dali-toolkit/third-party/.clang-format @@ -0,0 +1,5 @@ +--- +Language: Cpp +DisableFormat: true +SortIncludes: false +... diff --git a/format b/format new file mode 100755 index 0000000..c5630b4 --- /dev/null +++ b/format @@ -0,0 +1 @@ +git diff -U0 --no-color HEAD^ | clang-format-diff -i -p1 \ No newline at end of file -- 2.7.4